7h331337 Posted February 7, 2009 Share Posted February 7, 2009 is there a way to get the ip from a connected socket thanks Link to comment Share on other sites More sharing options...
BrettF Posted February 7, 2009 Share Posted February 7, 2009 Well shit. This is like all in the helpfile. Netherless since searching seems to be impossible for most people, here it is: ;---------------------------------------------------------------------- Func SocketToIP($SHOCKET) Local $sockaddr, $aRet $sockaddr = DllStructCreate("short;ushort;uint;char[8]") $aRet = DllCall("Ws2_32.dll", "int", "getpeername", "int", $SHOCKET, _ "ptr", DllStructGetPtr($sockaddr), "int*", DllStructGetSize($sockaddr)) If Not @error And $aRet[0] = 0 Then $aRet = DllCall("Ws2_32.dll", "str", "inet_ntoa", "int", DllStructGetData($sockaddr, 3)) If Not @error Then $aRet = $aRet[0] Else $aRet = 0 EndIf $sockaddr = 0 Return $aRet EndFunc ;==>SocketToIP RTFM. Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
7h331337 Posted February 7, 2009 Author Share Posted February 7, 2009 sorry in ment is there any other way this way just returns 0 Link to comment Share on other sites More sharing options...
Developers Jos Posted February 7, 2009 Developers Share Posted February 7, 2009 sorry in ment is there any other way this way just returns 0mmm... so you need another way because this returns a 0?make sense... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
7h331337 Posted February 7, 2009 Author Share Posted February 7, 2009 mmm... so you need another way because this returns a 0?make sense...yip any one have a suggestion or a way to fix socktoip Link to comment Share on other sites More sharing options...
Developers Jos Posted February 7, 2009 Developers Share Posted February 7, 2009 yip any one have a suggestion or a way to fix socktoipYou could try to be more serious and post what you have and what you are exactly trying to do in stead of making these type of remarks that lead nowhere.Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
7h331337 Posted February 7, 2009 Author Share Posted February 7, 2009 (edited) ok this is basically a hacker trapper and i need it to be able to add the ip to the log section i have tried socktoip but it dose not work expandcollapse popup#include <GUIConstants.au3> Global $lis[100][100], $list[100] , $ip ,$sockaddr $lis[0][1] = 0 TCPStartup() $Form1 = GUICreate("The Hacker Trapped BY 7H331337", 652, 314, 225, 63) $input1 = GUICtrlCreateInput("you have been traped by the hacker trapper 2.5 by 7h331337 and your ip has been logged", 72, 16, 289, 21) $Label1 = GUICtrlCreateLabel("message", 8, 16, 46, 17) $Group1 = GUICtrlCreateGroup("Ports listening", 8, 56, 353, 105) $ListView1 = GUICtrlCreateListView("NAME|PORT|STATE", 16, 72, 329, 81) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("PORTS", 368, 16, 273, 281) $Checkbox1 = GUICtrlCreateCheckbox("FTP", 384, 48, 97, 17) $Checkbox2 = GUICtrlCreateCheckbox("TELNET", 384, 80, 97, 17) $Checkbox3 = GUICtrlCreateCheckbox("SSH", 384, 112, 97, 17) $Checkbox4 = GUICtrlCreateCheckbox("HTTP", 384, 144, 97, 17) $Checkbox5 = GUICtrlCreateCheckbox("SNMP", 384, 176, 97, 17) $Checkbox6 = GUICtrlCreateCheckbox("POP3", 488, 48, 97, 17) $Checkbox7 = GUICtrlCreateCheckbox("SMTP", 488, 80, 97, 17) $Checkbox8 = GUICtrlCreateCheckbox("SOCKSPROXY", 488, 112, 97, 17) $Checkbox9 = GUICtrlCreateCheckbox("FINGER", 488, 144, 97, 17) $Checkbox10 = GUICtrlCreateCheckbox("DNS", 488, 176, 97, 17) $Input2 = GUICtrlCreateInput("", 480, 224, 153, 21) $Label2 = GUICtrlCreateLabel("ADD PORT (139)", 384, 224, 87, 25) $Button4 = GUICtrlCreateButton("add port", 480, 256, 81, 17, 0) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("start", 8, 280, 97, 17, 0) $Button2 = GUICtrlCreateButton("stop", 112, 280, 89, 17, 0) $Button3 = GUICtrlCreateButton("save log", 216, 280, 97, 17, 0) $Group3 = GUICtrlCreateGroup("log", 8, 176, 353, 97) $ListView2 = GUICtrlCreateListView("Time |ip |name |port", 16, 192, 329, 73) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Checkbox1 If GUICtrlRead($Checkbox1) = 1 Then $lis[0][1] = 1 $lis[$lis[0][1]][1] = "ftp" $lis[$lis[0][1]][0] = 21 $list[0] = $list[0] + 1 $list[1] = GUICtrlCreateListViewItem("ftp|21|stopped!!!", $ListView1) Else GUICtrlDelete($list[1]) EndIf Case $Checkbox2 If GUICtrlRead($Checkbox2) = 1 Then $lis[0][1] = 2 $lis[$lis[0][1]][1] = "telnet" $lis[$lis[0][1]][0] = 23 $list[0] = $list[0] + 1 $list[2] = GUICtrlCreateListViewItem("telnet|23|stopped!!!", $ListView1) Else GUICtrlDelete($list[2]) EndIf Case $Checkbox3 If GUICtrlRead($Checkbox3) = 1 Then $lis[0][1] = 3 $lis[$lis[0][1]][1] = "ssh" $lis[$lis[0][1]][0] = 22 $list[0] = $list[0] + 1 $list[3] = GUICtrlCreateListViewItem("ssh|22|stopped!!!", $ListView1) Else GUICtrlDelete($list[3]) EndIf Case $Checkbox4 If GUICtrlRead($Checkbox4) = 1 Then $lis[0][1] = 4 $lis[$lis[0][1]][1] = "http" $lis[$lis[0][1]][0] = 80 $list[0] = $list[0] + 1 $list[4] = GUICtrlCreateListViewItem("http|80|stopped!!!", $ListView1) Else GUICtrlDelete($list[4]) EndIf Case $Checkbox5 If GUICtrlRead($Checkbox5) = 1 Then $lis[0][1] = 5 $lis[$lis[0][1]][1] = "snmp" $lis[$lis[0][1]][0] = 161 $list[0] = $list[0] + 1 $list[5] = GUICtrlCreateListViewItem("snmp|161|stopped!!!", $ListView1) Else GUICtrlDelete($list[5]) EndIf Case $Checkbox6 If GUICtrlRead($Checkbox6) = 1 Then $lis[0][1] = 6 $lis[$lis[0][1]][1] = "pop3" $lis[$lis[0][1]][0] = 110 $list[0] = $list[0] + 1 $list[6] = GUICtrlCreateListViewItem("pop3|110|stopped!!!", $ListView1) Else GUICtrlDelete($list[6]) EndIf Case $Checkbox7 If GUICtrlRead($Checkbox7) = 1 Then $lis[0][1] = 7 $lis[$lis[0][1]][1] = "smtp" $lis[$lis[0][1]][0] = 25 $list[0] = $list[0] + 1 $list[7] = GUICtrlCreateListViewItem("smtp|25|stopped!!!", $ListView1) Else GUICtrlDelete($list[7]) EndIf Case $Checkbox8 If GUICtrlRead($Checkbox8) = 1 Then $lis[0][1] = 8 $lis[$lis[0][1]][1] = "socksproxy" $lis[$lis[0][1]][0] = 1080 $list[0] = $list[0] + 1 $list[8] = GUICtrlCreateListViewItem("socksproxy|1080|stopped!!!", $ListView1) Else GUICtrlDelete($list[8]) EndIf Case $Checkbox9 If GUICtrlRead($Checkbox9) = 1 Then $lis[0][1] = 9 $lis[$lis[0][1]][1] = "finger" $lis[$lis[0][1]][0] = 79 $list[0] = $list[0] + 1 $list[9] = GUICtrlCreateListViewItem("finger|79|stopped!!!", $ListView1) Else GUICtrlDelete($list[9]) EndIf Case $Checkbox10 If GUICtrlRead($Checkbox10) = 1 Then $lis[0][1] = 10 $lis[$lis[0][1]][1] = "dns" $lis[$lis[0][1]][0] = 53 $list[0] = $list[0] + 1 $list[10] = GUICtrlCreateListViewItem("dns|53|stopped!!!", $ListView1) Else GUICtrlDelete($list[10]) EndIf Case $Button4 $lis[0][1] = $lis[0][1] +1 $lis[$lis[0][1]][1] = "user" & GUICtrlRead($Input2) $lis[$lis[0][1]][0] = GUICtrlRead($Input2) $list[0] = $list[0] + 1 $list[$list[0]] = GUICtrlCreateListViewItem("user" & GUICtrlRead($Input2) & "|" & GUICtrlRead($Input2) & "|stopped!!!", $ListView1) Case $Button1 start() Case $Button2 Case $Button3 EndSwitch WEnd Func start() For $i = 1 To $lis[0][1] + 1 $lis[$i][3] = TCPListen(@IPAddress1, $lis[$i][0]) If $lis[$i][3] < 0 Then GUICtrlSetData($list[$i], "||cant start") Else GUICtrlSetData($list[$i], "||ok") EndIf Next Do For $i = 1 To $lis[0][1] $acc = TCPAccept($lis[$i][3]) If $acc >= 0 Then intruder($i,$acc) EndIf Next $msg = GUIGetMsg() Until $msg = $Button2 EndFunc ;==>start Func intruder($num,$acc) TCPSend($acc,guictrlread($input1)) $ip = SocketToIP($lis[$num][3]) GUICtrlCreateListViewItem(@hour & ":" & @min & "|" & $ip & "|" & $sockaddr & "|" & $lis[$num][0] & " " & $lis[$num][1],$listview2) TCPCloseSocket($acc) EndFunc ;==>intruder Func SocketToIP($sock) Local $sockaddr, $ip $sockaddr = DllStructCreate("short;ushort;uint;char[8]") $ip = DllCall("Ws2_32.dll", "int", "getpeername", "int", $sock,"ptr", DllStructGetPtr($sockaddr), "ptr", DllStructGetSize($sockaddr)) $ip = DllCall("Ws2_32.dll", "str", "inet_ntoa", "int", DllStructGetData($sockaddr, 3)) If Not @error Then $ip = $ip[0] Else $ip = 0 EndIf $sockaddr = 0 Return $ip EndFunc ;==>SocketToIP thanks Edited February 7, 2009 by 7h331337 Link to comment Share on other sites More sharing options...
trancexx Posted February 7, 2009 Share Posted February 7, 2009 ok this is basically a hacker trapper and i need it to be able to add the ip to the log section i have tried socktoip but it dose not work expandcollapse popup#include <GUIConstants.au3> Global $lis[100][100], $list[100] , $ip ,$sockaddr $lis[0][1] = 0 TCPStartup() $Form1 = GUICreate("The Hacker Trapped BY 7H331337", 652, 314, 225, 63) $input1 = GUICtrlCreateInput("you have been traped by the hacker trapper 2.5 by 7h331337 and your ip has been logged", 72, 16, 289, 21) $Label1 = GUICtrlCreateLabel("message", 8, 16, 46, 17) $Group1 = GUICtrlCreateGroup("Ports listening", 8, 56, 353, 105) $ListView1 = GUICtrlCreateListView("NAME|PORT|STATE", 16, 72, 329, 81) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("PORTS", 368, 16, 273, 281) $Checkbox1 = GUICtrlCreateCheckbox("FTP", 384, 48, 97, 17) $Checkbox2 = GUICtrlCreateCheckbox("TELNET", 384, 80, 97, 17) $Checkbox3 = GUICtrlCreateCheckbox("SSH", 384, 112, 97, 17) $Checkbox4 = GUICtrlCreateCheckbox("HTTP", 384, 144, 97, 17) $Checkbox5 = GUICtrlCreateCheckbox("SNMP", 384, 176, 97, 17) $Checkbox6 = GUICtrlCreateCheckbox("POP3", 488, 48, 97, 17) $Checkbox7 = GUICtrlCreateCheckbox("SMTP", 488, 80, 97, 17) $Checkbox8 = GUICtrlCreateCheckbox("SOCKSPROXY", 488, 112, 97, 17) $Checkbox9 = GUICtrlCreateCheckbox("FINGER", 488, 144, 97, 17) $Checkbox10 = GUICtrlCreateCheckbox("DNS", 488, 176, 97, 17) $Input2 = GUICtrlCreateInput("", 480, 224, 153, 21) $Label2 = GUICtrlCreateLabel("ADD PORT (139)", 384, 224, 87, 25) $Button4 = GUICtrlCreateButton("add port", 480, 256, 81, 17, 0) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("start", 8, 280, 97, 17, 0) $Button2 = GUICtrlCreateButton("stop", 112, 280, 89, 17, 0) $Button3 = GUICtrlCreateButton("save log", 216, 280, 97, 17, 0) $Group3 = GUICtrlCreateGroup("log", 8, 176, 353, 97) $ListView2 = GUICtrlCreateListView("Time |ip |name |port", 16, 192, 329, 73) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Checkbox1 If GUICtrlRead($Checkbox1) = 1 Then $lis[0][1] = 1 $lis[$lis[0][1]][1] = "ftp" $lis[$lis[0][1]][0] = 21 $list[0] = $list[0] + 1 $list[1] = GUICtrlCreateListViewItem("ftp|21|stopped!!!", $ListView1) Else GUICtrlDelete($list[1]) EndIf Case $Checkbox2 If GUICtrlRead($Checkbox2) = 1 Then $lis[0][1] = 2 $lis[$lis[0][1]][1] = "telnet" $lis[$lis[0][1]][0] = 23 $list[0] = $list[0] + 1 $list[2] = GUICtrlCreateListViewItem("telnet|23|stopped!!!", $ListView1) Else GUICtrlDelete($list[2]) EndIf Case $Checkbox3 If GUICtrlRead($Checkbox3) = 1 Then $lis[0][1] = 3 $lis[$lis[0][1]][1] = "ssh" $lis[$lis[0][1]][0] = 22 $list[0] = $list[0] + 1 $list[3] = GUICtrlCreateListViewItem("ssh|22|stopped!!!", $ListView1) Else GUICtrlDelete($list[3]) EndIf Case $Checkbox4 If GUICtrlRead($Checkbox4) = 1 Then $lis[0][1] = 4 $lis[$lis[0][1]][1] = "http" $lis[$lis[0][1]][0] = 80 $list[0] = $list[0] + 1 $list[4] = GUICtrlCreateListViewItem("http|80|stopped!!!", $ListView1) Else GUICtrlDelete($list[4]) EndIf Case $Checkbox5 If GUICtrlRead($Checkbox5) = 1 Then $lis[0][1] = 5 $lis[$lis[0][1]][1] = "snmp" $lis[$lis[0][1]][0] = 161 $list[0] = $list[0] + 1 $list[5] = GUICtrlCreateListViewItem("snmp|161|stopped!!!", $ListView1) Else GUICtrlDelete($list[5]) EndIf Case $Checkbox6 If GUICtrlRead($Checkbox6) = 1 Then $lis[0][1] = 6 $lis[$lis[0][1]][1] = "pop3" $lis[$lis[0][1]][0] = 110 $list[0] = $list[0] + 1 $list[6] = GUICtrlCreateListViewItem("pop3|110|stopped!!!", $ListView1) Else GUICtrlDelete($list[6]) EndIf Case $Checkbox7 If GUICtrlRead($Checkbox7) = 1 Then $lis[0][1] = 7 $lis[$lis[0][1]][1] = "smtp" $lis[$lis[0][1]][0] = 25 $list[0] = $list[0] + 1 $list[7] = GUICtrlCreateListViewItem("smtp|25|stopped!!!", $ListView1) Else GUICtrlDelete($list[7]) EndIf Case $Checkbox8 If GUICtrlRead($Checkbox8) = 1 Then $lis[0][1] = 8 $lis[$lis[0][1]][1] = "socksproxy" $lis[$lis[0][1]][0] = 1080 $list[0] = $list[0] + 1 $list[8] = GUICtrlCreateListViewItem("socksproxy|1080|stopped!!!", $ListView1) Else GUICtrlDelete($list[8]) EndIf Case $Checkbox9 If GUICtrlRead($Checkbox9) = 1 Then $lis[0][1] = 9 $lis[$lis[0][1]][1] = "finger" $lis[$lis[0][1]][0] = 79 $list[0] = $list[0] + 1 $list[9] = GUICtrlCreateListViewItem("finger|79|stopped!!!", $ListView1) Else GUICtrlDelete($list[9]) EndIf Case $Checkbox10 If GUICtrlRead($Checkbox10) = 1 Then $lis[0][1] = 10 $lis[$lis[0][1]][1] = "dns" $lis[$lis[0][1]][0] = 53 $list[0] = $list[0] + 1 $list[10] = GUICtrlCreateListViewItem("dns|53|stopped!!!", $ListView1) Else GUICtrlDelete($list[10]) EndIf Case $Button4 $lis[0][1] = $lis[0][1] +1 $lis[$lis[0][1]][1] = "user" & GUICtrlRead($Input2) $lis[$lis[0][1]][0] = GUICtrlRead($Input2) $list[0] = $list[0] + 1 $list[$list[0]] = GUICtrlCreateListViewItem("user" & GUICtrlRead($Input2) & "|" & GUICtrlRead($Input2) & "|stopped!!!", $ListView1) Case $Button1 start() Case $Button2 Case $Button3 EndSwitch WEnd Func start() For $i = 1 To $lis[0][1] + 1 $lis[$i][3] = TCPListen(@IPAddress1, $lis[$i][0]) If $lis[$i][3] < 0 Then GUICtrlSetData($list[$i], "||cant start") Else GUICtrlSetData($list[$i], "||ok") EndIf Next Do For $i = 1 To $lis[0][1] $acc = TCPAccept($lis[$i][3]) If $acc >= 0 Then intruder($i,$acc) EndIf Next $msg = GUIGetMsg() Until $msg = $Button2 EndFunc ;==>start Func intruder($num,$acc) TCPSend($acc,guictrlread($input1)) $ip = SocketToIP($lis[$num][3]) GUICtrlCreateListViewItem(@hour & ":" & @min & "|" & $ip & "|" & $sockaddr & "|" & $lis[$num][0] & " " & $lis[$num][1],$listview2) TCPCloseSocket($acc) EndFunc ;==>intruder Func SocketToIP($sock) Local $sockaddr, $ip $sockaddr = DllStructCreate("short;ushort;uint;char[8]") $ip = DllCall("Ws2_32.dll", "int", "getpeername", "int", $sock,"ptr", DllStructGetPtr($sockaddr), "ptr", DllStructGetSize($sockaddr)) $ip = DllCall("Ws2_32.dll", "str", "inet_ntoa", "int", DllStructGetData($sockaddr, 3)) If Not @error Then $ip = $ip[0] Else $ip = 0 EndIf $sockaddr = 0 Return $ip EndFunc ;==>SocketToIP thankschange ptr to int* in getpeername function (third parameter). But that was already suggested. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
7h331337 Posted February 7, 2009 Author Share Posted February 7, 2009 change ptr to int* in getpeername function (third parameter).But that was already suggested.i tried it and it still returning 0 thanks for the suggestion tho Link to comment Share on other sites More sharing options...
trancexx Posted February 7, 2009 Share Posted February 7, 2009 i tried it and it still returning 0 thanks for the suggestion thoCan you post that script? ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
7h331337 Posted February 7, 2009 Author Share Posted February 7, 2009 Can you post that script?here is the code expandcollapse popup#include <GUIConstants.au3> Global $lis[100][100], $list[100], $ip, $sockaddr $lis[0][1] = 0 TCPStartup() $Form1 = GUICreate("The Hacker Trapped BY 7H331337", 652, 314, 225, 63) $input1 = GUICtrlCreateInput("you have been traped by the hacker trapper 2.5 by 7h331337 and your ip has been logged", 72, 16, 289, 21) $Label1 = GUICtrlCreateLabel("message", 8, 16, 46, 17) $Group1 = GUICtrlCreateGroup("Ports listening", 8, 56, 353, 105) $ListView1 = GUICtrlCreateListView("NAME|PORT|STATE", 16, 72, 329, 81) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("PORTS", 368, 16, 273, 281) $Checkbox1 = GUICtrlCreateCheckbox("FTP", 384, 48, 97, 17) $Checkbox2 = GUICtrlCreateCheckbox("TELNET", 384, 80, 97, 17) $Checkbox3 = GUICtrlCreateCheckbox("SSH", 384, 112, 97, 17) $Checkbox4 = GUICtrlCreateCheckbox("HTTP", 384, 144, 97, 17) $Checkbox5 = GUICtrlCreateCheckbox("SNMP", 384, 176, 97, 17) $Checkbox6 = GUICtrlCreateCheckbox("POP3", 488, 48, 97, 17) $Checkbox7 = GUICtrlCreateCheckbox("SMTP", 488, 80, 97, 17) $Checkbox8 = GUICtrlCreateCheckbox("SOCKSPROXY", 488, 112, 97, 17) $Checkbox9 = GUICtrlCreateCheckbox("FINGER", 488, 144, 97, 17) $Checkbox10 = GUICtrlCreateCheckbox("DNS", 488, 176, 97, 17) $Input2 = GUICtrlCreateInput("", 480, 224, 153, 21) $Label2 = GUICtrlCreateLabel("ADD PORT (139)", 384, 224, 87, 25) $Button4 = GUICtrlCreateButton("add port", 480, 256, 81, 17, 0) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("start", 8, 280, 97, 17, 0) $Button2 = GUICtrlCreateButton("stop", 112, 280, 89, 17, 0) $Button3 = GUICtrlCreateButton("save log", 216, 280, 97, 17, 0) $Group3 = GUICtrlCreateGroup("log", 8, 176, 353, 97) $ListView2 = GUICtrlCreateListView("Time |ip |name |port", 16, 192, 329, 73) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Checkbox1 If GUICtrlRead($Checkbox1) = 1 Then $lis[0][1] = 1 $lis[$lis[0][1]][1] = "ftp" $lis[$lis[0][1]][0] = 21 $list[0] = $list[0] + 1 $list[1] = GUICtrlCreateListViewItem("ftp|21|stopped!!!", $ListView1) Else GUICtrlDelete($list[1]) EndIf Case $Checkbox2 If GUICtrlRead($Checkbox2) = 1 Then $lis[0][1] = 2 $lis[$lis[0][1]][1] = "telnet" $lis[$lis[0][1]][0] = 23 $list[0] = $list[0] + 1 $list[2] = GUICtrlCreateListViewItem("telnet|23|stopped!!!", $ListView1) Else GUICtrlDelete($list[2]) EndIf Case $Checkbox3 If GUICtrlRead($Checkbox3) = 1 Then $lis[0][1] = 3 $lis[$lis[0][1]][1] = "ssh" $lis[$lis[0][1]][0] = 22 $list[0] = $list[0] + 1 $list[3] = GUICtrlCreateListViewItem("ssh|22|stopped!!!", $ListView1) Else GUICtrlDelete($list[3]) EndIf Case $Checkbox4 If GUICtrlRead($Checkbox4) = 1 Then $lis[0][1] = 4 $lis[$lis[0][1]][1] = "http" $lis[$lis[0][1]][0] = 80 $list[0] = $list[0] + 1 $list[4] = GUICtrlCreateListViewItem("http|80|stopped!!!", $ListView1) Else GUICtrlDelete($list[4]) EndIf Case $Checkbox5 If GUICtrlRead($Checkbox5) = 1 Then $lis[0][1] = 5 $lis[$lis[0][1]][1] = "snmp" $lis[$lis[0][1]][0] = 161 $list[0] = $list[0] + 1 $list[5] = GUICtrlCreateListViewItem("snmp|161|stopped!!!", $ListView1) Else GUICtrlDelete($list[5]) EndIf Case $Checkbox6 If GUICtrlRead($Checkbox6) = 1 Then $lis[0][1] = 6 $lis[$lis[0][1]][1] = "pop3" $lis[$lis[0][1]][0] = 110 $list[0] = $list[0] + 1 $list[6] = GUICtrlCreateListViewItem("pop3|110|stopped!!!", $ListView1) Else GUICtrlDelete($list[6]) EndIf Case $Checkbox7 If GUICtrlRead($Checkbox7) = 1 Then $lis[0][1] = 7 $lis[$lis[0][1]][1] = "smtp" $lis[$lis[0][1]][0] = 25 $list[0] = $list[0] + 1 $list[7] = GUICtrlCreateListViewItem("smtp|25|stopped!!!", $ListView1) Else GUICtrlDelete($list[7]) EndIf Case $Checkbox8 If GUICtrlRead($Checkbox8) = 1 Then $lis[0][1] = 8 $lis[$lis[0][1]][1] = "socksproxy" $lis[$lis[0][1]][0] = 1080 $list[0] = $list[0] + 1 $list[8] = GUICtrlCreateListViewItem("socksproxy|1080|stopped!!!", $ListView1) Else GUICtrlDelete($list[8]) EndIf Case $Checkbox9 If GUICtrlRead($Checkbox9) = 1 Then $lis[0][1] = 9 $lis[$lis[0][1]][1] = "finger" $lis[$lis[0][1]][0] = 79 $list[0] = $list[0] + 1 $list[9] = GUICtrlCreateListViewItem("finger|79|stopped!!!", $ListView1) Else GUICtrlDelete($list[9]) EndIf Case $Checkbox10 If GUICtrlRead($Checkbox10) = 1 Then $lis[0][1] = 10 $lis[$lis[0][1]][1] = "dns" $lis[$lis[0][1]][0] = 53 $list[0] = $list[0] + 1 $list[10] = GUICtrlCreateListViewItem("dns|53|stopped!!!", $ListView1) Else GUICtrlDelete($list[10]) EndIf Case $Button4 $lis[0][1] = $lis[0][1] + 1 $lis[$lis[0][1]][1] = "user" & GUICtrlRead($Input2) $lis[$lis[0][1]][0] = GUICtrlRead($Input2) $list[0] = $list[0] + 1 $list[$list[0]] = GUICtrlCreateListViewItem("user" & GUICtrlRead($Input2) & "|" & GUICtrlRead($Input2) & "|stopped!!!", $ListView1) Case $Button1 start() Case $Button2 Case $Button3 EndSwitch WEnd Func start() For $i = 1 To $lis[0][1] + 1 $lis[$i][3] = TCPListen(@IPAddress1, $lis[$i][0]) If $lis[$i][3] < 0 Then GUICtrlSetData($list[$i], "||cant start") Else GUICtrlSetData($list[$i], "||ok") EndIf Next Do For $i = 1 To $lis[0][1] $acc = TCPAccept($lis[$i][3]) If $acc >= 0 Then intruder($i, $acc) EndIf Next $msg = GUIGetMsg() Until $msg = $Button2 EndFunc ;==>start Func intruder($num, $acc) TCPSend($acc, GUICtrlRead($input1)) $ip = SocketToIP($lis[$num][3]) GUICtrlCreateListViewItem(@HOUR & ":" & @MIN & "|" & $ip & "|" & $sockaddr & "|" & $lis[$num][0] & " " & $lis[$num][1], $ListView2) TCPCloseSocket($acc) EndFunc ;==>intruder Func SocketToIP($sock) Local $sockaddr, $ip $sockaddr = DllStructCreate("short;ushort;uint;char[8]") $ip = DllCall("Ws2_32.dll", "int", "getpeername", "int", $sock, "ptr", DllStructGetPtr($sockaddr), "int*", DllStructGetSize($sockaddr)) If Not @error Then $ip = $ip[0] $ip = DllCall("Ws2_32.dll", "str", "inet_ntoa", "int", DllStructGetData($sockaddr, 3)) Else $ip = 0 EndIf $sockaddr = 0 Return $ip EndFunc ;==>SocketToIP Link to comment Share on other sites More sharing options...
trancexx Posted February 7, 2009 Share Posted February 7, 2009 here is the code expandcollapse popup#include <GUIConstants.au3> Global $lis[100][100], $list[100], $ip, $sockaddr $lis[0][1] = 0 TCPStartup() $Form1 = GUICreate("The Hacker Trapped BY 7H331337", 652, 314, 225, 63) $input1 = GUICtrlCreateInput("you have been traped by the hacker trapper 2.5 by 7h331337 and your ip has been logged", 72, 16, 289, 21) $Label1 = GUICtrlCreateLabel("message", 8, 16, 46, 17) $Group1 = GUICtrlCreateGroup("Ports listening", 8, 56, 353, 105) $ListView1 = GUICtrlCreateListView("NAME|PORT|STATE", 16, 72, 329, 81) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("PORTS", 368, 16, 273, 281) $Checkbox1 = GUICtrlCreateCheckbox("FTP", 384, 48, 97, 17) $Checkbox2 = GUICtrlCreateCheckbox("TELNET", 384, 80, 97, 17) $Checkbox3 = GUICtrlCreateCheckbox("SSH", 384, 112, 97, 17) $Checkbox4 = GUICtrlCreateCheckbox("HTTP", 384, 144, 97, 17) $Checkbox5 = GUICtrlCreateCheckbox("SNMP", 384, 176, 97, 17) $Checkbox6 = GUICtrlCreateCheckbox("POP3", 488, 48, 97, 17) $Checkbox7 = GUICtrlCreateCheckbox("SMTP", 488, 80, 97, 17) $Checkbox8 = GUICtrlCreateCheckbox("SOCKSPROXY", 488, 112, 97, 17) $Checkbox9 = GUICtrlCreateCheckbox("FINGER", 488, 144, 97, 17) $Checkbox10 = GUICtrlCreateCheckbox("DNS", 488, 176, 97, 17) $Input2 = GUICtrlCreateInput("", 480, 224, 153, 21) $Label2 = GUICtrlCreateLabel("ADD PORT (139)", 384, 224, 87, 25) $Button4 = GUICtrlCreateButton("add port", 480, 256, 81, 17, 0) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("start", 8, 280, 97, 17, 0) $Button2 = GUICtrlCreateButton("stop", 112, 280, 89, 17, 0) $Button3 = GUICtrlCreateButton("save log", 216, 280, 97, 17, 0) $Group3 = GUICtrlCreateGroup("log", 8, 176, 353, 97) $ListView2 = GUICtrlCreateListView("Time |ip |name |port", 16, 192, 329, 73) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Checkbox1 If GUICtrlRead($Checkbox1) = 1 Then $lis[0][1] = 1 $lis[$lis[0][1]][1] = "ftp" $lis[$lis[0][1]][0] = 21 $list[0] = $list[0] + 1 $list[1] = GUICtrlCreateListViewItem("ftp|21|stopped!!!", $ListView1) Else GUICtrlDelete($list[1]) EndIf Case $Checkbox2 If GUICtrlRead($Checkbox2) = 1 Then $lis[0][1] = 2 $lis[$lis[0][1]][1] = "telnet" $lis[$lis[0][1]][0] = 23 $list[0] = $list[0] + 1 $list[2] = GUICtrlCreateListViewItem("telnet|23|stopped!!!", $ListView1) Else GUICtrlDelete($list[2]) EndIf Case $Checkbox3 If GUICtrlRead($Checkbox3) = 1 Then $lis[0][1] = 3 $lis[$lis[0][1]][1] = "ssh" $lis[$lis[0][1]][0] = 22 $list[0] = $list[0] + 1 $list[3] = GUICtrlCreateListViewItem("ssh|22|stopped!!!", $ListView1) Else GUICtrlDelete($list[3]) EndIf Case $Checkbox4 If GUICtrlRead($Checkbox4) = 1 Then $lis[0][1] = 4 $lis[$lis[0][1]][1] = "http" $lis[$lis[0][1]][0] = 80 $list[0] = $list[0] + 1 $list[4] = GUICtrlCreateListViewItem("http|80|stopped!!!", $ListView1) Else GUICtrlDelete($list[4]) EndIf Case $Checkbox5 If GUICtrlRead($Checkbox5) = 1 Then $lis[0][1] = 5 $lis[$lis[0][1]][1] = "snmp" $lis[$lis[0][1]][0] = 161 $list[0] = $list[0] + 1 $list[5] = GUICtrlCreateListViewItem("snmp|161|stopped!!!", $ListView1) Else GUICtrlDelete($list[5]) EndIf Case $Checkbox6 If GUICtrlRead($Checkbox6) = 1 Then $lis[0][1] = 6 $lis[$lis[0][1]][1] = "pop3" $lis[$lis[0][1]][0] = 110 $list[0] = $list[0] + 1 $list[6] = GUICtrlCreateListViewItem("pop3|110|stopped!!!", $ListView1) Else GUICtrlDelete($list[6]) EndIf Case $Checkbox7 If GUICtrlRead($Checkbox7) = 1 Then $lis[0][1] = 7 $lis[$lis[0][1]][1] = "smtp" $lis[$lis[0][1]][0] = 25 $list[0] = $list[0] + 1 $list[7] = GUICtrlCreateListViewItem("smtp|25|stopped!!!", $ListView1) Else GUICtrlDelete($list[7]) EndIf Case $Checkbox8 If GUICtrlRead($Checkbox8) = 1 Then $lis[0][1] = 8 $lis[$lis[0][1]][1] = "socksproxy" $lis[$lis[0][1]][0] = 1080 $list[0] = $list[0] + 1 $list[8] = GUICtrlCreateListViewItem("socksproxy|1080|stopped!!!", $ListView1) Else GUICtrlDelete($list[8]) EndIf Case $Checkbox9 If GUICtrlRead($Checkbox9) = 1 Then $lis[0][1] = 9 $lis[$lis[0][1]][1] = "finger" $lis[$lis[0][1]][0] = 79 $list[0] = $list[0] + 1 $list[9] = GUICtrlCreateListViewItem("finger|79|stopped!!!", $ListView1) Else GUICtrlDelete($list[9]) EndIf Case $Checkbox10 If GUICtrlRead($Checkbox10) = 1 Then $lis[0][1] = 10 $lis[$lis[0][1]][1] = "dns" $lis[$lis[0][1]][0] = 53 $list[0] = $list[0] + 1 $list[10] = GUICtrlCreateListViewItem("dns|53|stopped!!!", $ListView1) Else GUICtrlDelete($list[10]) EndIf Case $Button4 $lis[0][1] = $lis[0][1] + 1 $lis[$lis[0][1]][1] = "user" & GUICtrlRead($Input2) $lis[$lis[0][1]][0] = GUICtrlRead($Input2) $list[0] = $list[0] + 1 $list[$list[0]] = GUICtrlCreateListViewItem("user" & GUICtrlRead($Input2) & "|" & GUICtrlRead($Input2) & "|stopped!!!", $ListView1) Case $Button1 start() Case $Button2 Case $Button3 EndSwitch WEnd Func start() For $i = 1 To $lis[0][1] + 1 $lis[$i][3] = TCPListen(@IPAddress1, $lis[$i][0]) If $lis[$i][3] < 0 Then GUICtrlSetData($list[$i], "||cant start") Else GUICtrlSetData($list[$i], "||ok") EndIf Next Do For $i = 1 To $lis[0][1] $acc = TCPAccept($lis[$i][3]) If $acc >= 0 Then intruder($i, $acc) EndIf Next $msg = GUIGetMsg() Until $msg = $Button2 EndFunc ;==>start Func intruder($num, $acc) TCPSend($acc, GUICtrlRead($input1)) $ip = SocketToIP($lis[$num][3]) GUICtrlCreateListViewItem(@HOUR & ":" & @MIN & "|" & $ip & "|" & $sockaddr & "|" & $lis[$num][0] & " " & $lis[$num][1], $ListView2) TCPCloseSocket($acc) EndFunc ;==>intruder Func SocketToIP($sock) Local $sockaddr, $ip $sockaddr = DllStructCreate("short;ushort;uint;char[8]") $ip = DllCall("Ws2_32.dll", "int", "getpeername", "int", $sock, "ptr", DllStructGetPtr($sockaddr), "int*", DllStructGetSize($sockaddr)) If Not @error Then $ip = $ip[0] $ip = DllCall("Ws2_32.dll", "str", "inet_ntoa", "int", DllStructGetData($sockaddr, 3)) Else $ip = 0 EndIf $sockaddr = 0 Return $ip EndFunc ;==>SocketToIPDllCall() returns array. You need $ip[0] of inet_ntoa function. But you know that (...but this, but that). ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
7h331337 Posted February 7, 2009 Author Share Posted February 7, 2009 (edited) still not working just returns 0 thanks for your help Edited February 7, 2009 by 7h331337 Link to comment Share on other sites More sharing options...
7h331337 Posted February 7, 2009 Author Share Posted February 7, 2009 thanks to trancexx for all your help got it working now Link to comment Share on other sites More sharing options...
trancexx Posted February 7, 2009 Share Posted February 7, 2009 Good to hear that parsimony works sometimes ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now