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

Skip to content

Commit 5c2451d

Browse files
committed
Implementation for an Issue #293
1 parent cb13735 commit 5c2451d

4 files changed

Lines changed: 20 additions & 3 deletions

File tree

lib/controller/checks.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
import socket
1313
import time
1414

15+
from subprocess import PIPE
16+
from subprocess import Popen as execute
17+
1518
from extra.beep.beep import beep
1619
from lib.core.agent import agent
1720
from lib.core.common import arrayizeValue
@@ -521,6 +524,13 @@ def genCmpPayload():
521524
if conf.beep:
522525
beep()
523526

527+
if conf.alert:
528+
infoMsg = "executing alerting shell command(s) ('%s')" % conf.alert
529+
logger.info(infoMsg)
530+
531+
process = execute(conf.alert, shell=True)
532+
process.wait()
533+
524534
# There is no need to perform this test for other
525535
# <where> tags
526536
break

lib/core/optiondict.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@
191191

192192
"Miscellaneous": {
193193
"mnemonics": "string",
194+
"alert": "string",
194195
"answers": "string",
195196
"beep": "boolean",
196197
"checkPayload": "boolean",

lib/parse/cmdline.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,9 @@ def cmdLineParser():
603603
miscellaneous.add_option("-z", dest="mnemonics",
604604
help="Use short mnemonics (e.g. \"flu,bat,ban,tec=EU\")")
605605

606+
miscellaneous.add_option("--alert", dest="alert",
607+
help="Run shell command(s) when SQL injection is found")
608+
606609
miscellaneous.add_option("--answers", dest="answers",
607610
help="Set question answers (e.g. \"quit=N,follow=N\")")
608611

sqlmap.conf

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -650,13 +650,16 @@ updateAll = False
650650

651651
[Miscellaneous]
652652

653-
# Use short mnemonics (e.g. "flu,bat,ban,tec=EU")
653+
# Use short mnemonics (e.g. "flu,bat,ban,tec=EU").
654654
mnemonics =
655655

656-
# Set question answers (e.g. "quit=N,follow=N")
656+
# Run shell command(s) when SQL injection is found.
657+
alert =
658+
659+
# Set question answers (e.g. "quit=N,follow=N").
657660
answers =
658661

659-
# Make a beep sound when SQL injection is found
662+
# Make a beep sound when SQL injection is found.
660663
# Valid: True or False
661664
beep = False
662665

0 commit comments

Comments
 (0)