Guest User

Untitled

a guest
Jan 16th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. #imports
  2. import os
  3.  
  4. #Change directories
  5. os.chdir ("M:\Daily Testing")
  6.  
  7. #User Input
  8. print "What is the name of the system being scanned?"
  9. sys = raw_input("> ")
  10.  
  11. #Subfolder selected
  12. os.chdir (sys)
  13. os.chdir ("RESULTS")
  14.  
  15. #variables
  16. tag = ["/tcp", "/udp"]
  17. fout = [sys + " Weekly Summary.csv"]
  18.  
  19. import glob
  20. for filename in glob.glob("*.nmap"):
  21. with open(filename, "rU") as f:
  22. for line in f:
  23. if not line.strip():
  24. continue
  25. for t in tag:
  26. if t in line:
  27. fout.write(line)
  28. else:
  29. continue
  30.  
  31. fout = [sys + " Weekly Summary.csv"]
  32.  
  33. with open(sys+" Weekly Summary.csv", "w") as fout:
  34.  
  35. <snip>
  36. import glob
  37. with open(sys + " Weekly Summary.csv", "w") as fout:
  38. for filename in glob.glob("*.nmap"):
  39. with open(filename, "rU") as f:
  40. for line in f:
  41. if not line.strip():
  42. continue
  43. for t in tag:
  44. if t in line:
  45. fout.write(line)
  46. else:
  47. continue
Add Comment
Please, Sign In to add comment