Sign in to follow this  
Followers 0
rakudave

Lan Scan

6 posts in this topic

it scanns your LAN and shows you a list of what it found...

Description: on my page

Download: here

#include <GUIConstants.au3>
#include <iptoname.au3>
#Include <GuiListView.au3>
Global $what
$ipspl = stringsplit(@ipaddress1,".")
$pre = $ipspl[1] & "." & $ipspl[2] & "." & $ipspl[3]
GUICreate("Lan Scan",250,240)
$list = GUICtrlCreateListView("IP                          |Name                          ",5,5,240)
$scan = GUICtrlCreateButton("Scan",5,160,50)
$now = GUICtrlCreateLabel("",75,165,100,20)
GUICtrlCreateLabel("Time out:",170,165)
$timeout = GUICtrlCreateInput("250",215,162,30)
$def = GUICtrlCreateRadio("Use " & $pre & ".X",15,190)
GUICtrlSetState(-1,$GUI_CHECKED)
$set = GUICtrlCreateRadio("Set range:",15,210)
$setfrom = GUICtrlCreateInput("0.0.0",115,210,125)
GUISetState()

do
    $msg = GUIGetMsg()
    if $msg = $scan then
        _scan()
    endif
until $msg = $GUI_EVENT_CLOSE

Func _scan()
    _GUICtrlListViewDeleteAllItems($list)
    $ipspl = stringsplit(@ipaddress1,".")
    $pre = $ipspl[1] & "." & $ipspl[2] & "." & $ipspl[3]
    GUICtrlSetData($scan,"Stop")
    $timeout = GUICtrlRead($timeout)
    if guictrlread($def) & guictrlread($set) = 41 then
        $from = guictrlread($setfrom)
        $splfrom = stringsplit($from,".")
        if $splfrom[0] <> 3 OR $splfrom[1] > 255 OR $splfrom[2] > 255 OR $splfrom[3] > 255 then
            MsgBox(16,"ERROR",'Invalid "set range" input!')
            return
        endif
        $pre = $from
    endif
    for $x = 0 to 255
        $ip = $pre & "." & $x
        $ping = ping($ip,$timeout)
        If $ping then
            $ipname = _IpToName($ip)
            GUICtrlCreateListViewItem($ip & "|" & $ipname,$list)
        endif
        GUICtrlSetData($now,"Scan: " & $ip)
        $msg = GUIGetMsg()
        If $x = 255 then $msg = $scan
        If $msg = $scan then
            GUICtrlSetData($scan,"Scan")
            GUICtrlSetData($now,"Done!")
            return
        endif
    next
endfunc

Share this post


Link to post
Share on other sites



could you provide the iptoname.au3 file?

Share this post


Link to post
Share on other sites

äh... sry...

Func _IpToName($ip)
$outread = "ERROR: Kann Programm NbtStat.exe nicht finden!"
Ping($ip,50)
If @error Then
MsgBox(16,"Ping error","Die adresse "&$ip&" konnte nich gefunden werden, stellen Sie sicher das der Rechner online ist!")
Exit
EndIf
$run = Run(@ComSpec&" /c nbtstat -a "&$ip, @SystemDir, @SW_HIDE, 6)
Sleep(500)
$stdoutread = StdoutRead($run)
If Not @error = -1 Then $outread=$stdoutread

$stderrRead = StderrRead($run)
If Not @error = -1 Then $outread = $stderrRead
$ss = StringSplit($outread,@CRLF)
If $ss[0] < 23 Then
$outread = "(No Name Available)"
Else
$outread = $ss[23]
$outread = StringReplace($outread,Chr(129),"ü")
$outread = StringReplace($outread,Chr(154),"Ü")
$outread = StringReplace($outread,Chr(142),"Ä")
$outread = StringReplace($outread,Chr(132),"ä")
$outread = StringReplace($outread,Chr(153),"Ö")
$outread = StringReplace($outread,Chr(148),"ö")
$outreadlen = StringLen("   LAN-Verbindung:Knoten-IP-Adresse: [] Bereichskennung: []      NetBIOS-Namentabelle des Remotecomputers     Name            Typ        Status    ---------------------------------------------   ")+StringLen($ip)
$outread = StringTrimLeft($outread,4)
$outread = StringSplit($outread," ")
$outread = $outread[1]
$outread = StringReplace($outread," ","",0)
EndIf
Return $outread
EndFunc

Share this post


Link to post
Share on other sites

Nice job done..

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