Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 20ae1c2

Browse files
committed
added switch --logic-negative
1 parent 8bd3cfd commit 20ae1c2

4 files changed

Lines changed: 18 additions & 4 deletions

File tree

lib/controller/checks.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,10 @@ def checkSqlInjection(place, parameter, value):
289289
# Use different page template than the original
290290
# one as we are changing parameters value, which
291291
# will likely result in a different content
292-
origValue = "-%s" % randomInt()
292+
if not conf.logicNegative:
293+
origValue = "-%s" % randomInt()
294+
else:
295+
origValue = "%s AND %s=%s" % (origValue, randomInt(), randomInt())
293296
templatePayload = agent.payload(place, parameter, newValue=origValue, where=where)
294297
elif where == PAYLOAD.WHERE.REPLACE:
295298
origValue = ""

lib/core/agent.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,13 @@ def payload(self, place=None, parameter=None, value=None, newValue=None, where=N
8888
if where == PAYLOAD.WHERE.ORIGINAL:
8989
value = origValue
9090
elif where == PAYLOAD.WHERE.NEGATIVE:
91-
if newValue.startswith("-"):
92-
value = ""
91+
if not conf.logicNegative:
92+
if newValue.startswith("-"):
93+
value = ""
94+
else:
95+
value = "-%s" % randomInt()
9396
else:
94-
value = "-%s" % randomInt()
97+
value = "%s AND %s=%s" % (origValue, randomInt(2), randomInt(2))
9598
elif where == PAYLOAD.WHERE.REPLACE:
9699
value = ""
97100
else:

lib/parse/cmdline.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ def cmdLineParser():
184184
injection.add_option("--suffix", dest="suffix",
185185
help="Injection payload suffix string")
186186

187+
injection.add_option("--logic-negative", dest="logicNegative",
188+
action="store_true",
189+
help="Use logic operation(s) instead of negating values")
190+
187191
injection.add_option("--skip", dest="skip",
188192
help="Skip testing for given parameter(s)")
189193

sqlmap.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,10 @@ prefix =
185185
# Injection payload suffix string
186186
suffix =
187187

188+
# Use logic operation(s) instead of negating values
189+
# Valid: True or False
190+
logicNegative = False
191+
188192
# Skip testing for given parameter(s)
189193
skip =
190194

0 commit comments

Comments
 (0)