Jump to content
Sign in to follow this  
7h331337

NEED BIG BIG HELP!

Recommended Posts

7h331337

is there a way to get the ip from a connected socket

thanks

Share this post


Link to post
Share on other sites
BrettF

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

Share this post


Link to post
Share on other sites
7h331337

sorry in ment is there any other way this way just returns 0

Share this post


Link to post
Share on other sites
Jos

sorry in ment is there any other way this way just returns 0

mmm... so you need another way because this returns a 0?

make sense...


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
7h331337

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

Share this post


Link to post
Share on other sites
Jos

yip

any one have a suggestion or a way to fix socktoip

You 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


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
7h331337

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

#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 by 7h331337

Share this post


Link to post
Share on other sites
trancexx

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

#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

change ptr to int* in getpeername function (third parameter).

But that was already suggested.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
7h331337

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

Share this post


Link to post
Share on other sites
trancexx

i tried it and it still returning 0 thanks for the suggestion tho

Can you post that script?

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
7h331337

Can you post that script?

here is the code

#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

Share this post


Link to post
Share on other sites
trancexx

here is the code

#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
DllCall() returns array. You need $ip[0] of inet_ntoa function.

But you know that (...but this, but that).


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
7h331337

still not working just returns 0 thanks for your help

Edited by 7h331337

Share this post


Link to post
Share on other sites
7h331337

thanks to trancexx for all your help got it working now

Share this post


Link to post
Share on other sites
trancexx

Good to hear that parsimony works sometimes


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.