-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscanner
60 lines (48 loc) · 1.58 KB
/
scanner
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
#! /usr/bin/pythonI
import subprocess
import re
targetsite=raw_input("Enter your domain\n")
outfile=open(targetsite+".txt","w")
def worpresscan(targetsite):
print ("Scanning "+targetsite+" using wpscan")
wpscan=subprocess.Popen(["wpscan","--url", targetsite,"--follow-redirection","|","sed","-r","'s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g'"],stdout=subprocess.PIPE)
scanoutput=wpscan.communicate()
scanprint=str(scanoutput).strip()
print scanprint
outfile.write(scanprint)
print "Scan has been finished"
def joomscan(targetsite):
print "Scanning "+targetsite+" using joomscan\n"
joomscan=subprocess.Popen(["joomscan","-u", targetsite,"-oh"],stdout=subprocess.PIPE)
scanoutput=joomscan.communicate()
scanoutput=str(scanoutput).strip()
print scanoutput
outfile.write(scanoutput)
print "Scan has been finished"
def nikto(targetsite):
nikto=subprocess.Popen(["nikto -h targetsite"],stdout.subprocess.PIPE)
scanoutput=nikto.communicate()
scanoutput=str(scanoutput).strip()
print scanoutput
outfile.write(scanoutput)
print "Scan has been finished"
scanner=subprocess.Popen(["whatweb", targetsite], stdout=subprocess.PIPE)
output, err = scanner.communicate()
Joomla = re.compile("Joomla|joomla")
joommatch=Joomla.search(output)
wordpress=re.compile("Wordpress|WordPress")
wordpmatch=wordpress.search(output)
match = 0
while match==0:
if joommatch:
print "Joomla CMS Detected\n"
match=1
joomscan(targetsite)
break
if wordpmatch:
print "Wordpress Detected"
match=1
worpresscan(targetsite)
break
else:
print "No Cms Detected\n Runninng Scan using Nikto\n",match