4141from lib .core .enums import PAYLOAD
4242from lib .core .enums import PLACE
4343from lib .core .exception import exceptionsTuple
44- from lib .core .exception import sqlmapNoneDataException
45- from lib .core .exception import sqlmapNotVulnerableException
46- from lib .core .exception import sqlmapSilentQuitException
47- from lib .core .exception import sqlmapValueException
48- from lib .core .exception import sqlmapUserQuitException
44+ from lib .core .exception import SqlmapNoneDataException
45+ from lib .core .exception import SqlmapNotVulnerableException
46+ from lib .core .exception import SqlmapSilentQuitException
47+ from lib .core .exception import SqlmapValueException
48+ from lib .core .exception import SqlmapUserQuitException
4949from lib .core .settings import ASP_NET_CONTROL_REGEX
5050from lib .core .settings import DEFAULT_GET_POST_DELIMITER
5151from lib .core .settings import EMPTY_FORM_FIELDS_REGEX
5858from lib .core .target import setupTargetEnv
5959from thirdparty .pagerank .pagerank import get_pagerank
6060
61- def __selectInjection ():
61+ def _selectInjection ():
6262 """
6363 Selection function for injection place, parameters and type.
6464 """
@@ -113,14 +113,14 @@ def __selectInjection():
113113 if select .isdigit () and int (select ) < len (kb .injections ) and int (select ) >= 0 :
114114 index = int (select )
115115 elif select [0 ] in ( "Q" , "q" ):
116- raise sqlmapUserQuitException
116+ raise SqlmapUserQuitException
117117 else :
118118 errMsg = "invalid choice"
119- raise sqlmapValueException , errMsg
119+ raise SqlmapValueException , errMsg
120120
121121 kb .injection = kb .injections [index ]
122122
123- def __formatInjection (inj ):
123+ def _formatInjection (inj ):
124124 data = "Place: %s\n " % inj .place
125125 data += "Parameter: %s\n " % inj .parameter
126126
@@ -143,11 +143,11 @@ def __formatInjection(inj):
143143
144144 return data
145145
146- def __showInjections ():
146+ def _showInjections ():
147147 header = "sqlmap identified the following injection points with "
148148 header += "a total of %d HTTP(s) requests" % kb .testQueryCount
149149
150- data = "" .join (set (map (lambda x : __formatInjection (x ), kb .injections ))).rstrip ("\n " )
150+ data = "" .join (set (map (lambda x : _formatInjection (x ), kb .injections ))).rstrip ("\n " )
151151
152152 conf .dumper .technic (header , data )
153153
@@ -156,7 +156,7 @@ def __showInjections():
156156 infoMsg += "included in shown payload content(s)"
157157 logger .info (infoMsg )
158158
159- def __randomFillBlankFields (value ):
159+ def _randomFillBlankFields (value ):
160160 retVal = value
161161
162162 if extractRegexResult (EMPTY_FORM_FIELDS_REGEX , value ):
@@ -173,7 +173,7 @@ def __randomFillBlankFields(value):
173173
174174 return retVal
175175
176- def __saveToHashDB ():
176+ def _saveToHashDB ():
177177 injections = hashDBRetrieve (HASHDB_KEYS .KB_INJECTIONS , True ) or []
178178 injections .extend (_ for _ in kb .injections if _ and _ .place is not None and _ .parameter is not None )
179179
@@ -196,7 +196,7 @@ def __saveToHashDB():
196196 if not hashDBRetrieve (HASHDB_KEYS .KB_DYNAMIC_MARKINGS ):
197197 hashDBWrite (HASHDB_KEYS .KB_DYNAMIC_MARKINGS , kb .dynamicMarkings , True )
198198
199- def __saveToResultsFile ():
199+ def _saveToResultsFile ():
200200 if not conf .resultsFP :
201201 return
202202
@@ -310,7 +310,7 @@ def start():
310310 if conf .method == HTTPMETHOD .POST :
311311 message = "Edit POST data [default: %s]%s: " % (urlencode (conf .data ) if conf .data else "None" , " (Warning: blank fields detected)" if conf .data and extractRegexResult (EMPTY_FORM_FIELDS_REGEX , conf .data ) else "" )
312312 conf .data = readInput (message , default = conf .data )
313- conf .data = __randomFillBlankFields (conf .data )
313+ conf .data = _randomFillBlankFields (conf .data )
314314 conf .data = urldecode (conf .data ) if conf .data and urlencode (DEFAULT_GET_POST_DELIMITER , None ) not in conf .data else conf .data
315315
316316 elif conf .method == HTTPMETHOD .GET :
@@ -319,7 +319,7 @@ def start():
319319 secondPart = targetUrl [targetUrl .find ("?" )+ 1 :]
320320 message = "Edit GET data [default: %s]: " % secondPart
321321 test = readInput (message , default = secondPart )
322- test = __randomFillBlankFields (test )
322+ test = _randomFillBlankFields (test )
323323 conf .url = "%s?%s" % (firstPart , test )
324324
325325 parseTargetUrl ()
@@ -493,7 +493,7 @@ def start():
493493 if kb .vainRun and not conf .multipleTargets :
494494 errMsg = "no parameter(s) found for testing in the provided data "
495495 errMsg += "(e.g. GET parameter 'id' in 'www.site.com/index.php?id=1')"
496- raise sqlmapNoneDataException , errMsg
496+ raise SqlmapNoneDataException , errMsg
497497 else :
498498 errMsg = "all tested parameters appear to be not injectable."
499499
@@ -541,15 +541,15 @@ def start():
541541 errMsg += "expression that you have choosen "
542542 errMsg += "does not match exclusively True responses"
543543
544- raise sqlmapNotVulnerableException , errMsg
544+ raise SqlmapNotVulnerableException , errMsg
545545 else :
546546 # Flush the flag
547547 kb .testMode = False
548548
549- __saveToResultsFile ()
550- __saveToHashDB ()
551- __showInjections ()
552- __selectInjection ()
549+ _saveToResultsFile ()
550+ _saveToHashDB ()
551+ _showInjections ()
552+ _selectInjection ()
553553
554554 if kb .injection .place is not None and kb .injection .parameter is not None :
555555 if conf .multipleTargets :
@@ -576,14 +576,14 @@ def start():
576576 elif test [0 ] in ("n" , "N" ):
577577 return False
578578 elif test [0 ] in ("q" , "Q" ):
579- raise sqlmapUserQuitException
579+ raise SqlmapUserQuitException
580580 else :
581581 raise
582582
583- except sqlmapUserQuitException :
583+ except SqlmapUserQuitException :
584584 raise
585585
586- except sqlmapSilentQuitException :
586+ except SqlmapSilentQuitException :
587587 raise
588588
589589 except exceptionsTuple , e :
0 commit comments