Last active
November 29, 2019 15:34
-
-
Save frainfreeze/33c819295fbdca1ba6a9 to your computer and use it in GitHub Desktop.
Small script for writting dump files of tcpdump
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import datetime | |
today = datetime.datetime.now() | |
dump_file = ('dumped/' + today + '.txt') | |
def write_dump(): | |
try: | |
a = subprocess.check_output(['tcpdump']) | |
dump = open(dump_file 'w') | |
dump.write(a) | |
written = True | |
dump.close() | |
print 'Sucessfully dumped info' | |
except: | |
print 'error while trying to write dump' | |
if __name__=="__main__": | |
write_dump() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment