Entrecard Bot – The code within

Posted on November 9th, 2008 by Donace in Bots, Coding

Now you may have noticed that my entrecard bot project has been on hold for a while; this is mainly because I did not have the time to finish coding in the smaller bits and as I stopped using entrecard, I had no need for the bot.

This is where YOU come in! Below I will detail the coding for the program so you can complete it and enjoy the benefits of the entrecard bot yourself!

All I ask is that you credit the site and myself with the code if you do go ahead.

The tools you need

The code is written in a very simple and easy to leanr language called autoit. You can grab the full pack including editor and testing tools here.

The code!

Since writing this I have grown in knowledge and found a great number of improvemnts that canbe made, which I will discuss later. This is the latest version of the code written.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=C:\Users\Administrator\Desktop\donace.ico
#AutoIt3Wrapper_outfile=EntrecardBot.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Comment=Entrecard Bot full version! V1.0.2
#AutoIt3Wrapper_Res_Description=Entrecard Bot full version! V1.0.2
#AutoIt3Wrapper_Res_Fileversion=1.0.2.0
#AutoIt3Wrapper_Res_LegalCopyright=Copyrighted Donace @ thenexus.tk
#AutoIt3Wrapper_Add_Constants=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;=================================================================================================================================
;
;Entrecard Bot V1.0.1
;By Donace
;http://thenexus.tk
;
;=================================================================================================================================
;
;Starting script

This Part of the script is just an introduction, with the version number etc. This is auto entered when compiling the code so there is no need to worry about adding / editing this part.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
;=================================================================================================================================
;CACHE CLEANER
;=================================================================================================================================
;	MsgBox(0, "Entrecard Bot", "Cleaning cache and temp files to minimise distruptions", 30)
 
#Include <File.au3>
#include <String.au3>
#Include <Misc.au3>
_Singleton("Global\CleanDisk", 2)
 
 
;## CleanMgr
 
Dim Const $RegPath    = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\"
Dim Const $StateFlag    = "StateFlags0064"
Dim Const $REGDWORD  = "REG_DWORD"
 
Dim Const $Process    = "CleanMgr.exe"
Dim Const $RunCmd      = $Process & " /sagerun:65"
Dim Const $WindTitle    = "Cleanup"
Dim Const $LogPath    = "C:\ECbotCleanlog"
 
Dim Const $Enabled    = 2
Dim Const $Disabled  = 0
 
Global $Status[3]
 
_FileWriteLog($LogPath, " ********* Start Disk Cleanup *********")
 
If ProcessExists($Process) Then
    _FileWriteLog($LogPath, "Utility is allready running.")
    _FileWriteLog($LogPath, "Operation Interupted RC=514")
    _FileWriteLog($LogPath, " ********* End HRA-O Disk Cleanup *********" & @CRLF & _StringRepeat("*", 80))
    Exit 514
EndIf
 
_FileWriteLog($LogPath, "Adding Registry entries to automate CleanMgr.exe")
 
AddHandler_FireFox();   <== Add FireFox Support
 
RegWrite($RegPath & "Active Setup Temp Folders"       , $StateFlag, $REGDWORD, $Disabled)
RegWrite($RegPath & "Compress old files"                , $StateFlag, $REGDWORD, $Disabled)
RegWrite($RegPath & "Content Indexer Cleaner"           , $StateFlag, $REGDWORD, $Enabled)
RegWrite($RegPath & "Downloaded Program Files"          , $StateFlag, $REGDWORD, $Disabled)
RegWrite($RegPath & "Internet Cache Files"            , $StateFlag, $REGDWORD, $Enabled)
RegWrite($RegPath & "Memory Dump Files"                 , $StateFlag, $REGDWORD, $Disabled)
RegWrite($RegPath & "Old ChkDsk Files"                  , $StateFlag, $REGDWORD, $Disabled)
RegWrite($RegPath & "Recycle Bin"                    , $StateFlag, $REGDWORD, $Disabled)
RegWrite($RegPath & "Remote Desktop Cache Files"        , $StateFlag, $REGDWORD, $Enabled)
RegWrite($RegPath & "Setup Log Files"                   , $StateFlag, $REGDWORD, $Disabled)
RegWrite($RegPath & "Temporary Files"                   , $StateFlag, $REGDWORD, $Enabled)
RegWrite($RegPath & "WebClient and WebPublisher Cache"  , $StateFlag, $REGDWORD, $Disabled)
RegWrite($RegPath & "FireFox Cache"                 , $StateFlag, $REGDWORD, $Enabled)
 
Dim $Drives = DriveGetDrive("FIXED")
 
For $i = 1 to $Drives[0]
    _FileWriteLog($LogPath, "Free Drive Space on Drive " & StringUpper($Drives[$i]) & " = " & DriveSpaceFree( $Drives[$i] & "\" ) & " MB")
Next
 
_FileWriteLog($LogPath, "Executing Disk Cleanup Utility")
 
Local $PID = Run($RunCmd, "", @SW_HIDE)
ProcessSetPriority($Process, 1)
 
_FileWriteLog($LogPath, "Disk Cleanup Utility PID=" & $PID)
 
AdlibEnable("_WindowSearch", 10)
    While ProcessExists($Process)
        Sleep(1000)
    WEnd
AdlibDisable()
 
_FileWriteLog($LogPath, "Disk Cleanup Utility operation completed")
 
For $i = 1 to $Drives[0]
    _FileWriteLog($LogPath, "Free Drive Space on Drive " & StringUpper($Drives[$i]) & " = " & DriveSpaceFree( $Drives[$i] & "\" ) & " MB")
Next
 
_FileWriteLog($LogPath, "Operation Completed RC=512" )
_FileWriteLog($LogPath, " ********* End Disk Cleanup *********" & @CRLF & _StringRepeat("*", 80))
Exit 512
 
Func _WindowSearch()
    Local $TempText = WinGetText($WindTitle)
    If WinExists($WindTitle) Then
        Local $Data
 
        If Bitand(WinGetState($WindTitle), 2) Then
            WinSetState($WindTitle, "", @SW_HIDE)
        EndIf
 
        $Data = ControlGetText($WindTitle, "", "[CLASSNN:Static2]")
        If $Data <> "" Then
            If $Data <> $Status[0] Then
                $Status[0] = $Data
                _FileWriteLog($LogPath, "Status: " & $Data)
            EndIf
        EndIf
 
        $Data = ControlGetText($WindTitle, "", "[CLASSNN:Static3]")
        If $Data <> "" Then
            If $Data <> $Status[1] Then
                $Status[1] = $Data
                _FileWriteLog($LogPath, "Status: " & @TAB & $Data)
            EndIf
        EndIf
 
        $Data = ControlGetText($WindTitle, "", "[CLASSNN:Static4]")
        If $Data <> "" Then
            If $Data <> $Status[2] Then
                $Status[2] = $Data
                _FileWriteLog($LogPath, "Status: " & @TAB & @TAB & $Data)
            EndIf
        EndIf
    EndIf
 
    If WinExists("Recycle Bin", " is corrupted. Do") Then
        ControlClick("Recycle Bin", " is corrupted. Do", 6)
    EndIf
EndFunc
 
Func AddHandler_FireFox()
    Local Const $KeyPath            = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\FireFox Cache"
    Local Const $Default            = "{C0E13E61-0CC6-11d1-BBB6-0060978B2AE6}"
    Local Const $Display            = "FireFox Cache"
    Local Const $Description        = "Cleans the firefox cache (FIREFOX MUST BE CLOSED)"
    Local Const $FileList         = "*.*"
    Local Const $CSIDL        = 0x1C
    Local Const $StateFlags0064  = 0x2
    Local Const $StateFlags   = 0x1
    Local Const $IconPath         = "%ProgramFiles%\Mozilla Firefox\firefox.exe,2"
    Local Const $LastAccess   = 0x0
    Local Const $DWORD        = "REG_DWORD"
    Local Const $EXPANDSZ         = "REG_EXPAND_SZ"
    Local Const $SZ     = "REG_SZ"
 
    ;## Get the Path to the Firefox Cache folder
        Local $Folder = GetSpecialFolder(0x1C) & "\Mozilla\Firefox\Profiles\"
        Local $Search = FileFindFirstFile($Folder & "*.default")
 
        $Folder = "Mozilla\Firefox\Profiles\" & FileFindNextFile($Search) & "\Cache"
 
    ;## Add new Disk Cleanup Handler to the registry
        RegWrite($KeyPath, "",        $SZ,    $Default)
        RegWrite($KeyPath, "CSIDL",   $DWORD,    $CSIDL)
        RegWrite($KeyPath, "Display",      $SZ,      $Display)
        RegWrite($KeyPath, "Description",   $SZ,      $Description)
        RegWrite($KeyPath, "FileList",    $SZ,    $FileList)
        RegWrite($KeyPath, "Folder",        $SZ,        $Folder)
        RegWrite($KeyPath, "IconPath",    $EXPANDSZ,    $IconPath)
        RegWrite($KeyPath, "LastAccess",    $DWORD,  $LastAccess)
        RegWrite($KeyPath, "StateFlags",    $DWORD,  $StateFlags)
EndFunc
 
Func GetSpecialFolder($CSIDL)
 
    Local $Path = DllStructCreate("char Path[" & 0x104 & "]")
    Local $Dll = DllOpen("Shell32.dll")
 
    $result = DllCall($Dll, "int", "SHGetSpecialFolderPath", "hwnd", 0, "ptr", DllStructGetPtr($Path), "Long", $CSIDL, "int", 0)
 
    #cs http://msdn.microsoft.com/en-us/library/bb762204(VS.85).aspx
        SHGetSpecialFolderPath Function
 
        Retrieves the path of a special folder, identified by its CSIDL.
 
        Syntax
 
            BOOL SHGetSpecialFolderPath(     
                HWND hwndOwner,
                LPTSTR lpszPath,
                int csidl,
                BOOL fCreate
            );
 
        Parameters
 
            hwndOwner
                Reserved.
            lpszPath
                [out] A pointer to a null-terminated string that receives the drive and path of the specified folder. This buffer must be at least MAX_PATH characters in size.
            csidl
                [in] A CSIDL that identifies the folder of interest. If a virtual folder is specified, this function will fail.
            fCreate
                [in] Indicates whether the folder should be created if it does not already exist. If this value is nonzero, the folder will be created. If this value is zero, the folder will not be created.
 
        Return Value
 
            TRUE if successful; otherwise, FALSE.
 
        Remarks
 
            The Microsoft Internet Explorer 4.0 Desktop Update must be installed for this function to be available.
            With Microsoft Windows 2000, this function is superseded by ShGetFolderPath. You can use this function on earlier systems by including the redistributable DLL, ShFolder.dll.
    #ce
 
    DllClose($Dll)
 
    If $result[0] = True Then Return DllStructGetData($Path, "Path")
 
EndFunc

What this bit of code does is allows you to clean the cache etc anywhere in the code by calling ‘_singleton’ on a new fresh line.

This is a vital requirement because some sites especially blogger sites etc. get funky with you in the process of visiting 300 sites, this functions aim was to help relive this issue.

1
2
3
4
5
6
7
8
9
10
11
12
13
;=================================================================================================================================
; Reduce memory usage
;
;=================================================================================================================================
 
Func _ReduceMemory() ;reduce memory load.
	$list = ProcessList()
	For $i = 1 To $list[0][0]
		Local $ai_Handle = DllCall("kernel32.dll", "int", "OpenProcess", "int", 0x1f0fff, "int", False, "int", $list[$i][1]) ;lolwut
		Local $ai_Return = DllCall("psapi.dll", "int", "EmptyWorkingSet", "int", $ai_Handle[0]) ;here it is, this line does the magic
		DllCall("kernel32.dll", "int", "CloseHandle", "int", $ai_Handle[0])
	Next
EndFunc   ;==>_ReduceMemory

The above function flushes your ram; again visiting 300 sites in firefox is not a ram friendly job; this allows function like the cache can be called to flush the ram by using the ‘_ReduceMemory’

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
;=================================================================================================================================
;SETTING UP BUTTONS
;=================================================================================================================================
;
;
;
Opt("SendKeyDelay", 50) ;waits 50 ms after each keystroke.
 
Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
;
Func TogglePause()
	$Paused = Not $Paused
	While $Paused
		Sleep(10000)
		ToolTip('Script is "Paused"', 0, 0)
	WEnd
	ToolTip("")
EndFunc   ;==>TogglePause
;
Func Terminate()
	Exit 0
	MsgBox(0, "Byeee!)", 5)
 
EndFunc   ;==>Terminate
;

This sets up the Pause and Exit functions in case they are needed, Note the pause function is not very efficient but it works.

1
2
3
4
5
6
7
8
;=================================================================================================================================
;CHECK FOR DUPE RUNNING
;=================================================================================================================================
;
#include <Misc.au3>
_Singleton("EntrecardBot")
;
;

This ensures the bot is not running twice as it can screw with itself if this happens.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
;=================================================================================================================================
;CHECK FOR INTERNET CONNECTION
;=================================================================================================================================
;
Global Const $NETWORK_ALIVE_LAN = 0x1 ;net card connection
Global Const $NETWORK_ALIVE_WAN = 0x2 ;RAS connection
Global Const $NETWORK_ALIVE_AOL = 0x4 ;AOL
 
$connect = _GetNetworkConnect()
 
If @extended Then
	MsgBox(0, "Entrecard Bot", "Checking For Internet Connection (NB pressing 'pause' will pause the script for 100 Secs)", 30)
Else
	MsgBox(48, "Warning", "There is no Internet connection")
EndIf
 
Func _GetNetworkConnect()
	; @extended set by function on return, use as boolean 'IsConnected'
	Local $aResult, $sResult = "", $iData, $iError = 0
	$aResult = DllCall("sensapi.dll", "int", "IsNetworkAlive", "int*", 0)
	$iError = @error
	If @error Or IsArray($aResult) = 0 Then Return SetError($iError, 0, "")
	$iData = $aResult[1]
	If BitAND($iData, $NETWORK_ALIVE_LAN) Then $sResult &= "LAN connected" & @LF
	If BitAND($iData, $NETWORK_ALIVE_WAN) Then $sResult &= "WAN connected" & @LF
	If BitAND($iData, $NETWORK_ALIVE_AOL) Then $sResult &= "AOL connected" & @LF
	Return SetError($iError, $aResult[0], $sResult)
EndFunc   ;==>_GetNetworkConnect
;
;
;=================================================================================================================================
;

This function looks for an internet connection as without one it is very hard to use the bot. It checks for a ‘dialup’ a ‘Lan’ connection or a wireless connection, if it finds one of the three it will continue.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
;=================================================================================================================================
;
;ENTRECARD BIT
;
;=================================================================================================================================
;Define  Vars;
$Run = 1
$Site = 1
$coord = 1
$MinWaitI = 6
$left = 1
$top = 1 
$right = 1
$bottom = 1

This sets some of the key variables:
Run = The site number it is on
Site = This is a number which relates to a site addresses and other details required.
Coord = this is used to define a ‘click’ location (i.e. where the drop area is).
MinWaitI = This is used to make the ini file code mentioned later happy, no need to change this.
Left/Right etc = This is for the extremities of the drop box, ie furtherest from the right/left/top/bottom. you would no need to change this as I will explain later.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
;
;Inifile check and set
;
If FileExists("C:\ecbot.ini") Then
	$MaxSiteWaitI = IniRead("C:\ecbot.ini", "Sitewait", "MaxSW", "")
	$MinSiteWaitI = IniRead("C:\ecbot.ini", "Sitewait", "MinSW", "")
	$MaxWaitI = IniRead("C:\ecbot.ini", "Sitewait", "MaxW", "")
	$MinWaitI = IniRead("C:\ecbot.ini", "Sitewait", "MinW", "")
	$user = IniRead("C:\ecbot.ini", "username", "user", "")
	$pass = IniRead("C:\ecbot.ini", "username", "pass", "")
Else
	$MinSiteWaitI = InputBox("Minimum Wait", "Please time in Min Wait time Before clicking; (Secs), note this includes page load times", "10")
	$MaxSiteWaitI = InputBox("Maximum Wait", "Please time in Max Wait time Before clicking; (Secs), note this includes page load times ", "30")
	$MinWaitI = InputBox("Minimum Wait", "Please time in Min Wait time after clicking; (Secs)", "6")
	$MaxWaitI = InputBox("Maximum Wait", "Please time in Max Wait time after clicking; (Secs)", "30")
	$user = InputBox("Entrecard Username", "Please enter your EC username", "user")
	$pass = InputBox("Entrecrad Password", "Please enter your EC password", "pass")
 
	IniWrite("C:\ecbot.ini", "username", "user", $user)
	IniWrite("C:\ecbot.ini", "username", "pass", $pass)
	IniWrite("C:\ecbot.ini", "Sitewait", "MaxSW", $MaxSiteWaitI)
	IniWrite("C:\ecbot.ini", "Sitewait", "MinSW", $MinSiteWaitI)
	IniWrite("C:\ecbot.ini", "Sitewait", "MaxW", $MaxWaitI)
	IniWrite("C:\ecbot.ini", "Sitewait", "MinW", $MinWaitI)
 
EndIf
 
$MinWait = ($MinWaitI * 1000)
$MaxWait = ($MaxWaitI * 1000)
$MinSiteWait = ($MinSiteWaitI * 1000)
$MaxSiteWait = ($MaxSiteWaitI * 1000)

The first part of the code checks for an ini file (at c:ecbot.ini) and if it finds it it loads the username password and minimum and maximum ‘wait’ variables. If it does not it asks the user to input these for future use.

The last bit times the amount given to convert them to seconds.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
;=================================================================================================================================
;
; logs in to entrecard
MouseClick("left", 417, 72)
Sleep(100)
Send("http://entrecard.com")
Send("{ENTER}")
Sleep(5000)
MouseClick("left", 749, 137)
Sleep(1000)
Send($user)
Sleep(1000)
Send("{TAB}")
Send($pass)
Sleep(1000)
Send("{ENTER}")
Sleep(2000)
;

This bit of the code clicks on the addresses tab in firefox goes to the entrecard site and logs in with the details saved.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
;=================================================================================================================================
;the main bit
Do
	;this  clicks browser bar for firefox
	MouseClick("left", 417, 72)
	Sleep(100)
 
	;Settin Site and click
              If $Run = 1 Then
		$left = 33
		$top = 629 
		$right = 130
		$bottom =540
		$Site = "http://sabrinasmoneymadness.com/{ENTER}"
 
ElseIf $Run = 2 Then
EndIf

This bit of the code is used to set the sites all the variables are different for each site with the exception of ‘run’ which increments by one by each site.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
;The url/clicking
Send($Site)
Sleep(Random($MinSiteWait, $MaxSiteWait, 1))
$coord = PixelSearch ( $left, $top, $right, $bottom, 0x000000)
MouseClick("left",$coord[0], $coord[1])
Sleep(Random($MinWait, $MaxWait, 1))
;Setting for next
$Run = $Run + 1
Until $Run == 301
Sleep (100)
MsgBox(0, "Entrecard Bot", "Cleaning up the mess!", 30)
_ReduceMemory()
Sleep(1000)
MsgBox(0, "Entrecard Bot", "Thats all folks!", 30)
 
;=================================================================================================================================

This is the ‘main bit’ of the program it
1) types in the site url.
2) sleeps a random amount of time between the min and max set by user.
3) it then selects two random co-ordinates from the extremes set by the user for the drop box.
4) it then sleeps again for a random amount.
5) once it had done this it adds ‘1′ to the run count and moves to the next site till it hits 301.

So what needs to be done?

Basically another 299 sites need to be added!
Improvements

- Firstly there is a new entrecard toolbar out; it could make locating sites and clicking much easier and faster.
- There is no function to allow for a refresh for a non-fully loaded page or site.
- Can incorporate the IE and Firefox Autoit wrappers, so no need for the program to take control of the keyboard and mouse and all can be done while the program is minimised or in the background.
- A better GUI as there is none at the moment!
- a lot more!

Play around with the code have some fun and post any question/queries and results!

Enjoy and have fun.

Popularity: 10% [?]

Related posts:

  1. Entrecard Addon The Entrecard Bot has been on hold for a while now, mainly because I don’t use it any more. However before I stopped using it...
  2. OIOPublisher Coupon Code For May I have talked about OIOPublisher at length before. So I wont reiterate my previous points though I will say the latest update has added many...
  3. Adgitize – Dropping Script Perhaps an inherent flaw in my character make up or a bonus who knows? Though whenever I see some software; a script a program or...
  4. mIRC Coding – Coding in a IRC Backdoor mIRC Coding – Coding in a IRC Backdoor tutorial written by ‘Zook’s; This is for educational use only. Its main aim is to give an...
  5. Beware the smiling man A few weeks ago I stumbled across some interesting spam; it was generic enough to make me think hmm is this spam or a...

2 Comments

  • At 2008.12.09 08:17, narendra.s.v said:

    so here comes my much awaited bot ;) thanks man

    • At 2008.12.09 08:20, Donace said:

      looking forward to see it! hit me up if you need any help.

    (A must)
    (Another Must but dont worry will not be published)

    Archives

    Full Archive

    Tag Cloud

    .htaccess adgitize Alexa Internet automation Backlink Backlinks Blog bot Bots code competitons Contest copyright entrecard Firefox Google Google Page Rank How to howto Law link building Link Love links news Optimization PageRank PHP plugin Programming Promotion Rants of a loony toon rapidshare Search Engines Security SEO Site update Site updates Spammers TheDuke traffic tutorial updates Weblogs Webmaster Web traffic