-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtester.py
executable file
·101 lines (96 loc) · 3.24 KB
/
tester.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/usr/bin/env python
# OWASP ODZ Muti CMS Scanner 2013
# Author : Mennouchi Islam Azeddine [email protected]
# This Tool is published Under the GNU public license (for more information license.txt)
# Tester Class :
import re,urllib2,mechanize,md5,xml.etree.ElementTree,sha
from fingerprint import FingerPrint
from distutils.version import StrictVersion
class Tester:
""" La classe des tests de vulnirabilites """
def __init__(self):
self.fprint = FingerPrint()
def wp_vulns(self,version):
""" detection Vuln. dans le corps de WP """
tree = xml.etree.ElementTree.parse("doc/wp_vulns.xml")
p = tree.findall("wordpress")
#print p
#p2 = tree.findall("hash/file")
for ele in p:
vrs = ele.attrib["version"]
#print vrs
if (vrs == version):
s = ele.getchildren()
for elem in s:
r = elem.getchildren()
#print "test"
print "Title : "+r[0].text
print "Reference : "+r[1].text
print "Type : "+r[2].text
def wp_plugins_vulns(self,url):
"""detection des vuln. dans les plugins"""
tree = xml.etree.ElementTree.parse("doc/plugin_vulns.xml")
p = tree.findall("plugin")
#cmp = lambda x, y: StrictVersion(x).__cmp__(y)
vregex = re.compile("[\d.]*\d+")
found = 0
for ele in p:
dir = ele.attrib["name"]
if (self.fprint.check_if_exist(url+"/wp-content/plugins/"+dir)):
rdm = self.fprint.get_cont(url+"/wp-content/plugins/"+dir+"/readme.txt")
regex = re.compile('Stable tag: ([\d.]*\d+)')
iversion1 = self.fprint.copy(regex.findall(rdm))
#print iversion1
try :
iversion = iversion1[0]
except IndexError :
iversion = "?"
#print iversion
s = ele.getchildren()
for elem in s :
r = elem.getchildren()
version = self.fprint.copy(vregex.findall(r[0].text))
#print version
try :
v = version[0]
except IndexError :
v = "?"
#print v
if (len(r) == 3):
#found = 1
print "[!] Title : "+r[0].text
print "[!] Ref. : "+r[1].text
print "[!] Type : "+r[2].text
if (len(r) == 4):
print "[!] Title : "+r[0].text
print "[!] Ref.1 : "+r[1].text
print "[!] Ref.2 : "+r[2].text
print "[!] Type : "+r[3].text
if ( (v == "?") or (iversion == "?")):
print "[x] You need to check we could not detect the version"
else:
#print StrictVersion(v).__cmp__(iversion)
if ((StrictVersion(v).__cmp__(iversion) == 0) or (StrictVersion(iversion).__cmp__(v) == -1)):
print "[x] Your CMS is infected with this vuln."
found = 1
else :
print "[x] Your CMS is Safe From this vuln."
if (found == 0):
print "[!] No Vuln. Plugin was found !"
def wp_theme_vulns(self,url):
"""detection des vuln. dans les themes"""
tree = xml.etree.ElementTree.parse("doc/theme_vulns.xml")
p = tree.findall("theme")
found = 0
for ele in p:
dir = ele.attrib["name"]
if (self.fprint.check_if_exist(url+"/wp-content/themes/"+dir)):
found = 1
s = ele.getchildren()
for elem in s:
r = elem.getchildren()
print "[!] Title : "+r[0].text
print "[!] Ref. : "+r[1].text
print "[!] Type : "+r[2].text
if (found == 0):
print "[!] No Vlun. Theme Was Found "