Commit e14e5938 authored by Ad Schellevis's avatar Ad Schellevis

style fix list_osfp.py

parent 767eb1d8
......@@ -34,19 +34,20 @@ 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'))
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):
if data.count('\n') > 2:
for line in data.split('\n')[2:]:
result.append(line.replace('\t',' ').strip())
result.append(line.replace('\t', ' ').strip())
# handle command line argument (type selection)
if len(sys.argv) > 1 and sys.argv[1] == 'json':
# handle command line argument (type selection)
if len(sys.argv) > 1 and sys.argv[1] == 'json':
print(ujson.dumps(result))
else:
else:
# output plain
print ('------------------------- OS fingerprints -------------------------')
for ostype in result:
......
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