mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-03-03 11:45:46 +03:00
Adding a hidden switch --dummy used for dummy runs (getPage() returns random data) - usefull for testing purposes for skipping connections
This commit is contained in:
parent
bf05709841
commit
0e89cc62a2
|
@ -1131,7 +1131,7 @@ def checkNullConnection():
|
|||
return kb.nullConnection is not None
|
||||
|
||||
def checkConnection(suppressOutput=False):
|
||||
if not any([conf.proxy, conf.tor]):
|
||||
if not any((conf.proxy, conf.tor, conf.dummy)):
|
||||
try:
|
||||
socket.getaddrinfo(conf.hostname, None)
|
||||
except socket.gaierror:
|
||||
|
|
|
@ -210,6 +210,7 @@ optDict = {
|
|||
"verbose": "integer",
|
||||
},
|
||||
"Hidden": {
|
||||
"dummy": "boolean",
|
||||
"binaryFields": "boolean",
|
||||
"profile": "boolean",
|
||||
"cpuThrottle": "integer",
|
||||
|
|
|
@ -131,6 +131,9 @@ DUMMY_USER_PREFIX = "__dummy__"
|
|||
# Reference: http://en.wikipedia.org/wiki/ISO/IEC_8859-1
|
||||
DEFAULT_PAGE_ENCODING = "iso-8859-1"
|
||||
|
||||
# URL used in dummy runs
|
||||
DUMMY_URL = "http://foo/bar?id=1"
|
||||
|
||||
# System variables
|
||||
IS_WIN = subprocess.mswindows
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ from lib.core.common import getUnicode
|
|||
from lib.core.data import logger
|
||||
from lib.core.defaults import defaults
|
||||
from lib.core.settings import BASIC_HELP_ITEMS
|
||||
from lib.core.settings import DUMMY_URL
|
||||
from lib.core.settings import IS_WIN
|
||||
from lib.core.settings import MAX_HELP_OPTION_LENGTH
|
||||
|
||||
|
@ -664,6 +665,9 @@ def cmdLineParser():
|
|||
help="Simple wizard interface for beginner users")
|
||||
|
||||
# Hidden and/or experimental options
|
||||
parser.add_option("--dummy", dest="dummy", action="store_true",
|
||||
help=SUPPRESS_HELP)
|
||||
|
||||
parser.add_option("--pickled-options", dest="pickledOptions", help=SUPPRESS_HELP)
|
||||
|
||||
parser.add_option("--profile", dest="profile", action="store_true",
|
||||
|
@ -760,6 +764,9 @@ def cmdLineParser():
|
|||
if sys.argv[i] == '-z':
|
||||
expandMnemonics(sys.argv[i + 1], parser, args)
|
||||
|
||||
if args.dummy:
|
||||
args.url = args.url or DUMMY_URL
|
||||
|
||||
if not any((args.direct, args.url, args.logFile, args.bulkFile, args.googleDork, args.configFile, \
|
||||
args.requestFile, args.updateAll, args.smokeTest, args.liveTest, args.wizard, args.dependencies, \
|
||||
args.purgeOutput, args.pickledOptions)):
|
||||
|
|
|
@ -31,6 +31,8 @@ from lib.core.common import getRequestHeader
|
|||
from lib.core.common import getUnicode
|
||||
from lib.core.common import logHTTPTraffic
|
||||
from lib.core.common import randomizeParameterValue
|
||||
from lib.core.common import randomInt
|
||||
from lib.core.common import randomStr
|
||||
from lib.core.common import readInput
|
||||
from lib.core.common import removeReflectiveValues
|
||||
from lib.core.common import singleTimeLogMessage
|
||||
|
@ -181,6 +183,9 @@ class Connect(object):
|
|||
elif conf.cpuThrottle:
|
||||
cpuThrottle(conf.cpuThrottle)
|
||||
|
||||
if conf.dummy:
|
||||
return randomStr(int(randomInt())), {}, int(randomInt())
|
||||
|
||||
threadData = getCurrentThreadData()
|
||||
with kb.locks.request:
|
||||
kb.requestCounter += 1
|
||||
|
|
Loading…
Reference in New Issue
Block a user