-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnessus.py
57 lines (37 loc) · 1.04 KB
/
nessus.py
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import os
def nessus(path):
filename = os.path.basename(path)
_path = './ToMulVAL/nessus/'
name, a = filename.split('.')
des_path = _path + name
dir_path = des_path
i = 1
while (os.path.exists(dir_path)):
dir_path = des_path + '_' + str(i)
i = i + 1
print(dir_path)
cmd = 'mkdir' + ' ' + dir_path
os.system(cmd)
get_config(dir_path)
cmd = 'cp %s %s' % (path, dir_path)
os.system(cmd)
# cmd='cd %s'%(dir_path)
# os.system(cmd)
os.chdir(dir_path)
print(os.getcwd())
cmd = 'nessus_translate.sh' + ' ' + filename
print(cmd)
os.system(cmd)
# os.chdir(./../../..)
print(os.getcwd())
res_path = 'nessus.P'
down_path = '../../download/'
cmd = 'cp %s %s' % (res_path, down_path)
os.system(cmd)
def get_config(dir_path):
fullpath = dir_path + '/config' + '.txt'
file = open(fullpath, 'w')
msg = 'jdbc:mysql://39.100.88.210:3306/nvd\nmulval\nmulval\n'
file.write(msg)
a = './ToMulVAL/upload/example.nessus'
nessus(a)