Commit e14e5938 authored by Ad Schellevis's avatar Ad Schellevis

style fix list_osfp.py

parent 767eb1d8
......@@ -34,20 +34,21 @@ import os
import sys
import ujson
result=[]
with tempfile.NamedTemporaryFile() as output_stream:
subprocess.call(['/sbin/pfctl','-s', 'osfp'], stdout=output_stream, stderr=open(os.devnull, 'wb'))
output_stream.seek(0)
data = output_stream.read().strip()
if (data.count('\n') > 2):
for line in data.split('\n')[2:]:
result.append(line.replace('\t',' ').strip())
# handle command line argument (type selection)
if len(sys.argv) > 1 and sys.argv[1] == 'json':
print(ujson.dumps(result))
else:
# output plain
print ('------------------------- OS fingerprints -------------------------')
for ostype in result:
print (ostype)
if __name__ == '__main__':
result = []
with tempfile.NamedTemporaryFile() as output_stream:
subprocess.call(['/sbin/pfctl', '-s', 'osfp'], stdout=output_stream, stderr=open(os.devnull, 'wb'))
output_stream.seek(0)
data = output_stream.read().strip()
if data.count('\n') > 2:
for line in data.split('\n')[2:]:
result.append(line.replace('\t', ' ').strip())
# handle command line argument (type selection)
if len(sys.argv) > 1 and sys.argv[1] == 'json':
print(ujson.dumps(result))
else:
# output plain
print ('------------------------- OS fingerprints -------------------------')
for ostype in result:
print (ostype)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment