-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdumper.py
More file actions
30 lines (23 loc) · 740 Bytes
/
dumper.py
File metadata and controls
30 lines (23 loc) · 740 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import subprocess
import os
DUMP_FOLDER = os.getcwd()+"/dump"
ARP_DUMP = os.getcwd()+'/dump/arpDump'
IFCONFIG_DUMP = os.getcwd()+'/dump/ifconfigDump'
def checkDumpFiles():
open(ARP_DUMP, "a").close()
open(IFCONFIG_DUMP, "a").close()
def readIFConfigDump():
return open(IFCONFIG_DUMP).read()
def readARPDump():
return open(ARP_DUMP).read()
class Dumper(object):
def __init__(self):
if not os.path.exists(DUMP_FOLDER):
os.makedirs(DUMP_FOLDER)
checkDumpFiles()
def arpDump(this):
subprocess.call('rm '+ARP_DUMP, shell=True)
subprocess.call('arp -a >> '+ARP_DUMP, shell=True)
def ipConfigDump(this,i):
subprocess.call('rm '+IFCONFIG_DUMP, shell=True)
subprocess.call('ifconfig '+i+' >> '+IFCONFIG_DUMP, shell=True)