![]() ![]() Since v4, it's preferred to buy the In-App purchase in LanScan Free edition than buying the LanScan Pro application. > Only 4 hostnames are fully displayed - You'll see the first 3 chars of the others > No limitation on the number of devices found ! > Hostname resolution: DNS, mDNS (Apple devices) and SMB (Windows devices) > Discover the SMB domain if any configured > Display the IP address, MAC address, hostname (4 max) and vendor associated > Scan public IP network ranges with Ping / SMB / mDNS packets > Scan your local network with ARP packets ![]() > Scan the IP range you like, from 1 IP to the whole IPv4 address space! > Auto-detection of configured interfaces: Airport, Ethernet, Virtual interfaces. There's quite a few questions about that on Ask Ubuntu and other sites of the sort "Hey, my Linux computer can be pinged, but not Windows ones, what's up with that ?" Just be aware of the fact that for newer Windows versions you do need to enable response to ICMP echo.LanScan is a free, simple and efficient IPv4 network scanner that discovers all active devices on any subnet: the local one, or any public subnet that you configure. Windows ( starting since Windows 7, I think ) have started blocking response to ICMP echo requests.How much better does that work ? Not bad, actually, takes a matter of seconds. Now, there's also one single main function which does the looping and calling of pingf. I put the ping and printf into a function, pingf (yes, corny name, I know). Much better performance improvement can be achieved if we spawn several background processes. Quoting here isn't necessary - since we're dealing with numbers only, we don't need to anticipate word-splitting due to having spaces in a variable. This is more of a stylistic change, but it's consistent with how printf works and looks like in a lot of other languages, with quoting "$NUM" variable. The printf command can be rewritten as so: printf "IP %s is up\n" 192.168.0."$NUM" In other words, it's sufficient to do this: if ping -w 1 -q -c 1 192.168.0.$NUM > /dev/null ![]() Since we have 256 addresses and we assume 1 second for each address, the script will take about 256/60 = 4.27 minutes.ĭoing a command and then capturing its exit status with $? wasn't really necessary. So we could force ping to time out with -w 1 flag. By default, ping for two RTT, which can vary depending on how congested is your network, and as far as I understand TCP protocol doubles the wait time each time(at least according to this). The script is obviously slow and ping waits for response from the host. Since then I've learned a bit more about shell scripting, and I once I saw this script, I thought it would be a good idea to revisit this answer to add a few improvements. I originally posted this answer in August of 2015. Quick and dirty way, took me about 10 mins to write it, but runtime might be a bit slow,though. What we have here is just while loop, where we set last number in the address, make silent single ping to the address, check if the command succeed or not (and if it did succeed,then host is obviously up ), and printf statement. Nmap would be my #1 choice, but what if you don't have it ? The DIY way would be with a ping script that goes through each possible ip address on the network manually. See the revisited version below for a new and improved script that performs much faster. Note to the reader: Original answer has been posted a while ago and at the time of when I was only learning shell scripting.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |