Nmap + Python / Valdinei dos Santos
a guest Mar 12th, 2010 245 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- #! /bin/env python
- #!-*- coding: utf-8 -*-
- from commands import getstatusoutput
- command="sudo nmap -sP %s | egrep -i '(Host|MAC)' >> %s" % (nets, logFile)
- status, output = getstatusoutput(command)
- newLines = ''
- if int(status) == 0:
- print 'ok'
- for line in file(logFile).readlines():
- if 'Host ' in line:
- newLines += line.rstrip()+" "
- newLines += line.strip()+"\n"
- print "Problema com o comando nmap"
- print output
- FILE = open(logFile, 'w')
RAW Paste Data