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

Skip to content

Commit 0b449bb

Browse files
committed
Fix for an Issue #433
1 parent f67148a commit 0b449bb

4 files changed

Lines changed: 17 additions & 18 deletions

File tree

lib/core/data.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
# object to store original command line options
1515
cmdLineOptions = AttribDict()
1616

17+
# object to store merged options (command line, configuration file and default options)
18+
mergedOptions = AttribDict()
19+
1720
# object to share within function and classes command
1821
# line options and settings
1922
conf = AttribDict()

lib/core/option.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
from lib.core.data import conf
5858
from lib.core.data import kb
5959
from lib.core.data import logger
60+
from lib.core.data import mergedOptions
6061
from lib.core.data import queries
6162
from lib.core.datatype import AttribDict
6263
from lib.core.datatype import InjectionDict
@@ -1854,6 +1855,8 @@ def _mergeOptions(inputOptions, overrideOptions):
18541855
if hasattr(conf, key) and conf[key] is None:
18551856
conf[key] = value
18561857

1858+
mergedOptions.update(conf)
1859+
18571860
def _setTrafficOutputFP():
18581861
if conf.trafficFile:
18591862
infoMsg = "setting file for logging HTTP traffic"

lib/core/settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,9 @@
319319
# Maximum integer value
320320
MAX_INT = sys.maxint
321321

322+
# Options that need to be restored in multiple targets run mode
323+
RESTORE_MERGED_OPTIONS = ("col", "db", "dnsName", "privEsc", "tbl", "regexp", "string", "textOnly", "threads", "timeSec", "tmpPath", "uChar", "user")
324+
322325
# Parameters to be ignored in detection phase (upper case)
323326
IGNORE_PARAMETERS = ("__VIEWSTATE", "__VIEWSTATEENCRYPTED", "__EVENTARGUMENT", "__EVENTTARGET", "__EVENTVALIDATION", "ASPSESSIONID", "ASP.NET_SESSIONID", "JSESSIONID", "CFID", "CFTOKEN")
324327

lib/core/target.py

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
from lib.core.common import readInput
2121
from lib.core.common import resetCookieJar
2222
from lib.core.common import urldecode
23-
from lib.core.data import cmdLineOptions
2423
from lib.core.data import conf
2524
from lib.core.data import kb
2625
from lib.core.data import logger
26+
from lib.core.data import mergedOptions
2727
from lib.core.data import paths
2828
from lib.core.dicts import DBMS_DICT
2929
from lib.core.dump import dumper
@@ -47,6 +47,7 @@
4747
from lib.core.settings import MULTIPART_RECOGNITION_REGEX
4848
from lib.core.settings import PROBLEMATIC_CUSTOM_INJECTION_PATTERNS
4949
from lib.core.settings import REFERER_ALIASES
50+
from lib.core.settings import RESTORE_MERGED_OPTIONS
5051
from lib.core.settings import RESULTS_FILE_FORMAT
5152
from lib.core.settings import SOAP_RECOGNITION_REGEX
5253
from lib.core.settings import SUPPORTED_DBMS
@@ -511,25 +512,14 @@ def _createTargetDirs():
511512
_createFilesDir()
512513
_configureDumper()
513514

514-
def _restoreCmdLineOptions():
515+
def _restoreMergedOptions():
515516
"""
516-
Restore command line options that could be possibly
517-
changed during the testing of previous target.
517+
Restore merged options (command line, configuration file and default values)
518+
that could be possibly changed during the testing of previous target.
518519
"""
519520

520-
conf.col = cmdLineOptions.col
521-
conf.db = cmdLineOptions.db
522-
conf.dnsName = cmdLineOptions.dnsName
523-
conf.privEsc = cmdLineOptions.privEsc
524-
conf.tbl = cmdLineOptions.tbl
525-
conf.regexp = cmdLineOptions.regexp
526-
conf.string = cmdLineOptions.string
527-
conf.textOnly = cmdLineOptions.textOnly
528-
conf.threads = cmdLineOptions.threads
529-
conf.timeSec = cmdLineOptions.timeSec
530-
conf.tmpPath = cmdLineOptions.tmpPath
531-
conf.uChar = cmdLineOptions.uChar
532-
conf.user = cmdLineOptions.user
521+
for option in RESTORE_MERGED_OPTIONS:
522+
conf[option] = mergedOptions[option]
533523

534524
def initTargetEnv():
535525
"""
@@ -548,7 +538,7 @@ def initTargetEnv():
548538
conf.hashDBFile = None
549539

550540
_setKnowledgeBaseAttributes(False)
551-
_restoreCmdLineOptions()
541+
_restoreMergedOptions()
552542
_setDBMS()
553543

554544
if conf.data:

0 commit comments

Comments
 (0)