Jump to content

questions about timing tcp scan


Recommended Posts

32 minutes ago, faustf said:

100 is  one second ???

 

Opt("TCPTimeout", 100) ;100 milliseconds
; 1seconds=1000 milliseconds

 

Eg:

Opt('TCPTimeout', 50)

Global $hGUI = GUICreate("Autoit Port Scanner", 300, 175)
GUICtrlCreateGroup("Port Scan", 5, 5, 275, 160)
GUICtrlCreateLabel("IP", 20, 17)
Global $hcIPAddress = GUICtrlCreateInput(@IPAddress1, 20, 33, 125)
GUICtrlCreateLabel("Start on Port", 20, 55)
Global $hcPortStart = GUICtrlCreateInput("1", 20, 68, 125)
GUICtrlCreateLabel("End on Port", 20, 91)
Global $hcPortEnd = GUICtrlCreateInput("65353", 20, 108, 125)
Global $hcStartScan = GUICtrlCreateButton("Start", 20, 135, 125)
GUICtrlSetFont($hcStartScan, 12)
Global $hcOnPort = GUICtrlCreateLabel("Scanning Port: None", 150, 142)
GUICtrlCreateGroup("Open Ports", 160, 17, 105, 125)
Global $hcOpenPortList = GUICtrlCreateList("", 168, 30, 90, 109)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)

While 1
    Switch GUIGetMsg()
        Case -3
            ExitLoop
        Case $hcStartScan
            _StartScan(GUICtrlRead($hcIPAddress), GUICtrlRead($hcPortStart), GUICtrlRead($hcPortEnd))
    EndSwitch
WEnd

Func _StartScan($sIPScan = "127.0.0.1", $sPortStart = 1, $sPortEnd = 65353)
    TCPStartup()
    Local $sSoketID
    Local $sTimeStart = TimerInit()
    For $LetsGo = $sPortStart To $sPortEnd
        GUICtrlSetData($hcOnPort, "Scanning Port: " & $sPortStart)
        $sSoketID = TCPConnect($sIPScan, $sPortStart)
        If $sSoketID > 0 Then GUICtrlSetData($hcOpenPortList, $sPortStart)
        $sPortStart = $sPortStart + 1
    Next
    TCPShutdown()
    Local $sTimeEnd = TimerDiff($sTimeStart)
    TrayTip("Port Scanner", "Done Process took " & Round($sTimeEnd, -1) / 1000 & " seconds", 7, 1)
EndFunc   ;==>_StartScan

 

Edited by VIP
Eg

Regards,
 

Link to comment
Share on other sites

2 hours ago, faustf said:

i try to use  and  also  test  your script  , change  the  number  50  to  1000   but  not  see  differnce

:blink:

if your server is turned on, it works too slowly, try increasing the delay time in opt!
For example, that you open an FTP server on port 21 and WebServer at port 80
You set the starting port is 1, and the end port is 100.
After the scan will show: 21 and 80 in the list of ports!

Regards,
 

Link to comment
Share on other sites

thankz  for  suggest , but  in my case  i have  this scenario:

i  want check only  port 3356 , the  server  stay on in many  pc  of my  lan, i want  discover with scan how  many  pc  of my lan  are open, therfore  the tcpconnet , probe one  time , and    go out ,(like  a  ping , i hope  explain  a sense) , because  when is open  the  answer  at  host  is  immidiatly i mesure  with timediff, and  is :

1.53287638512716 ,  but  when host is  closed the  time  is 21001.9468954853, i  want  if  possible, reduce   this timing after  2. or 3. must  answer me  with host down  and  start next ip

thankz at all for  support

 

Link to comment
Share on other sites

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Link to comment
Share on other sites

i fund a  bug

when i  run  a  TCP Example server for socket_UDF.au3  and run  client 

i  connect  send  somthing  , and  go ok

but if  i push disconnect , start  to write  in  console Data received:

in loop  and  if i try to reconnect not  work, i must  stop

Link to comment
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
 Share

  • Recently Browsing   0 members

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