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

Skip to content

Commit c4af7b9

Browse files
committed
initial work for issue #33
1 parent d3da3f5 commit c4af7b9

5 files changed

Lines changed: 25 additions & 1 deletion

File tree

lib/controller/action.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ def action():
118118
if conf.sqlShell:
119119
conf.dbmsHandler.sqlShell()
120120

121+
if conf.sqlFile:
122+
conf.dbmsHandler.sqlFile()
123+
121124
# User-defined function options
122125
if conf.udfInject:
123126
conf.dbmsHandler.udfInjectCustom()

lib/core/optiondict.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@
119119
"firstChar": "integer",
120120
"lastChar": "integer",
121121
"query": "string",
122-
"sqlShell": "boolean"
122+
"sqlShell": "boolean",
123+
"sqlFile": "string"
123124
},
124125

125126
"Brute": {

lib/parse/cmdline.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,9 @@ def cmdLineParser():
383383
action="store_true",
384384
help="Prompt for an interactive SQL shell")
385385

386+
enumeration.add_option("--sql-file", dest="sqlFile",
387+
help="Execute SQL statements from given file(s)")
388+
386389
# User-defined function options
387390
brute = OptionGroup(parser, "Brute force", "These "
388391
"options can be used to run brute force "

plugins/generic/enumeration.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from lib.core.common import dataToStdout
1717
from lib.core.common import filterPairValues
1818
from lib.core.common import getLimitRange
19+
from lib.core.common import getSQLSnippet
1920
from lib.core.common import getUnicode
2021
from lib.core.common import isInferenceAvailable
2122
from lib.core.common import isListLike
@@ -2463,3 +2464,16 @@ def sqlShell(self):
24632464

24642465
elif output != "Quit":
24652466
dataToStdout("No output\n")
2467+
2468+
def sqlFile(self):
2469+
infoMsg = "executing SQL statements from given file(s)"
2470+
logger.info(infoMsg)
2471+
2472+
for sfile in re.split(PARAMETER_SPLITTING_REGEX, conf.sqlFile):
2473+
found = False
2474+
sfile = sfile.strip()
2475+
2476+
if not sfile:
2477+
continue
2478+
2479+
self.sqlQuery(getSQLSnippet(Backend.getDbms(), sfile))

sqlmap.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,9 @@ query =
432432
# Valid: True or False
433433
sqlShell = False
434434

435+
# Execute SQL statements from given file(s).
436+
sqlFile =
437+
435438

436439
# These options can be used to run brute force checks.
437440
[Brute force]

0 commit comments

Comments
 (0)