Jump to content



Photo

IP Scanner


  • Please log in to reply
25 replies to this topic

#1 llewxam

llewxam

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 345 posts

Posted 17 June 2010 - 11:17 PM

I saw Manadar's update to nping earlier today and that reminded me of a script I did that was largely based on some of his work, thought I'd put it up.

Where nping is all command-line, this one offers a GUI to select which network adapter to use if there is more than one present, scans 1-255 and puts used/free IPs in separate lists, gives the round-trip ping time for a single request on found IPs, resolves the IPs to host names, and if you double-click a found IP it will give you a full, standard 4-request ping to that IP.

I wrote this last year while doing some contract work at a very large facility where finding free IPs to set up a network printer etc was the most horrible process of random pings at the command prompt, this tool should be a big help for others in the same situations.

Enjoy, and thanks to Manadar for the function that is the real meat and bones of this script!

Ian


*Updated 7/8/10 - added a button to copy the IP address to the clipboard.
*Updated 11/20/10 - added the Copy to Clipboard for unused IPs, and a Save to File function. Minor tweaks as well.
*Updated 2/6/11 - added $used to Local declaration, found that the script crashed when multiple connections were available unless $used was declared.
*Updated 2/20/11 - switched the found IP list to a ListView, I just started using that and LOVE IT!! :mellow: Added a bit more real-time info and trimmed a little fat to improve speed.
*Updated 10/24/12 - updated GUI, added buttons to open a found IP in a web browser or Windows Explorer, and added a Rescan button so you don't have to quit and restart the app to rescan the IP range.
*Update 2 10/24/12 - slight goof on a variable that needed to be Global........

Attached Files


Edited by llewxam, 24 October 2012 - 11:43 PM.

  • IP Scanner - Multi-threaded ping tool to scan your available networks for used and available IP addresses, shows ping times, resolves IPs in to host names, and allows individual IPs to be pinged.
  • INFSniff - Great technicians tool - a tool which scans DriverPacks archives for INF files and parses out the HWIDs to a database file, and rapidly scans the local machine's HWIDs, searches the database for matches, and installs them.
  • PPK3 (Persistent Process Killer V3) - Another for the techs - suppress running processes that you need to keep away, helpful when fighting spyware/viruses.
  • Sync Tool - Folder sync tool with lots of real time information and several checking methods.
  • USMT Front End - Front End for Microsoft's User State Migration Tool, including all files needed for USMT 3.01 and 4.01, 32 bit and 64 bit versions.
  • Audit Tool - Computer audit tool to gather vital hardware, Windows, and Office information for IT managers and field techs. Capabilities include creating a customized siteagent.
  • CSV Viewer - Displays CSV files with automatic column sizing and font selection. Lines can also be copied to the clipboard for data extraction.





#2 o0o

o0o

    Seeker

  • Active Members
  • 9 posts

Posted 21 June 2010 - 12:41 AM

Can ping ip online in txt list ?

#3 llewxam

llewxam

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 345 posts

Posted 21 June 2010 - 04:20 AM

I'm not quite sure I understand, would you like to have a txt file of IPs to scan, or scan a range and have the results saved? If you want to have a txt file of the results, just replace
GUICtrlSetData($used, $showHost[1] & "." & $showHost[2] & "." & $showHost[3] & "." & $lastOct & "   (" & $hostName & ")" & "   " & $pingTime & "ms")
with something like
FileWriteLine($outputFile, $showHost[1] & "." & $showHost[2] & "." & $showHost[3] & "." & $lastOct & "   (" & $hostName & ")" & "   " & $pingTime & "ms")


If you want to have a list of IPs scanned, 80% of this script would have to be ripped out so you'd be better off writing something from scratch I think. Manadar's threaded ping script is great for dealing with a lot of IPs.


Ian
  • IP Scanner - Multi-threaded ping tool to scan your available networks for used and available IP addresses, shows ping times, resolves IPs in to host names, and allows individual IPs to be pinged.
  • INFSniff - Great technicians tool - a tool which scans DriverPacks archives for INF files and parses out the HWIDs to a database file, and rapidly scans the local machine's HWIDs, searches the database for matches, and installs them.
  • PPK3 (Persistent Process Killer V3) - Another for the techs - suppress running processes that you need to keep away, helpful when fighting spyware/viruses.
  • Sync Tool - Folder sync tool with lots of real time information and several checking methods.
  • USMT Front End - Front End for Microsoft's User State Migration Tool, including all files needed for USMT 3.01 and 4.01, 32 bit and 64 bit versions.
  • Audit Tool - Computer audit tool to gather vital hardware, Windows, and Office information for IT managers and field techs. Capabilities include creating a customized siteagent.
  • CSV Viewer - Displays CSV files with automatic column sizing and font selection. Lines can also be copied to the clipboard for data extraction.

#4 o0o

o0o

    Seeker

  • Active Members
  • 9 posts

Posted 21 June 2010 - 07:07 AM

I'm not quite sure I understand, would you like to have a txt file of IPs to scan (A), or scan a range and have the results saved? (:mellow:

A ^ ^

#5 Zibit

Zibit

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 262 posts

Posted 21 June 2010 - 08:47 AM

very nice :mellow:

#6 Manadar

Manadar

    Taking a REST.

  • MVPs
  • 10,714 posts

Posted 05 July 2010 - 01:01 PM

I noticed that the _HostName function you are using hangs the application for a short moment. Perhaps you can use "nbtstat -A ip.adr.res.s" in a similar way I did with ping to increase responsiveness. The ability to copy IP addresses in their normal format would be nice (perhaps right click > copy). The .0xx on the end makes no sense and many applications will not accept IP addresses in this format.

#7 llewxam

llewxam

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 345 posts

Posted 05 July 2010 - 07:45 PM

I noticed that the _HostName function you are using hangs the application for a short moment. Perhaps you can use "nbtstat -A ip.adr.res.s" in a similar way I did with ping to increase responsiveness. The ability to copy IP addresses in their normal format would be nice (perhaps right click > copy). The .0xx on the end makes no sense and many applications will not accept IP addresses in this format.


Thanks for the nbtstat suggestion, I will look in to that in the next couple evenings.

Padding the last octet was just for cosmetic reasons and just done for myself, I can't look at it like
192.168.1.1 192.168.1.10 192.168.1.11 192.168.1.12 192.168.1.13 192.168.1.14 192.168.1.15 192.168.1.16 192.168.1.17 192.168.1.18 192.168.1.19 192.168.1.2 192.168.1.21


I could add a "Copy IP to Clipboard" button that would not have the padded octet, that is a good idea actually. :blink:

Thanks

Ian
  • IP Scanner - Multi-threaded ping tool to scan your available networks for used and available IP addresses, shows ping times, resolves IPs in to host names, and allows individual IPs to be pinged.
  • INFSniff - Great technicians tool - a tool which scans DriverPacks archives for INF files and parses out the HWIDs to a database file, and rapidly scans the local machine's HWIDs, searches the database for matches, and installs them.
  • PPK3 (Persistent Process Killer V3) - Another for the techs - suppress running processes that you need to keep away, helpful when fighting spyware/viruses.
  • Sync Tool - Folder sync tool with lots of real time information and several checking methods.
  • USMT Front End - Front End for Microsoft's User State Migration Tool, including all files needed for USMT 3.01 and 4.01, 32 bit and 64 bit versions.
  • Audit Tool - Computer audit tool to gather vital hardware, Windows, and Office information for IT managers and field techs. Capabilities include creating a customized siteagent.
  • CSV Viewer - Displays CSV files with automatic column sizing and font selection. Lines can also be copied to the clipboard for data extraction.

#8 llewxam

llewxam

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 345 posts

Posted 09 July 2010 - 03:08 AM

I added a button to copy the selected IP address from the Used list to the clipboard, and it removes the 0 padding from the last octet.

I tried working the nbtstat suggestion in, but couldn't find a way to capture it's output. STDOUT wasn't able to do it, because the function was over before a While loop could start! Yeah, it's fast! :blink: I also tried redirecting it with a ">file.txt", but even though that worked fine in a command box, it wasn't so hot through a Run or ShellExecute command, plus then a file would have to be parsed and I'd like to avoid that. So long story short, any suggestions on how to grab its response?

Thanks!

Ian
  • IP Scanner - Multi-threaded ping tool to scan your available networks for used and available IP addresses, shows ping times, resolves IPs in to host names, and allows individual IPs to be pinged.
  • INFSniff - Great technicians tool - a tool which scans DriverPacks archives for INF files and parses out the HWIDs to a database file, and rapidly scans the local machine's HWIDs, searches the database for matches, and installs them.
  • PPK3 (Persistent Process Killer V3) - Another for the techs - suppress running processes that you need to keep away, helpful when fighting spyware/viruses.
  • Sync Tool - Folder sync tool with lots of real time information and several checking methods.
  • USMT Front End - Front End for Microsoft's User State Migration Tool, including all files needed for USMT 3.01 and 4.01, 32 bit and 64 bit versions.
  • Audit Tool - Computer audit tool to gather vital hardware, Windows, and Office information for IT managers and field techs. Capabilities include creating a customized siteagent.
  • CSV Viewer - Displays CSV files with automatic column sizing and font selection. Lines can also be copied to the clipboard for data extraction.

#9 Manadar

Manadar

    Taking a REST.

  • MVPs
  • 10,714 posts

Posted 09 July 2010 - 10:48 AM

I tried working the nbtstat suggestion in, but couldn't find a way to capture it's output. STDOUT wasn't able to do it, because the function was over before a While loop could start! Yeah, it's fast! :blink: I also tried redirecting it with a ">file.txt", but even though that worked fine in a command box, it wasn't so hot through a Run or ShellExecute command, plus then a file would have to be parsed and I'd like to avoid that. So long story short, any suggestions on how to grab its response?

I had no trouble getting the output. Maybe a mistake on your end?

#include <Constants.au3> $ip = @IPAddress1 $hProcess = Run("nbtstat /A " & $ip, "", @SW_HIDE, $STDOUT_CHILD) Local $output = "" While 1     $output &= StdoutRead($hProcess)     If @error Then ExitLoop Wend ConsoleWrite($output)


And maybe a small detail, but how I do copy from the unused IP address list? ;) I know this can't be done, but it would be an improvement for the user if it could. Perhaps use context menus? Right click > Copy IP address.

Edited by Manadar, 09 July 2010 - 10:49 AM.


#10 llewxam

llewxam

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 345 posts

Posted 09 July 2010 - 12:25 PM

I had no trouble getting the output. Maybe a mistake on your end?


No, I use the same technique when a used IP is double-clicked to get the output from a Ping, then display it in a message box. I did the exact same thing as your example code just above, and yours wouldn't work for me just now either. I am using win 7 64bit and tried it compiled and not compiled, can anyone verify that Manadar's example works in that environment? I will also run some tests on other platforms when I get in to work. Odd that it works fine for a ping, not for nbtstat! :blink:

Also, I guess I could just allow the Copy to Clipboard to work for unused as well as used, I just didn't think about it..... That will be changed once the nbtstat issue is resolved.

Thanks!

Ian
  • IP Scanner - Multi-threaded ping tool to scan your available networks for used and available IP addresses, shows ping times, resolves IPs in to host names, and allows individual IPs to be pinged.
  • INFSniff - Great technicians tool - a tool which scans DriverPacks archives for INF files and parses out the HWIDs to a database file, and rapidly scans the local machine's HWIDs, searches the database for matches, and installs them.
  • PPK3 (Persistent Process Killer V3) - Another for the techs - suppress running processes that you need to keep away, helpful when fighting spyware/viruses.
  • Sync Tool - Folder sync tool with lots of real time information and several checking methods.
  • USMT Front End - Front End for Microsoft's User State Migration Tool, including all files needed for USMT 3.01 and 4.01, 32 bit and 64 bit versions.
  • Audit Tool - Computer audit tool to gather vital hardware, Windows, and Office information for IT managers and field techs. Capabilities include creating a customized siteagent.
  • CSV Viewer - Displays CSV files with automatic column sizing and font selection. Lines can also be copied to the clipboard for data extraction.

#11 llewxam

llewxam

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 345 posts

Posted 09 July 2010 - 05:54 PM

The nbtstat via Run DOES work on Win7 32bit, but not on 64. I tried setting the WorkingDir as well as threw in a #RequireAdmin for giggles, nothing made a difference..... :blink:

Ian
  • IP Scanner - Multi-threaded ping tool to scan your available networks for used and available IP addresses, shows ping times, resolves IPs in to host names, and allows individual IPs to be pinged.
  • INFSniff - Great technicians tool - a tool which scans DriverPacks archives for INF files and parses out the HWIDs to a database file, and rapidly scans the local machine's HWIDs, searches the database for matches, and installs them.
  • PPK3 (Persistent Process Killer V3) - Another for the techs - suppress running processes that you need to keep away, helpful when fighting spyware/viruses.
  • Sync Tool - Folder sync tool with lots of real time information and several checking methods.
  • USMT Front End - Front End for Microsoft's User State Migration Tool, including all files needed for USMT 3.01 and 4.01, 32 bit and 64 bit versions.
  • Audit Tool - Computer audit tool to gather vital hardware, Windows, and Office information for IT managers and field techs. Capabilities include creating a customized siteagent.
  • CSV Viewer - Displays CSV files with automatic column sizing and font selection. Lines can also be copied to the clipboard for data extraction.

#12 BrettF

BrettF

    My Drunk Monkey Guerilla is gonna getcha!

  • MVPs
  • 7,662 posts

Posted 10 July 2010 - 12:13 AM

The nbtstat via Run DOES work on Win7 32bit, but not on 64. I tried setting the WorkingDir as well as threw in a #RequireAdmin for giggles, nothing made a difference..... :blink:

Ian

I believe it is related to this.

#13 FranckGr

FranckGr

    Seeker

  • Active Members
  • 31 posts

Posted 10 July 2010 - 06:21 AM

I had no trouble getting the output. Maybe a mistake on your end?

#include <Constants.au3> $ip = @IPAddress1 $hProcess = Run("nbtstat /A " & $ip, "", @SW_HIDE, $STDOUT_CHILD) Local $output = "" While 1     $output &= StdoutRead($hProcess)     If @error Then ExitLoop Wend ConsoleWrite($output)
And maybe a small detail, but how I do copy from the unused IP address list? Posted Image I know this can't be done, but it would be an improvement for the user if it could. Perhaps use context menus? Right click > Copy IP address.

Nice script llewxam.

Note : NBTSTAT is a localised command, try every NIC connected, and is also slow when finding a linux host (here a French XP OS querying my router) ...

C:\Documents and Settings\Franck Grieder>nbtstat -A 192.168.146.254

OnBoard:
Adresse IP du noeud : [192.168.146.50] ID d'étendue : []

Hôte introuvable.

VirtualBox Host-Only Network:
Adresse IP du noeud : [192.168.56.1] ID d'étendue : []

Hôte introuvable.

Edited by FranckGr, 10 July 2010 - 06:22 AM.


#14 llewxam

llewxam

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 345 posts

Posted 20 November 2010 - 11:35 PM

First post updated with improved code.

Enjoy
Ian
  • IP Scanner - Multi-threaded ping tool to scan your available networks for used and available IP addresses, shows ping times, resolves IPs in to host names, and allows individual IPs to be pinged.
  • INFSniff - Great technicians tool - a tool which scans DriverPacks archives for INF files and parses out the HWIDs to a database file, and rapidly scans the local machine's HWIDs, searches the database for matches, and installs them.
  • PPK3 (Persistent Process Killer V3) - Another for the techs - suppress running processes that you need to keep away, helpful when fighting spyware/viruses.
  • Sync Tool - Folder sync tool with lots of real time information and several checking methods.
  • USMT Front End - Front End for Microsoft's User State Migration Tool, including all files needed for USMT 3.01 and 4.01, 32 bit and 64 bit versions.
  • Audit Tool - Computer audit tool to gather vital hardware, Windows, and Office information for IT managers and field techs. Capabilities include creating a customized siteagent.
  • CSV Viewer - Displays CSV files with automatic column sizing and font selection. Lines can also be copied to the clipboard for data extraction.

#15 Emiel Wieldraaijer

Emiel Wieldraaijer

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 651 posts

Posted 21 November 2010 - 11:12 AM

I believe it is related to this.

The same problem occurs to Mstsc.exe the solution is in the following code.

Local $stOldVal = DllStructCreate("dword") DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "ptr", DllStructGetPtr($stOldVal)) $PID = Run(@WindowsDir & "\system32\mstsc.exe", @TempDir) If ProcessExists($PID) Then Msgbox (64, "Process", "The Process ID = " & $PID) DllCall("kernel32.dll", "int", "Wow64RevertWow64FsRedirection", "ptr", DllStructGetPtr($stOldVal))

Edited by Emiel Wieldraaijer, 21 November 2010 - 11:12 AM.

Best regards,Emiel WieldraaijerPosted Image

#16 llewxam

llewxam

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 345 posts

Posted 20 February 2011 - 12:29 PM

I have added some tweaks, code in first post updated.

Odd side effect of these changes that I can not understand or correct is that the SplashTextOn() in Func _PingSpecific() will not show anything except a title, very strange, if anyone can see why please let me know.

Otherwise, enjoy!
Ian
  • IP Scanner - Multi-threaded ping tool to scan your available networks for used and available IP addresses, shows ping times, resolves IPs in to host names, and allows individual IPs to be pinged.
  • INFSniff - Great technicians tool - a tool which scans DriverPacks archives for INF files and parses out the HWIDs to a database file, and rapidly scans the local machine's HWIDs, searches the database for matches, and installs them.
  • PPK3 (Persistent Process Killer V3) - Another for the techs - suppress running processes that you need to keep away, helpful when fighting spyware/viruses.
  • Sync Tool - Folder sync tool with lots of real time information and several checking methods.
  • USMT Front End - Front End for Microsoft's User State Migration Tool, including all files needed for USMT 3.01 and 4.01, 32 bit and 64 bit versions.
  • Audit Tool - Computer audit tool to gather vital hardware, Windows, and Office information for IT managers and field techs. Capabilities include creating a customized siteagent.
  • CSV Viewer - Displays CSV files with automatic column sizing and font selection. Lines can also be copied to the clipboard for data extraction.

#17 guinness

guinness

    guinness

  • MVPs
  • 10,371 posts

Posted 20 February 2011 - 12:36 PM

Nice update! One for the Script Folder :)

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringIsValid()_StringReplaceWholeWord()_StringStripChar()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()AutoIt SearchAutoIt3 PortableAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasteBinSciTE JumpSignature CreatorWM_COPYDATAMore Examples...Updated: 11/04/2013


#18 llewxam

llewxam

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 345 posts

Posted 21 February 2011 - 12:31 AM

I have added some tweaks, code in first post updated.

Odd side effect of these changes that I can not understand or correct is that the SplashTextOn() in Func _PingSpecific() will not show anything except a title, very strange, if anyone can see why please let me know.

Otherwise, enjoy!
Ian

LOL, how often do you get to quote yourself??............

ANYWAY, I figured out what I had to do by following the as-usual wisdomic reply of Melba23 here. Pain in the butt, had to re-do LOTS of stuff, but it was worth it :)

Ian
  • IP Scanner - Multi-threaded ping tool to scan your available networks for used and available IP addresses, shows ping times, resolves IPs in to host names, and allows individual IPs to be pinged.
  • INFSniff - Great technicians tool - a tool which scans DriverPacks archives for INF files and parses out the HWIDs to a database file, and rapidly scans the local machine's HWIDs, searches the database for matches, and installs them.
  • PPK3 (Persistent Process Killer V3) - Another for the techs - suppress running processes that you need to keep away, helpful when fighting spyware/viruses.
  • Sync Tool - Folder sync tool with lots of real time information and several checking methods.
  • USMT Front End - Front End for Microsoft's User State Migration Tool, including all files needed for USMT 3.01 and 4.01, 32 bit and 64 bit versions.
  • Audit Tool - Computer audit tool to gather vital hardware, Windows, and Office information for IT managers and field techs. Capabilities include creating a customized siteagent.
  • CSV Viewer - Displays CSV files with automatic column sizing and font selection. Lines can also be copied to the clipboard for data extraction.

#19 Fr0zT

Fr0zT

    Seeker

  • Active Members
  • 30 posts

Posted 19 July 2011 - 05:19 PM

Just for reference you might want to check out an AutoIt ping utility I wrote here:

http://www.autoitscript.com/forum/topic/106354-threaded-ping/page__view__findpost__p__766946

It is fully multi-threaded(real threads, not timers, adlib, or shell calls) so it works well for pinging multiple IP's simultaneously and you don't have to worry about parsing Stdout. It also handles every type of ping reply, errors and timeouts.

#20 4Eyes

4Eyes

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 334 posts

Posted 26 September 2011 - 03:02 AM

Ian,

Good work, but there's a small bug in your code. For a class C network, there is no host at x.x.x.255 so if you change the size of the address[] array to 254 and change the For/Next to use up to 253 then you'll cover the 'legal' range of 1-254 inclusive, as shown in the snippet below.

I'd love to see this handle a bigger network, say 1024 hosts (subnet mask, 255.255.252.0) and I've had a look at changing it, but it's a lot of work with the way you handle the octets at the moment.

;Local $address[255] Local $address[254]                            ; 4Eyes - 24/Sep/2011 ;For $i = 0 To 254 For $i = 0 To 253                                 ; 4Eyes - 24/Sep/2011 - for a class C network only need 1-254       $address[$i] = $range & $i + 1        ; We generate some IPs Next





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users