MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / _commentCheck

Method _commentCheck

plugins/dbms/mysql/fingerprint.py:32–93  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

30 GenericFingerprint.__init__(self, DBMS.MYSQL)
31
32 def _commentCheck(self):
33 infoMsg = "executing %s comment injection fingerprint" % DBMS.MYSQL
34 logger.info(infoMsg)
35
36 result = inject.checkBooleanExpression("[RANDNUM]=[RANDNUM]/* NoValue */")
37
38 if not result:
39 warnMsg = "unable to perform %s comment injection" % DBMS.MYSQL
40 logger.warning(warnMsg)
41
42 return None
43
44 # Reference: https://downloads.mysql.com/archives/community/
45 # Reference: https://dev.mysql.com/doc/relnotes/mysql/<major>.<minor>/en/
46
47 versions = (
48 (90300, 90302), # MySQL 9.3
49 (90200, 90202), # MySQL 9.2
50 (90100, 90102), # MySQL 9.1
51 (90000, 90002), # MySQL 9.0
52 (80400, 80406), # MySQL 8.4
53 (80300, 80302), # MySQL 8.3
54 (80200, 80202), # MySQL 8.2
55 (80100, 80102), # MySQL 8.1
56 (80000, 80043), # MySQL 8.0
57 (60000, 60014), # MySQL 6.0
58 (50700, 50745), # MySQL 5.7
59 (50600, 50652), # MySQL 5.6
60 (50500, 50563), # MySQL 5.5
61 (50400, 50404), # MySQL 5.4
62 (50100, 50174), # MySQL 5.1
63 (50000, 50097), # MySQL 5.0
64 (40100, 40131), # MySQL 4.1
65 (40000, 40032), # MySQL 4.0
66 (32300, 32359), # MySQL 3.23
67 (32200, 32235), # MySQL 3.22
68 )
69
70 found = False
71 for candidate in versions:
72 result = inject.checkBooleanExpression("[RANDNUM]=[RANDNUM]/*!%d AND [RANDNUM1]=[RANDNUM2]*/" % candidate[0])
73
74 if not result:
75 found = True
76 break
77
78 if found:
79 for version in xrange(candidate[1], candidate[0] - 1, -1):
80 version = getUnicode(version)
81 result = inject.checkBooleanExpression("[RANDNUM]=[RANDNUM]/*!%s AND [RANDNUM1]=[RANDNUM2]*/" % version)
82
83 if not result:
84 if version[0] == "3":
85 midVer = version[1:3]
86 else:
87 midVer = version[2]
88
89 trueVer = "%s.%s.%s" % (version[0], midVer, version[3:])

Callers 1

getFingerprintMethod · 0.95

Calls 3

getUnicodeFunction · 0.90
xrangeClass · 0.85
infoMethod · 0.80

Tested by

no test coverage detected