Jump to content

Help With Ip Finder


Guest RigureIsAFoolishMortal
 Share

Recommended Posts

Guest RigureIsAFoolishMortal

Hi, iv never posted in this forum befor. With that said, im allso perty new to the autoit script. im looking on some help for a program that i wrote for finding a game ip address. What i need to know is how to make it detect the first instance of the target ip and compare it to the one i targeted. I got that part, the next one is what im having problems with.

Let me explain. This program is witten for a game. The game has about 150 servers. Id like to be able to search for the same ip twice and not have it dectect the first instance of the targeted ip. B) Iv been trying to get it to work and i just cant seem to get the commands right. Heres a little piece of it.

;========== Get IP ===================

GetIP:

WinRestore, Command

WinActivate, Command, ,

Sleep, 250

Send, netstat -n>C:\\ip.txt{ENTER}

Sleep, 250

WinGetActiveTitle, Title

WinSetTitle, %Title%, , Command

WinMinimize, Command

Return

;========== Compare West IP ==========

CompareWestIP:

SetEnv, A, 1

Repeat, 20

FileReadLine, CheckIP, C:\\ip.txt, %A%

IfInString, CheckIP, %WestIP%%DCloneIP1%, Goto, Detected

IfInString, CheckIP, %WestIP%%DCloneIP2%, Goto, Detected

IfInString, CheckIP, %WestIP%%DCloneIP3%, Goto, Detected

IfInString, CheckIP, %WestIP%%DCloneIP4%, Goto, Detected

IfInString, CheckIP, %WestIP%%DCloneIP5%, Goto, Detected

EnvAdd, A, 1

EndRepeat

Return

now in the .ini i can specify the ip i want to ignore but i want it to look at the second ip ....

heres what netstat -n looks like

Proto Local Address Foreign Address State

TCP 24.119.12.117:1069 63.209.48.149:80 CLOSE_WAIT

TCP 24.119.12.117:1073 216.152.67.221:6667 ESTABLISHED

TCP 24.119.12.117:1096 64.71.165.194:6667 ESTABLISHED

TCP 24.119.12.117:1097 63.241.83.112:6112 TIME_WAIT

TCP 24.119.12.117:1098 63.241.83.112:6112 ESTABLISHED

TCP 24.119.12.117:1099 63.241.83.18:6112 TIME_WAIT

TCP 24.119.12.117:1100 63.241.83.112:6112 TIME_WAIT

TCP 24.119.12.117:1101 63.241.83.23:4000 ESTABLISHED

TCP 24.119.12.117:1101 63.241.83.187:4000 ESTABLISHED

The two ip that end in .4000 are the ones i want it to look at. if the first one is right, i want to check the .ini file to see if its the one to ignore and then look at the SECOND one and compare it to whats in the ini file.

Can anybody help me with this? :whistle:

Link to comment
Share on other sites

A one liner: RunWait, %COMSPEC% /C netstat -n > C:\\ip.txt :whistle:

What's the real trigger ?

ESTABLISHED ? Yes/No

:4000 + ESTABLISHED? Yes/No

:6667 ESTABLISHED Yes/No

63.241.83. ? Matching part of the IP + ESTABLISHED? Yes/No

.....

TCP 24.119.12.117:1069 63.209.48.149:80 CLOSE_WAIT

TCP 24.119.12.117:1073 216.152.67.221:6667 ESTABLISHED

TCP 24.119.12.117:1096 64.71.165.194:6667 ESTABLISHED

TCP 24.119.12.117:1097 63.241.83.112:6112 TIME_WAIT

TCP 24.119.12.117:1098 63.241.83.112:6112 ESTABLISHED

TCP 24.119.12.117:1099 63.241.83.18:6112 TIME_WAIT

TCP 24.119.12.117:1100 63.241.83.112:6112 TIME_WAIT

TCP 24.119.12.117:1101 63.241.83.23:4000 ESTABLISHED

TCP 24.119.12.117:1101 63.241.83.187:4000 ESTABLISHED

Link to comment
Share on other sites

Guest RigureIsAFoolishMortal

ahh i see i wasnt clear enough. the trigger is the maching ip address. in this case its the 63.241.83.23:4000. the 23 is what is looking for. here is the complet prog...

SetBatchLines, 100

SetEnv, Cmd, 0

SetEnv, Command, 0

IfEqual, A_OSVERSION, WIN_XP, SetEnv, Cmd, 1

IfEqual, A_OSVERSION, WIN_2000, SetEnv, Cmd, 1

IfEqual, A_OSVERSION, WIN_NT4, SetEnv, Cmd, 1

IfEqual, A_OSVERSION, WIN_95, SetEnv, Command, 1

IfEqual, A_OSVERSION, WIN_98, SetEnv, Command, 1

IfEqual, A_OSVERSION, WIN_ME, SetEnv, Command, 1

SetEnv, WestIP, 63.241.83.

SetEnv, EastIP, 63.240.202.

SetEnv, EuroIP, 213.248.106.

SetEnv, GameCreateDelay, 0

SetEnv, Name, 0

SetEnv, Pass, 0

SetEnv, SettingsFile, %A_SCRIPTDIR%\\Gheeds.ini

IniRead, ActiveAccount, %SettingsFile%, Account, AccountName

IniRead, ActivePassword, %SettingsFile%, Account, Password

IniRead, RealmSelection, %SettingsFile%, Account, Realm

IniRead, CharLocation, %SettingsFile%, Account, CharacterLocation

IniRead, LoadDelay, %SettingsFile%, Settings, D2LoadDelay

IniRead, GameCreateDelay, %SettingsFile%, Settings, GameCreateDelay

IniRead, Switches, %SettingsFile%, Account, D2Parameter

IniRead, DCloneIP1, %SettingsFile%, Settings, DCloneIP1

IniRead, DCloneIP2, %SettingsFile%, Settings, DCloneIP2

IniRead, DCloneIP3, %SettingsFile%, Settings, DCloneIP3

IniRead, DCloneIP4, %SettingsFile%, Settings, DCloneIP4

IniRead, DCloneIP5, %SettingsFile%, Settings, DCloneIP5

IniRead, D2Path, %SettingsFile%, Settings, D2Path

IfEqual, D2Path, , RegRead, D2Path, REG_SZ, HKEY_CURRENT_USER, Software\\Blizzard Entertainment\\Diablo II, InstallPath

IniRead, D2Executable, %SettingsFile%, Settings, D2Executable

IfEqual, D2Executable, , SetEnv, D2Executable, Diablo II.exe

;========== Vanity Window ============

SplashTextOn, 200, 100, Gheeds CloneHunter, Gheeds CloneHunter by valvet

Sleep, 5000

WinMove, Gheeds CloneHunter,, 824, 0, default, default

;========== Main =====================

GoSub, Command

GoSub, StartDiablo

IfEqual, RealmSelection, West, Gosub, WestLogon

IfEqual, RealmSelection, East, Gosub, EastLogon

IfEqual, RealmSelection, Europe, Gosub, EuropeLogon

GoSub, LogonAccount

GoSub, CharacterSelection

StartAgain:

GoSub, CreateGame

GoSub, GetIP

IfEqual, RealmSelection, West, Gosub, CompareWestIP

IfEqual, RealmSelection, East, Gosub, CompareEastIP

IfEqual, RealmSelection, Europe, Gosub, CompareEuroIP

GoSub, ExitGame

Goto, StartAgain

;========== Run Command ==============

Command:

IfEqual, Cmd, 1, Run, cmd.exe

IfEqual, Command, 1, Run, command.com

sleep, 250

WinGetActiveTitle, Title

Sleep, 250

WinSetTitle, %Title%, , Command

WinMinimize, Command

Return

;========== Start Diablo =============

StartDiablo:

Run, %D2Path%\\%D2Executable% %Switches%, %D2Path%

Sleep, %LoadDelay%

WinActivate, Diablo II,,

Sleep, 500

WinMove, Diablo II,, 0, 0, default, default

Sleep, 500

Return

;========= Realm Selection ===========

WestLogon:

;Sleep, 500

Send, {ESCAPE}

Sleep, 1500

MouseMove, 408, 403

LeftClick, 408, 403

Sleep, 1500

MouseMove, 296, 374

LeftClick, 296, 374

LeftClick, 296, 374

Sleep, 1500

MouseMove, 404, 374

LeftClick, 404, 374

Sleep, 5000

Return

EastLogon:

;Sleep, 500

Send, {ESCAPE}

Sleep, 1500

MouseMove, 408, 403

LeftClick, 408, 403

Sleep, 1500

MouseMove, 300, 400

LeftClick, 300, 400

LeftClick, 300, 400

Sleep, 1500

MouseMove, 404, 374

LeftClick, 404, 374

Sleep, 5000

Return

EuropeLogon:

;Sleep, 500

Send, {ESCAPE}

Sleep, 1500

MouseMove, 408, 403

LeftClick, 408, 403

Sleep, 1500

MouseMove, 295, 448

LeftClick, 295, 448

LeftClick, 295, 448

Sleep, 1500

MouseMove, 404, 374

LeftClick, 404, 374

Sleep, 5000

Return

;======== Enter Account Info =========

LogonAccount:

Send, {TAB}

Sleep, 250

Send, %ActiveAccount%

Sleep, 250

Send, {TAB}

Sleep, 250

Send, %ActivePassword%

Sleep, 250

Send, {ENTER}

Sleep, 6000

Return

;======== Character Selection ========

CharacterSelection:

IfEqual, CharLocation, 1, Send, {ENTER}

IfEqual, CharLocation, 2, Send, {RIGHT}{ENTER}

IfEqual, CharLocation, 3, Send, {DOWN}{ENTER}

IfEqual, CharLocation, 4, Send, {RIGHT}{DOWN}{ENTER}

IfEqual, CharLocation, 5, Send, {DOWN}{DOWN}{ENTER}

IfEqual, CharLocation, 6, Send, {RIGHT}{DOWN}{DOWN}{ENTER}

IfEqual, CharLocation, 7, Send, {DOWN}{DOWN}{DOWN}{ENTER}

IfEqual, CharLocation, 8, Send, {RIGHT}{DOWN}{DOWN}{DOWN}{ENTER}

Sleep, 5000

Return

;========= Create Game ===============

CreateGame:

IfWinNotActive, Diablo II, , WinRestore, Diablo II

WinActivate, Diablo II,,

LeftClick, 601,482

Sleep, 1500

Random, Name, 10000, 90000

Random, Pass, 10000, 90000

Send, Gheeds-%Name%{TAB}

Sleep, 250

;Send, %Pass%{ENTER}

Send, 11{ENTER}

sleep, %GameCreateDelay%

WinMinimize, Diablo II

sleep, 250

Return

;========== Get IP ===================

GetIP:

WinRestore, Command

WinActivate, Command, ,

Sleep, 250

Send, netstat -n>C:\\ip.txt{ENTER}

Sleep, 250

WinGetActiveTitle, Title

WinSetTitle, %Title%, , Command

WinMinimize, Command

Return

;========== Compare West IP ==========

CompareWestIP:

SetEnv, A, 1

Repeat, 20

FileReadLine, CheckIP, C:\\ip.txt, %A%

IfInString, CheckIP, %WestIP%%DCloneIP1%, Goto, Detected

IfInString, CheckIP, %WestIP%%DCloneIP2%, Goto, Detected

IfInString, CheckIP, %WestIP%%DCloneIP3%, Goto, Detected

IfInString, CheckIP, %WestIP%%DCloneIP4%, Goto, Detected

IfInString, CheckIP, %WestIP%%DCloneIP5%, Goto, Detected

EnvAdd, A, 1

EndRepeat

Return

Detected:

MsgBox, 4, IP Detected, The proper IP for Diablo Clone has been detected. Would you like to exit?

IfMsgBox, OK, Goto, Exit

Exit:

Exit

Return

;========== Compare East IP ==========

CompareEastIP:

SetEnv, A, 1

Repeat, 20

FileReadLine, CheckIP, C:\\ip.txt, %A%

IfInString, CheckIP, %EastIP%%DCloneIP1%, Goto, Detected

IfInString, CheckIP, %EastIP%%DCloneIP2%, Goto, Detected

IfInString, CheckIP, %EastIP%%DCloneIP3%, Goto, Detected

IfInString, CheckIP, %EastIP%%DCloneIP4%, Goto, Detected

IfInString, CheckIP, %EastIP%%DCloneIP5%, Goto, Detected

EnvAdd, A, 1

EndRepeat

Return

Detected:

MsgBox, 4, IP Detected, The proper IP for Diablo Clone has been detected. Would you like to exit?

IfMsgBox, OK, Goto, Exit

Exit:

Exit

Return

;========== Compare Euro IP ==========

CompareEuroIP:

SetEnv, A, 1

Repeat, 20

FileReadLine, CheckIP, C:\\ip.txt, %A%

IfInString, CheckIP, %EuroIP%%DCloneIP1%, Goto, Detected

IfInString, CheckIP, %EuroIP%%DCloneIP2%, Goto, Detected

IfInString, CheckIP, %EuroIP%%DCloneIP3%, Goto, Detected

IfInString, CheckIP, %EuroIP%%DCloneIP4%, Goto, Detected

IfInString, CheckIP, %EuroIP%%DCloneIP5%, Goto, Detected

EnvAdd, A, 1

EndRepeat

Return

Detected:

MsgBox, 4, IP Detected, The proper IP for Diablo Clone has been detected. Would you like to exit?

IfMsgBox, OK, Goto, Exit

Exit:

Exit

Return

;========== Exit Game ================

ExitGame:

WinRestore, Diablo II

WinActivate, Diablo II,,

SetKeyDelay, 5

Sleep, 250

Send, {ENTER}

Send, Gheeds Clone Hunter

Sleep, 250

Send, {ENTER}

Sleep, 250

Send, {ENTER}

Send, The proper IP for Diablo Clone was not detected.

Sleep, 250

Send, {ENTER}

Sleep, 250

Send, {ESC}

Sleep, 250

Send, {UP}

Sleep, 250

Send, {ENTER}

Sleep, 5000

Return

[ADLIB]

the trigger is the matching part of the ip.

also, i had ALOT of help writing this.

this is the first one iv witten..i think i bit off more than i can chew..*chuckle*

does this help?

Link to comment
Share on other sites

I've made some slight changes in the following section ...

;========== Get IP ===================

GetIP:

RunWait, %COMSPEC% /C netstat -n > C:\\ip.txt, , Hide

Return

;========== Compare West IP ==========

CompareWestIP:

SetEnv, lc, 0

IniRead, SPattern, C:\\ip.ini, SearchPattern, sp

Start:

SetEnv, inilc, 0

EnvAdd, lc, 1

FileReadLine, IPLine, C:\\ip.txt, %lc%

IfEqual, IPLine, ERROR, Exit

IfInString, IPLine, %SPattern%, Goto, INICompare

Goto, Start

INICompare:

EnvAdd, inilc, 1

IfEqual, inilc, 3, Goto, Start

IniRead, IP, C:\\ip.ini, ProperIPs, %inilc%

;//MsgBox for testing

MsgBox,0,B, Have to check: %IPLine%\nSearching for INI key: %inilc%=.%IP%:

IfNotInString, IPLine, .%IP%:, Goto, INICompare

MsgBox, 4, IP Detected, The proper IP [%IP%] for Diablo Clone has been detected. Would you like to exit?

IfMsgBox, YES, Exit

.

.

.

The assigned INI file: C:\IP.ini

[ProperIPs]

1=187

2=23

[searchPattern]

sp=:4000 ESTABLISHED

-----

The first match (in this case) has to be :4000 ESTABLISHED

TCP 24.119.12.117:1101 63.241.83.23:4000 ESTABLISHED

TCP 24.119.12.117:1101 63.241.83.187:4000 ESTABLISHED

Found two lines.

The second check is to identify if the previous match contains one of the specified (proper) IPs from the IP.ini file. Delivers the first match.

TCP 24.119.12.117:1101 63.241.83.23:4000 ESTABLISHED

TCP 24.119.12.117:1101 63.241.83.187:4000 ESTABLISHED

Edited by Beastmaster
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...