MCPcopy Create free account
hub / github.com/sqlmapproject/sqlmap / load_data

Function load_data

thirdparty/identywaf/identYwaf.py:337–355  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

335 setattr(options, key, DEFAULTS[key])
336
337def load_data():
338 global WAF_RECOGNITION_REGEX
339
340 if os.path.isfile(DATA_JSON_FILE):
341 with open(DATA_JSON_FILE, "r") as f:
342 DATA_JSON.update(json.load(f))
343
344 WAF_RECOGNITION_REGEX = ""
345 for waf in DATA_JSON["wafs"]:
346 if DATA_JSON["wafs"][waf]["regex"]:
347 WAF_RECOGNITION_REGEX += "%s|" % ("(?P<waf_%s>%s)" % (waf, DATA_JSON["wafs"][waf]["regex"]))
348 for signature in DATA_JSON["wafs"][waf]["signatures"]:
349 SIGNATURES[signature] = waf
350 WAF_RECOGNITION_REGEX = WAF_RECOGNITION_REGEX.strip('|')
351
352 flags = "".join(set(_ for _ in "".join(re.findall(r"\(\?(\w+)\)", WAF_RECOGNITION_REGEX))))
353 WAF_RECOGNITION_REGEX = "(?%s)%s" % (flags, re.sub(r"\(\?\w+\)", "", WAF_RECOGNITION_REGEX)) # patch for "DeprecationWarning: Flags not at the start of the expression" in Python3.7
354 else:
355 exit(colorize("[x] file '%s' is missing" % DATA_JSON_FILE))
356
357def init():
358 os.chdir(os.path.abspath(os.path.dirname(__file__)))

Callers 1

identYwaf.pyFile · 0.85

Calls 4

exitFunction · 0.85
colorizeFunction · 0.85
loadMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…