View difference between Paste ID: FEYWsVjK and HMGZ3S4t
SHOW: | | - or go back to the newest paste.
1
def ping(host):
2
    process = subprocess.Popen(["ping", "-n", "1",host], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
3
    streamdata = process.communicate()[0]
4
    #print(str(streamdata))
5
    if not 'Reply from {}'.format(host) in str(streamdata):
6
        return 1
7
    else:
8
        return 0