Skip to content

Commit

Permalink
Minor update (for importing)
Browse files Browse the repository at this point in the history
  • Loading branch information
stamparm committed May 24, 2019
1 parent 22b16c9 commit 6faae05
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions identYwaf.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys.stdout)

NAME = "identYwaf"
VERSION = "1.0.108"
VERSION = "1.0.109"
BANNER = """
` __ __ `
____ ___ ___ ____ ______ `| T T` __ __ ____ _____
Expand All @@ -87,7 +87,7 @@
PAYLOADS = []
SIGNATURES = {}
DATA_JSON = {}
DATA_JSON_FILE = "data.json"
DATA_JSON_FILE = os.path.join(os.path.dirname(__file__), "data.json")
MAX_HELP_OPTION_LENGTH = 18
IS_TTY = sys.stdout.isatty()
COLORIZE = not IS_WIN and IS_TTY
Expand Down Expand Up @@ -339,14 +339,10 @@ def _(self, *args):
if getattr(options, key, None) is None:
setattr(options, key, DEFAULTS[key])

def init():
def load_data():
global WAF_RECOGNITION_REGEX

os.chdir(os.path.abspath(os.path.dirname(__file__)))

if os.path.isfile(DATA_JSON_FILE):
print(colorize("[o] loading data..."))

with codecs.open(DATA_JSON_FILE, "rb", encoding="utf8") as f:
DATA_JSON.update(json.load(f))

Expand All @@ -363,6 +359,9 @@ def init():
else:
exit(colorize("[x] file '%s' is missing" % DATA_JSON_FILE))

def init():
os.chdir(os.path.abspath(os.path.dirname(__file__)))

print(colorize("[o] initializing handlers..."))

# Reference: https://stackoverflow.com/a/28052583
Expand Down Expand Up @@ -577,6 +576,8 @@ def main():
init()
run()

load_data()

if __name__ == "__main__":
try:
main()
Expand Down

0 comments on commit 6faae05

Please sign in to comment.