update regarding warning for --random-agent during connection timeout in connection test phase

This commit is contained in:
Miroslav Stampar 2011-05-03 10:05:42 +00:00
parent eceb5eca7b
commit 1e6c2fea74
3 changed files with 14 additions and 1 deletions

View File

@ -55,6 +55,7 @@ from lib.core.enums import OS
from lib.core.enums import PLACE from lib.core.enums import PLACE
from lib.core.enums import PAYLOAD from lib.core.enums import PAYLOAD
from lib.core.enums import SORTORDER from lib.core.enums import SORTORDER
from lib.core.enums import WARNFLAGS
from lib.core.exception import sqlmapDataException from lib.core.exception import sqlmapDataException
from lib.core.exception import sqlmapFilePathException from lib.core.exception import sqlmapFilePathException
from lib.core.exception import sqlmapGenericException from lib.core.exception import sqlmapGenericException
@ -661,7 +662,7 @@ def dataToStdout(data, forceOutput=False):
warnMsg += "replacement with '?' character. Please, find " warnMsg += "replacement with '?' character. Please, find "
warnMsg += "proper character representation inside " warnMsg += "proper character representation inside "
warnMsg += "coresponding output files. " warnMsg += "coresponding output files. "
singleTimeLogMessage(warnMsg, logging.WARN, 'dataToStdout') singleTimeLogMessage(warnMsg, logging.WARN, WARNFLAGS.DATA_TO_STDOUT)
sys.stdout.write(output) sys.stdout.write(output)
else: else:

View File

@ -93,6 +93,10 @@ class HTTPHEADER:
REFERER = "Referer" REFERER = "Referer"
USER_AGENT = "User-Agent" USER_AGENT = "User-Agent"
class WARNFLAGS:
RANDOM_AGENT = 'randomAgent'
DATA_TO_STDOUT = 'dataToStdout'
class EXPECTED: class EXPECTED:
BOOL = "bool" BOOL = "bool"
INT = "int" INT = "int"

View File

@ -8,6 +8,7 @@ See the file 'doc/COPYING' for copying permission
""" """
import httplib import httplib
import logging
import re import re
import socket import socket
import time import time
@ -29,6 +30,7 @@ from lib.core.common import logHTTPTraffic
from lib.core.common import parseTargetUrl from lib.core.common import parseTargetUrl
from lib.core.common import readInput from lib.core.common import readInput
from lib.core.common import removeReflectiveValues from lib.core.common import removeReflectiveValues
from lib.core.common import singleTimeLogMessage
from lib.core.common import stdev from lib.core.common import stdev
from lib.core.common import urlEncodeCookieValues from lib.core.common import urlEncodeCookieValues
from lib.core.common import wasLastRequestDelayed from lib.core.common import wasLastRequestDelayed
@ -41,6 +43,7 @@ from lib.core.enums import HTTPHEADER
from lib.core.enums import HTTPMETHOD from lib.core.enums import HTTPMETHOD
from lib.core.enums import NULLCONNECTION from lib.core.enums import NULLCONNECTION
from lib.core.enums import PLACE from lib.core.enums import PLACE
from lib.core.enums import WARNFLAGS
from lib.core.exception import sqlmapConnectionException from lib.core.exception import sqlmapConnectionException
from lib.core.exception import sqlmapSyntaxException from lib.core.exception import sqlmapSyntaxException
from lib.core.settings import HTTP_SILENT_TIMEOUT from lib.core.settings import HTTP_SILENT_TIMEOUT
@ -382,6 +385,11 @@ class Connect:
warnMsg += ", sqlmap is going to retry the request" warnMsg += ", sqlmap is going to retry the request"
logger.critical(warnMsg) logger.critical(warnMsg)
if kb.originalPage is None:
warnMsg = "if the problem persists please try to rerun "
warnMsg += "with the --random-agent switch turned on"
singleTimeLogMessage(warnMsg, logging.WARN, WARNFLAGS.RANDOM_AGENT)
time.sleep(1) time.sleep(1)
socket.setdefaulttimeout(conf.timeout) socket.setdefaulttimeout(conf.timeout)