Skip to content

Commit caf273f

Browse files
committed
PEP8 changes
1 parent 0b736e4 commit caf273f

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

ping_subnet.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# Script Name : ping_subnet.py
22
# Author : Craig Richards
33
# Created : 12th January 2012
4-
# Last Modified :
4+
# Last Modified :
55
# Version : 1.0
66

7-
# Modifications :
7+
# Modifications :
88

99
# Description : After supplying the first 3 octets it will scan the final range for available addresses
1010

1111
import os # Load the Library Module
12-
import subprocess # Load the Library Module
12+
import subprocess # Load the Library Module
1313
import sys # Load the Library Module
1414

1515
filename = sys.argv[0] # Sets a variable for the script name
@@ -30,10 +30,11 @@
3030
elif os.name in ("nt", "dos", "ce"): # Check the os, if it's windows then
3131
myping = "ping -n 2 " # This is the ping command
3232

33-
f = open('ping_'+subnet+'.log', 'w') # Open a logfile
33+
f = open('ping_' + subnet + '.log', 'w') # Open a logfile
3434
for ip in range(2,255): # Set the ip variable for the range of numbers
35-
ret = subprocess.call(myping + str(subnet)+"."+str(ip) , shell=True,stdout=f,stderr=subprocess.STDOUT) # Run the command pinging the servers
35+
ret = subprocess.call(myping + str(subnet) + "." + str(ip) ,
36+
shell=True, stdout=f, stderr=subprocess.STDOUT) # Run the command pinging the servers
3637
if ret == 0: # Depending on the response
37-
f.write (subnet+"."+str(ip) + " is alive" + "\n") # Write out that you can receive a reponse
38+
f.write (subnet + "." + str(ip) + " is alive" + "\n") # Write out that you can receive a reponse
3839
else:
39-
f.write (subnet+"."+str(ip) + " did not respond" + "\n") # Write out you can't reach the box
40+
f.write (subnet + "." + str(ip) + " did not respond" + "\n") # Write out you can't reach the box

0 commit comments

Comments
 (0)