Commit e14e5938 authored by Ad Schellevis's avatar Ad Schellevis

style fix list_osfp.py

parent 767eb1d8
...@@ -34,20 +34,21 @@ import os ...@@ -34,20 +34,21 @@ import os
import sys import sys
import ujson import ujson
result=[] if __name__ == '__main__':
with tempfile.NamedTemporaryFile() as output_stream: result = []
subprocess.call(['/sbin/pfctl','-s', 'osfp'], stdout=output_stream, stderr=open(os.devnull, 'wb')) with tempfile.NamedTemporaryFile() as output_stream:
output_stream.seek(0) subprocess.call(['/sbin/pfctl', '-s', 'osfp'], stdout=output_stream, stderr=open(os.devnull, 'wb'))
data = output_stream.read().strip() output_stream.seek(0)
if (data.count('\n') > 2): data = output_stream.read().strip()
for line in data.split('\n')[2:]: if data.count('\n') > 2:
result.append(line.replace('\t',' ').strip()) 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': # handle command line argument (type selection)
print(ujson.dumps(result)) if len(sys.argv) > 1 and sys.argv[1] == 'json':
else: print(ujson.dumps(result))
# output plain else:
print ('------------------------- OS fingerprints -------------------------') # output plain
for ostype in result: print ('------------------------- OS fingerprints -------------------------')
print (ostype) 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