-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcms.py
61 lines (54 loc) · 1.76 KB
/
cms.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
58
59
60
61
try:
import time
from sys import __stdout__, stdout
from threading import Thread
from subprocess import *
import os
import sys
import subprocess
import threading
import readline
from termcolor import colored
except ImportError:
print("\ncheck for prerequisities ")
def cms_scan(target):
os.system('clear')
p = './output/cmsCheck/'
try:
os.mkdir(p)
except FileExistsError as exc:
print(exc)
print(colored("\n--------------------------------------------",
'red', attrs=['bold']))
print(
colored("[+] Starting cms scanner", 'red', attrs=['bold']))
print(colored("--------------------------------------------",
'red', attrs=['bold']))
print(colored("\n[*]\tRunning cms scanner", 'red', attrs=['bold']))
cmd = [
'python3 ~/Tools/CMSeeK/cmseek.py -u' + target + ' --batch -r '
]
try:
for c in cmd:
proc = subprocess.run(
c, shell=True, stderr=STDOUT, stdout=sys.stdout)
if(proc.returncode != 0):
print(colored('Step 1 Failed! Check/Update prerequisitie packages. \nError: ',
'blue', attrs=['bold']) + proc.stderr.rstrip())
return False
else:
print(colored("[x] Executed", 'blue', attrs=['bold']))
except:
print("Something went wrong! Check prerequisities.\n")
return False
cmd1 = 'mv ~/Tools/CMSeeK/Result/' + target + '/ ./output/cmsCheck'
try:
proc = subprocess.run(
cmd1, shell=True, stderr=STDOUT, stdout=sys.stdout)
if(proc.returncode != 0):
return False
return True
except:
return False
# result = cms_scan('jiit.ac.in')
# print(result)