Sign in to follow this  
Followers 0
n0tb4d

Ip Scanner

5 posts in this topic

this is my first projek in AutoIt i'm create a simple ip scanner with command Ping() .... and that really usefull ........

muttley

source code

Download here

preview :

Posted Image

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I like your script. Maybe if you add a SplashTextOn() with "Scanning..." will be more interactive.

Here:

SplashTextOn("","Scanning...",100,20,-1,-1,1)
    for $i = 1 to $host[1]
        for $j = 1 to $host[2]
            for $k = 1 to $host[3]
                for $l = 1 to $host[4]
                    $ip = ($aIp1[1] + $i) - 1 & "." & ($aIp1[2] + $j) - 1 & "." & ($aIp1[3] + $k) - 1 & "." & ( $aIp1[4] + $l ) - 1
                    $hasil = Ping($ip,1)
                    if $hasil then 
                        _GUICtrlListBox_AddString($list1,$ip)
                        $banyak = $banyak + 1
                        GUICtrlSetData($lbl1,"Found " & $banyak & " hosts lives")
                    endif
                Next
            Next
        Next
    next 
    SplashOff()
Edited by Andreik

When the words fail... music speaks

Share this post


Link to post
Share on other sites

good job muttley

Share this post


Link to post
Share on other sites

I like your script. Maybe if you add a SplashTextOn() with "Scanning..." will be more interactive.

Here:

SplashTextOn("","Scanning...",100,20,-1,-1,1)
    for $i = 1 to $host[1]
        for $j = 1 to $host[2]
            for $k = 1 to $host[3]
                for $l = 1 to $host[4]
                    $ip = ($aIp1[1] + $i) - 1 & "." & ($aIp1[2] + $j) - 1 & "." & ($aIp1[3] + $k) - 1 & "." & ( $aIp1[4] + $l ) - 1
                    $hasil = Ping($ip,1)
                    if $hasil then 
                        _GUICtrlListBox_AddString($list1,$ip)
                        $banyak = $banyak + 1
                        GUICtrlSetData($lbl1,"Found " & $banyak & " hosts lives")
                    endif
                Next
            Next
        Next
    next 
    SplashOff()
wow, you right .... thanksss .. muttley

Share this post


Link to post
Share on other sites

Guys, I know this is an old post (2+ years) but I wanted to correct your script. Your script doesn't scan the entire IP range properly. IP's range from 0.0.0.0 to 255.255.255.255. I found that your script would skip IP's (192.168.1.1, 192.168.1.2, 192.168.1.3, then jump to 192.168.2.1, 192.168.2.2, 192.168.2.3, etc) instead of running up to .255 THEN incrementing to the next IP segment properly. So I updated your script below. I don't know if I missed any INCLUDES but this should get you up and running

#include <iNet.au3>
#include <SQLite.au3>
#include <SQLite.dll.au3>
#include <Array.au3>

Func _ScanNetwork()

$StartIP =  StringSplit(IniRead( $TreeViewINI, "Configure", "Scan Range Begin","NotFound"),".")
$EndIP =    StringSplit(IniRead( $TreeViewINI, "Configure", "Scan Range End","NotFound"),".")

Dim $aIp1[5]
Dim $Result


SplashTextOn("Network Scan", "Scanning...", 200,200, -1, -1, 20, "")
    for $i =$StartIP[1] to 255
        for $j = $StartIP[2] to 255
            for $k =$StartIP[3] to 255
                for $L = $StartIP[4] to 255

                    $ip = ($aIp1[1] + $i) & "." & ($aIp1[2] + $j) & "." & ($aIp1[3] + $k) & "." & ( $aIp1[4] + $l )
                    $ping = Ping($ip,1)

                    if $ping then
                        $Result = $ip & " is on"

                        TCPStartup()
                        $Hostname = _TCPIpToName ($ip)
                        TCPShutdown ()

                            If @error Then
                                MsgBox(0, "_TCPIpToName()", "@error = " & @error & @LF & "@extended = " & @extended)
                            Else
                                _SQLite_Startup ()
                                _SQLite_Open (@scriptdir & "\database\test.db")
                                $qq = _SQLite_Exec (-1, "INSERT INTO PCInfo(Name, IP) VALUES ('" & $Hostname & "', '" & $ip & "');")
                                ;msgbox(0,$SQLITE_OK,@error)

                                _SQLite_Close()
                                _SQLite_Shutdown()

                            EndIf
                        Else
                        $Result = $ip & " is off"
                    endif
                    ControlSetText("Network Scan", "", "Static1", $Result)

                    ;Test to see if we are at the last IP.  If so, break the loop
                    If $i & $j & $k & $L= $EndIP[1] & $EndIP[2] & $EndIP[3] & $EndIP[4] Then
                        $AtEndofIPRange = 1
                        ExitLoop
                    EndIf
                Next
                If $AtEndofIPRange = 1 then ExitLoop
            Next
            If $AtEndofIPRange = 1 then ExitLoop
        Next
        If $AtEndofIPRange = 1 then ExitLoop
    next
    ;Sleep(1000)
    SplashOff()
EndFunc

Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

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  
Followers 0