Python Forum
I don't understand the parameters in a statement that uses the sh library - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: I don't understand the parameters in a statement that uses the sh library (/thread-9474.html)



I don't understand the parameters in a statement that uses the sh library - RedSkeleton007 - Apr-11-2018

I'm putting together a hacking program for a school project. I found the following ping sweep script on youtube:
#PingSweep.py
#This program will find all of the active ip addresses in a network
import ipaddress
import sh

print("Enter a network address with a slash number.")
chooseNetworkAddress = input("")
network = ipaddress.ip_network(unicode(chooseNetworkAddress))

for i in network.hosts():
    try:
        sh.ping(i, "-c l")
        print(i, " is active")
    except sh.ErrorReturncode_l:
        print(" no response from", i)
But I don't understand the "-c l" parameters used on line 12. Does anybody know what those are supposed to do?


RE: I don't understand the parameters in a statement that uses the sh library - Gribouillis - Apr-11-2018

It is probably ping -c 1. This causes ping to stop after 1 request, according to the ping command's manual.