MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / initTargetEnv

Function initTargetEnv

lib/core/target.py:714–764  ·  view source on GitHub ↗

Initialize target environment.

()

Source from the content-addressed store, hash-verified

712 conf[option] = mergedOptions[option]
713
714def initTargetEnv():
715 """
716 Initialize target environment.
717 """
718
719 if conf.multipleTargets:
720 if conf.hashDB:
721 conf.hashDB.close()
722
723 if conf.cj:
724 resetCookieJar(conf.cj)
725
726 threadData = getCurrentThreadData()
727 threadData.reset()
728
729 conf.paramDict = {}
730 conf.parameters = {}
731 conf.hashDBFile = None
732
733 _setKnowledgeBaseAttributes(False)
734 _restoreMergedOptions()
735 _setDBMS()
736
737 if conf.data:
738 class _(six.text_type):
739 pass
740
741 kb.postUrlEncode = True
742
743 for key, value in conf.httpHeaders:
744 if key.upper() == HTTP_HEADER.CONTENT_TYPE.upper():
745 kb.postUrlEncode = "urlencoded" in value
746 break
747
748 if kb.postUrlEncode:
749 original = conf.data
750 conf.data = _(urldecode(conf.data))
751 setattr(conf.data, UNENCODED_ORIGINAL_VALUE, original)
752 kb.postSpaceToPlus = '+' in original
753
754 if conf.data and unArrayizeValue(conf.base64Parameter) == HTTPMETHOD.POST:
755 if '=' not in conf.data.strip('='):
756 try:
757 original = conf.data
758 conf.data = _(decodeBase64(conf.data, binary=False))
759 setattr(conf.data, UNENCODED_ORIGINAL_VALUE, original)
760 except:
761 pass
762
763 match = re.search(INJECT_HERE_REGEX, "%s %s %s" % (conf.url, conf.data, conf.httpHeaders))
764 kb.customInjectionMark = match.group(0) if match else CUSTOM_INJECTION_MARK_CHAR
765
766def setupTargetEnv():
767 _createTargetDirs()

Callers 1

startFunction · 0.90

Calls 12

resetCookieJarFunction · 0.90
getCurrentThreadDataFunction · 0.90
_setDBMSFunction · 0.90
urldecodeFunction · 0.90
unArrayizeValueFunction · 0.90
decodeBase64Function · 0.90
_restoreMergedOptionsFunction · 0.85
_Class · 0.70
closeMethod · 0.45
resetMethod · 0.45
searchMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…