Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import subprocess, datetime
- class MainLoop(object):
- def filename(self):
- now = datetime.datetime.now()
- time = now.strftime("%Y-%m-%d(%H:%M)")
- print time
- option = raw_input("Would you like to set filename? (y/n):").lower()
- try:
- if option == "y":
- self.inputname()
- if option == "n":
- self.host()
- else:
- print "invalid option"
- self.filename()
- except ValueError:
- print "invalid option"
- self.filename()
- def inputname(self):
- self.raw = self.time
- self.raw = raw_input("Filename:")
- self.host()
- def host(self):
- self.input_host = raw_input("Host:").lower()
- option2 = raw_input("Would you like to compare Hosts? (y/n):")
- try:
- if option2 == "y":
- self.input_host2 = raw_input("Host 2:")
- self.cmd2()
- if option2 == "n":
- self.cmd()
- else:
- print "invalid option, quitting"
- except ValueError:
- print "invalid option, quitting"
- def cmd2(self):
- command = 'tcpdump -c5 -tttt -w {0} host {1} and host {2}'.format(raw, input_host, input_host2)
- subprocess.call(command.split(), shell=False)
- def cmd(self):
- command = 'tcpdump -c5 -tttt -w {0} host {1}'.format(raw, input_host)
- subprocess.call(command.split(), shell=False)
- if __name__ == '__main__':
- MainLoop().filename()
Add Comment
Please, Sign In to add comment