about summary refs log tree commit diff
path: root/utils
diff options
context:
space:
mode:
authorDominik Maier <domenukk@gmail.com>2021-04-15 23:56:58 +0200
committerDominik Maier <domenukk@gmail.com>2021-04-15 23:56:58 +0200
commitc8e96e52536d47ee41967657202574d8e61562ee (patch)
treefb9ea197aa4b89d2c44f983cbd4ff0581af9e867 /utils
parent4f93220c4bfbffc51e18159d30e08884a4d7dfc1 (diff)
downloadafl++-c8e96e52536d47ee41967657202574d8e61562ee.tar.gz
autoformat with black
Diffstat (limited to 'utils')
-rw-r--r--utils/autodict_ql/autodict-ql.py154
-rw-r--r--utils/autodict_ql/litan.py126
-rw-r--r--utils/autodict_ql/memcmp-strings.py64
-rw-r--r--utils/autodict_ql/stan-strings.py64
-rw-r--r--utils/autodict_ql/strcmp-strings.py64
-rw-r--r--utils/autodict_ql/strncmp-strings.py64
6 files changed, 326 insertions, 210 deletions
diff --git a/utils/autodict_ql/autodict-ql.py b/utils/autodict_ql/autodict-ql.py
index 0fe7eabf..f64e3fae 100644
--- a/utils/autodict_ql/autodict-ql.py
+++ b/utils/autodict_ql/autodict-ql.py
@@ -11,7 +11,7 @@
 
 import os
 import string
-import binascii 
+import binascii
 import codecs
 import errno
 import struct
@@ -21,6 +21,7 @@ import subprocess
 
 from binascii import unhexlify
 
+
 def ensure_dir(dir):
     try:
         os.makedirs(dir)
@@ -28,109 +29,118 @@ def ensure_dir(dir):
         if e.errno != errno.EEXIST:
             raise
 
+
 def parse_args():
-    parser = argparse.ArgumentParser(description=(
-        "Helper - Specify input file analysis and output folder to save corpus for strings in the overall project ---------------------------------------------------------------------------  Example usage : python2 thisfile.py outdir str.txt"    ))
-    
-    #parser.add_argument("tokenpath",
-        #help="Destination directory for tokens")
-    parser.add_argument("cur",
-            help = "Current Path")
-    parser.add_argument("db",
-            help = "CodeQL database Path")
-    parser.add_argument("tokenpath",
-            help="Destination directory for tokens")
+    parser = argparse.ArgumentParser(
+        description=(
+            "Helper - Specify input file analysis and output folder to save corpus for strings in the overall project ---------------------------------------------------------------------------  Example usage : python2 thisfile.py outdir str.txt"
+        )
+    )
+
+    # parser.add_argument("tokenpath",
+    # help="Destination directory for tokens")
+    parser.add_argument("cur", help="Current Path")
+    parser.add_argument("db", help="CodeQL database Path")
+    parser.add_argument("tokenpath", help="Destination directory for tokens")
 
     return parser.parse_args()
 
-def static_analysis(file,file2,cur,db) :
-    with open(cur+"/"+file, "w") as f:
-        print(cur+"/"+file)
-        stream = os.popen("codeql query run " + cur +"/"+ file2 +  " -d " + db )
+
+def static_analysis(file, file2, cur, db):
+    with open(cur + "/" + file, "w") as f:
+        print(cur + "/" + file)
+        stream = os.popen("codeql query run " + cur + "/" + file2 + " -d " + db)
         output = stream.read()
         f.write(output)
         f.close()
 
-def copy_tokens(cur, tokenpath) :
-    subprocess.call(["mv " + cur  + "/" + "strcmp-strs/*" + " " + cur + "/" + tokenpath + "/."] ,shell=True)
-    subprocess.call(["mv " + cur  + "/" + "strncmp-strs/*" + " " + cur + "/" + tokenpath + "/."] ,shell=True)
-    subprocess.call(["mv " + cur  + "/" + "memcmp-strs/*" + " " + cur + "/" + tokenpath + "/."] ,shell=True)
-    subprocess.call(["mv " + cur  + "/" + "lits/*" + " " + cur + "/" + tokenpath + "/."] ,shell=True)
-    subprocess.call(["mv " + cur  + "/" + "strtool-strs/*" + " " + cur + "/" + tokenpath + "/."] ,shell=True)
-    subprocess.call(["rm -rf strcmp-strs memcmp-strs strncmp-strs lits strtool-strs"],shell=True)
-    subprocess.call(["rm *.out"],shell=True)
-    subprocess.call(["find "+tokenpath+" -size 0 -delete"],shell=True)
-
-
-
-def codeql_analysis(cur, db) :
-    static_analysis("litout.out","litool.ql", cur, db)
-    static_analysis("strcmp-strings.out","strcmp-str.ql", cur, db)
-    static_analysis("strncmp-strings.out","strncmp-str.ql", cur, db)
-    static_analysis("memcmp-strings.out","memcmp-str.ql", cur, db)
-    static_analysis("strtool-strings.out","strtool.ql", cur, db)
-    start_autodict(0,cur)
 
+def copy_tokens(cur, tokenpath):
+    subprocess.call(
+        ["mv " + cur + "/" + "strcmp-strs/*" + " " + cur + "/" + tokenpath + "/."],
+        shell=True,
+    )
+    subprocess.call(
+        ["mv " + cur + "/" + "strncmp-strs/*" + " " + cur + "/" + tokenpath + "/."],
+        shell=True,
+    )
+    subprocess.call(
+        ["mv " + cur + "/" + "memcmp-strs/*" + " " + cur + "/" + tokenpath + "/."],
+        shell=True,
+    )
+    subprocess.call(
+        ["mv " + cur + "/" + "lits/*" + " " + cur + "/" + tokenpath + "/."], shell=True
+    )
+    subprocess.call(
+        ["mv " + cur + "/" + "strtool-strs/*" + " " + cur + "/" + tokenpath + "/."],
+        shell=True,
+    )
+    subprocess.call(
+        ["rm -rf strcmp-strs memcmp-strs strncmp-strs lits strtool-strs"], shell=True
+    )
+    subprocess.call(["rm *.out"], shell=True)
+    subprocess.call(["find " + tokenpath + " -size 0 -delete"], shell=True)
+
+
+def codeql_analysis(cur, db):
+    static_analysis("litout.out", "litool.ql", cur, db)
+    static_analysis("strcmp-strings.out", "strcmp-str.ql", cur, db)
+    static_analysis("strncmp-strings.out", "strncmp-str.ql", cur, db)
+    static_analysis("memcmp-strings.out", "memcmp-str.ql", cur, db)
+    static_analysis("strtool-strings.out", "strtool.ql", cur, db)
+    start_autodict(0, cur)
 
 
 def start_autodict(tokenpath, cur):
-    command = [
-           'python3',
-           cur + '/litan.py',
-           cur+'/lits/',
-           cur+'/litout.out'
-        ]
+    command = ["python3", cur + "/litan.py", cur + "/lits/", cur + "/litout.out"]
     worker1 = subprocess.Popen(command)
     print(worker1.communicate())
-    
+
     command1 = [
-           'python3',
-           cur + '/strcmp-strings.py',
-           cur + '/strcmp-strs/',
-           cur + '/strcmp-strings.out'
-        ]
+        "python3",
+        cur + "/strcmp-strings.py",
+        cur + "/strcmp-strs/",
+        cur + "/strcmp-strings.out",
+    ]
     worker2 = subprocess.Popen(command1)
     print(worker2.communicate())
 
     command2 = [
-           'python3',
-           cur + '/strncmp-strings.py',
-           cur + '/strncmp-strs/',
-           cur + '/strncmp-strings.out'
-        ]
+        "python3",
+        cur + "/strncmp-strings.py",
+        cur + "/strncmp-strs/",
+        cur + "/strncmp-strings.out",
+    ]
     worker3 = subprocess.Popen(command2)
     print(worker3.communicate())
 
-
-
     command5 = [
-           'python3',
-           cur + '/memcmp-strings.py',
-           cur + '/memcmp-strs/',
-           cur + '/memcmp-strings.out'
-        ]
+        "python3",
+        cur + "/memcmp-strings.py",
+        cur + "/memcmp-strs/",
+        cur + "/memcmp-strings.out",
+    ]
     worker6 = subprocess.Popen(command5)
     print(worker6.communicate())
 
-
-
     command8 = [
-           'python3',
-           cur + '/stan-strings.py',
-           cur + '/strtool-strs/',
-           cur + '/strtool-strings.out'
-        ]
+        "python3",
+        cur + "/stan-strings.py",
+        cur + "/strtool-strs/",
+        cur + "/strtool-strings.out",
+    ]
     worker9 = subprocess.Popen(command8)
     print(worker9.communicate())
 
 
-
 def main():
-    args = parse_args()    
+    args = parse_args()
     ensure_dir(args.tokenpath)
-    #copy_tokens(args.cur, args.tokenpath)
+    # copy_tokens(args.cur, args.tokenpath)
     codeql_analysis(args.cur, args.db)
     copy_tokens(args.cur, args.tokenpath)
-    #start_autodict(args.tokenpath, args.cur)
-if __name__ == '__main__':
-    main()
\ No newline at end of file
+    # start_autodict(args.tokenpath, args.cur)
+
+
+if __name__ == "__main__":
+    main()
diff --git a/utils/autodict_ql/litan.py b/utils/autodict_ql/litan.py
index 18c04c34..7033d363 100644
--- a/utils/autodict_ql/litan.py
+++ b/utils/autodict_ql/litan.py
@@ -4,7 +4,7 @@
 # Author : Microsvuln - Arash.vre@gmail.com
 import string
 import os
-import binascii 
+import binascii
 import codecs
 import struct
 import errno
@@ -12,75 +12,101 @@ import argparse
 import re
 import base64
 from binascii import unhexlify
+
+
 def parse_args():
-    parser = argparse.ArgumentParser(description=(
-        "Helper - Specify input file to analysis and output folder to save corpdirus for constants in the overall project -------  Example usage : python2 thisfile.py outdir o.txt"))
-    parser.add_argument("corpdir",
-        help="The path to the corpus directory to generate files.")
-    parser.add_argument("infile",
-        help="Specify file output of codeql analysis - ex. ooo-hex.txt, analysis take place on this file, example : python2 thisfile.py outdir out.txt")
-    return parser.parse_args()    
+    parser = argparse.ArgumentParser(
+        description=(
+            "Helper - Specify input file to analysis and output folder to save corpdirus for constants in the overall project -------  Example usage : python2 thisfile.py outdir o.txt"
+        )
+    )
+    parser.add_argument(
+        "corpdir", help="The path to the corpus directory to generate files."
+    )
+    parser.add_argument(
+        "infile",
+        help="Specify file output of codeql analysis - ex. ooo-hex.txt, analysis take place on this file, example : python2 thisfile.py outdir out.txt",
+    )
+    return parser.parse_args()
+
+
 def ensure_dir(dir):
     try:
         os.makedirs(dir)
     except OSError as e:
         if e.errno == errno.EEXIST:
-            #print "[-] Directory exists, specify another directory"
+            # print "[-] Directory exists, specify another directory"
             exit(1)
+
+
 def do_analysis1(corpdir, infile):
-    with open(infile, "rb") as f:        
-        lines = f.readlines()[1:]       
-        f.close()       
+    with open(infile, "rb") as f:
+        lines = f.readlines()[1:]
+        f.close()
         new_lst = []
         n = 1
         for i, num in enumerate(lines):
             if i != 0:
-                new_lst.append(num)                               
+                new_lst.append(num)
                 str1 = str(num)
-                print ("num is " + str1)
-                str1 = str1.rstrip('\n\n')
-                #str1 = str1.replace("0x","");
-                str1 = str1.replace("|","")
-                str1 = str1.rstrip('\r\n')
-                str1 = str1.rstrip('\n')
-                str1 = str1.replace(" ","")
-                    #str1 = str1.translate(None, string.punctuation)
-                translator=str.maketrans('','',string.punctuation)
-                str1=str1.translate(translator)
+                print("num is " + str1)
+                str1 = str1.rstrip("\n\n")
+                # str1 = str1.replace("0x","");
+                str1 = str1.replace("|", "")
+                str1 = str1.rstrip("\r\n")
+                str1 = str1.rstrip("\n")
+                str1 = str1.replace(" ", "")
+                # str1 = str1.translate(None, string.punctuation)
+                translator = str.maketrans("", "", string.punctuation)
+                str1 = str1.translate(translator)
                 str1 = str1[1:]
                 str1 = str1[:-1]
                 print("After cleanup : " + str1)
-                if (str1 != '0') and (str1 != 'ffffffff') and (str1 != 'fffffffe') or (len(str1) == 4) or (len(str1) == 8):
-                    print ("first : "+str1)
-                    if len(str1) > 8 :
+                if (
+                    (str1 != "0")
+                    and (str1 != "ffffffff")
+                    and (str1 != "fffffffe")
+                    or (len(str1) == 4)
+                    or (len(str1) == 8)
+                ):
+                    print("first : " + str1)
+                    if len(str1) > 8:
                         str1 = str1[:-1]
-                    elif (len(str1) == 5) :
+                    elif len(str1) == 5:
                         str1 = str1 = "0"
                     try:
-                            #str1 = str1.decode("hex")
-                            with open(corpdir+'/lit-seed{0}'.format(n), 'w') as file:                    
-                                    str1 = str1.replace("0x","");
-                                    print (str1)                                    
-                                    str1 = int(str1,base=16)                                    
-                                    str1 = str1.to_bytes(4, byteorder='little')                                                          
-                                    file.write(str(str1))                                    
-                                    file.close()
-                                    with open (corpdir+'/lit-seed{0}'.format(n), 'r') as q :
-                                        a = q.readline()                                        
-                                        a = a[1:]
-                                        print ("AFL++ Autodict-QL by Microsvuln : Writing Token :" + str(a))
-                                        q.close()
-                                        with open (corpdir+'/lit-seed{0}'.format(n), 'w') as w1 :
-                                                w1.write(str(a))
-                                                print ("Done!")
-                                                w1.close()                                                                                
-                    except:                                 
-                            print("Error!") 
-                    n = n+1
+                        # str1 = str1.decode("hex")
+                        with open(corpdir + "/lit-seed{0}".format(n), "w") as file:
+                            str1 = str1.replace("0x", "")
+                            print(str1)
+                            str1 = int(str1, base=16)
+                            str1 = str1.to_bytes(4, byteorder="little")
+                            file.write(str(str1))
+                            file.close()
+                            with open(corpdir + "/lit-seed{0}".format(n), "r") as q:
+                                a = q.readline()
+                                a = a[1:]
+                                print(
+                                    "AFL++ Autodict-QL by Microsvuln : Writing Token :"
+                                    + str(a)
+                                )
+                                q.close()
+                                with open(
+                                    corpdir + "/lit-seed{0}".format(n), "w"
+                                ) as w1:
+                                    w1.write(str(a))
+                                    print("Done!")
+                                    w1.close()
+                    except:
+                        print("Error!")
+                    n = n + 1
+
 
 def main():
-    args = parse_args()    
+    args = parse_args()
     ensure_dir(args.corpdir)
     do_analysis1(args.corpdir, args.infile)
-if __name__ == '__main__':
-    main()
\ No newline at end of file
+
+
+if __name__ == "__main__":
+    main()
diff --git a/utils/autodict_ql/memcmp-strings.py b/utils/autodict_ql/memcmp-strings.py
index d1047caa..270a697c 100644
--- a/utils/autodict_ql/memcmp-strings.py
+++ b/utils/autodict_ql/memcmp-strings.py
@@ -5,7 +5,7 @@
 
 import os
 import string
-import binascii 
+import binascii
 import codecs
 import errno
 import struct
@@ -13,6 +13,7 @@ import argparse
 import re
 from binascii import unhexlify
 
+
 def ensure_dir(dir):
     try:
         os.makedirs(dir)
@@ -20,44 +21,63 @@ def ensure_dir(dir):
         if e.errno != errno.EEXIST:
             raise
 
+
 def parse_args():
-    parser = argparse.ArgumentParser(description=(
-        "Helper - Specify input file analysis and output folder to save corpus for strings in the overall project ---------------------------------------------------------------------------  Example usage : python2 thisfile.py outdir str.txt"    ))
-    parser.add_argument("corpdir",
-        help="The path to the corpus directory to generate strings.")
-    parser.add_argument("infile",
-        help="Specify file output of codeql analysis - ex. ooo-atr.txt, analysis take place on this file, example : python2 thisfile.py outdir strings.txt")
+    parser = argparse.ArgumentParser(
+        description=(
+            "Helper - Specify input file analysis and output folder to save corpus for strings in the overall project ---------------------------------------------------------------------------  Example usage : python2 thisfile.py outdir str.txt"
+        )
+    )
+    parser.add_argument(
+        "corpdir", help="The path to the corpus directory to generate strings."
+    )
+    parser.add_argument(
+        "infile",
+        help="Specify file output of codeql analysis - ex. ooo-atr.txt, analysis take place on this file, example : python2 thisfile.py outdir strings.txt",
+    )
 
     return parser.parse_args()
 
 
 def do_string_analysis(corpdir, infile1):
-    with open(infile1, "r") as f1:        
-        lines = f1.readlines()[1:]       
-        f1.close()       
+    with open(infile1, "r") as f1:
+        lines = f1.readlines()[1:]
+        f1.close()
         new_lst1 = []
         n = 1
         for i, num1 in enumerate(lines):
             if i != 0:
                 new_lst1.append(num1)
-                #print("num : %s" % num1)
+                # print("num : %s" % num1)
                 str11 = str(num1)
-                str11 = str11.replace("|","")
-                str11 = str11.replace("\n","")
+                str11 = str11.replace("|", "")
+                str11 = str11.replace("\n", "")
                 str11 = str11.lstrip()
                 str11 = str11.rstrip()
                 str11 = str(str11)
-                if ((" " in str11 ) or (")" in str11) or ("(" in str11) or ("<" in str11) or (">" in str11)) :
+                if (
+                    (" " in str11)
+                    or (")" in str11)
+                    or ("(" in str11)
+                    or ("<" in str11)
+                    or (">" in str11)
+                ):
                     print("Space / Paranthesis String : %s" % str11)
-                else :
-                    with open(corpdir+'/memcmp-str{0}'.format(n), 'w') as file:                    
-                            file.write(str11)
-                            print("AFL++ Autodict-QL by Microsvuln : Writing Token : %s" % str11)
-                            n=n+1
+                else:
+                    with open(corpdir + "/memcmp-str{0}".format(n), "w") as file:
+                        file.write(str11)
+                        print(
+                            "AFL++ Autodict-QL by Microsvuln : Writing Token : %s"
+                            % str11
+                        )
+                        n = n + 1
+
 
 def main():
-    args = parse_args()    
+    args = parse_args()
     ensure_dir(args.corpdir)
     do_string_analysis(args.corpdir, args.infile)
-if __name__ == '__main__':
-    main()
\ No newline at end of file
+
+
+if __name__ == "__main__":
+    main()
diff --git a/utils/autodict_ql/stan-strings.py b/utils/autodict_ql/stan-strings.py
index 65d08c97..81cb0b97 100644
--- a/utils/autodict_ql/stan-strings.py
+++ b/utils/autodict_ql/stan-strings.py
@@ -5,7 +5,7 @@
 
 import os
 import string
-import binascii 
+import binascii
 import codecs
 import errno
 import struct
@@ -13,6 +13,7 @@ import argparse
 import re
 from binascii import unhexlify
 
+
 def ensure_dir(dir):
     try:
         os.makedirs(dir)
@@ -20,44 +21,63 @@ def ensure_dir(dir):
         if e.errno != errno.EEXIST:
             raise
 
+
 def parse_args():
-    parser = argparse.ArgumentParser(description=(
-        "Helper - Specify input file analysis and output folder to save corpus for strings in the overall project ---------------------------------------------------------------------------  Example usage : python2 thisfile.py outdir str.txt"    ))
-    parser.add_argument("corpdir",
-        help="The path to the corpus directory to generate strings.")
-    parser.add_argument("infile",
-        help="Specify file output of codeql analysis - ex. ooo-atr.txt, analysis take place on this file, example : python2 thisfile.py outdir strings.txt")
+    parser = argparse.ArgumentParser(
+        description=(
+            "Helper - Specify input file analysis and output folder to save corpus for strings in the overall project ---------------------------------------------------------------------------  Example usage : python2 thisfile.py outdir str.txt"
+        )
+    )
+    parser.add_argument(
+        "corpdir", help="The path to the corpus directory to generate strings."
+    )
+    parser.add_argument(
+        "infile",
+        help="Specify file output of codeql analysis - ex. ooo-atr.txt, analysis take place on this file, example : python2 thisfile.py outdir strings.txt",
+    )
 
     return parser.parse_args()
 
 
 def do_string_analysis(corpdir, infile1):
-    with open(infile1, "r") as f1:        
-        lines = f1.readlines()[1:]       
-        f1.close()       
+    with open(infile1, "r") as f1:
+        lines = f1.readlines()[1:]
+        f1.close()
         new_lst1 = []
         n = 1
         for i, num1 in enumerate(lines):
             if i != 0:
                 new_lst1.append(num1)
-                #print("num : %s" % num1)
+                # print("num : %s" % num1)
                 str11 = str(num1)
-                str11 = str11.replace("|","")
-                str11 = str11.replace("\n","")
+                str11 = str11.replace("|", "")
+                str11 = str11.replace("\n", "")
                 str11 = str11.lstrip()
                 str11 = str11.rstrip()
                 str11 = str(str11)
-                if ((" " in str11 ) or (")" in str11) or ("(" in str11) or ("<" in str11) or (">" in str11)) :
+                if (
+                    (" " in str11)
+                    or (")" in str11)
+                    or ("(" in str11)
+                    or ("<" in str11)
+                    or (">" in str11)
+                ):
                     print("Space / Paranthesis String : %s" % str11)
-                else :
-                    with open(corpdir+'/seed-str{0}'.format(n), 'w') as file:                    
-                            file.write(str11)
-                            print("AFL++ Autodict-QL by Microsvuln : Writing Token : %s" % str11)
-                            n=n+1
+                else:
+                    with open(corpdir + "/seed-str{0}".format(n), "w") as file:
+                        file.write(str11)
+                        print(
+                            "AFL++ Autodict-QL by Microsvuln : Writing Token : %s"
+                            % str11
+                        )
+                        n = n + 1
+
 
 def main():
-    args = parse_args()    
+    args = parse_args()
     ensure_dir(args.corpdir)
     do_string_analysis(args.corpdir, args.infile)
-if __name__ == '__main__':
-    main()
\ No newline at end of file
+
+
+if __name__ == "__main__":
+    main()
diff --git a/utils/autodict_ql/strcmp-strings.py b/utils/autodict_ql/strcmp-strings.py
index 88128dbb..9c2520c9 100644
--- a/utils/autodict_ql/strcmp-strings.py
+++ b/utils/autodict_ql/strcmp-strings.py
@@ -5,7 +5,7 @@
 
 import os
 import string
-import binascii 
+import binascii
 import codecs
 import errno
 import struct
@@ -13,6 +13,7 @@ import argparse
 import re
 from binascii import unhexlify
 
+
 def ensure_dir(dir):
     try:
         os.makedirs(dir)
@@ -20,44 +21,63 @@ def ensure_dir(dir):
         if e.errno != errno.EEXIST:
             raise
 
+
 def parse_args():
-    parser = argparse.ArgumentParser(description=(
-        "Helper - Specify input file analysis and output folder to save corpus for strings in the overall project ---------------------------------------------------------------------------  Example usage : python2 thisfile.py outdir str.txt"    ))
-    parser.add_argument("corpdir",
-        help="The path to the corpus directory to generate strings.")
-    parser.add_argument("infile",
-        help="Specify file output of codeql analysis - ex. ooo-atr.txt, analysis take place on this file, example : python2 thisfile.py outdir strings.txt")
+    parser = argparse.ArgumentParser(
+        description=(
+            "Helper - Specify input file analysis and output folder to save corpus for strings in the overall project ---------------------------------------------------------------------------  Example usage : python2 thisfile.py outdir str.txt"
+        )
+    )
+    parser.add_argument(
+        "corpdir", help="The path to the corpus directory to generate strings."
+    )
+    parser.add_argument(
+        "infile",
+        help="Specify file output of codeql analysis - ex. ooo-atr.txt, analysis take place on this file, example : python2 thisfile.py outdir strings.txt",
+    )
 
     return parser.parse_args()
 
 
 def do_string_analysis(corpdir, infile1):
-    with open(infile1, "r") as f1:        
-        lines = f1.readlines()[1:]       
-        f1.close()       
+    with open(infile1, "r") as f1:
+        lines = f1.readlines()[1:]
+        f1.close()
         new_lst1 = []
         n = 1
         for i, num1 in enumerate(lines):
             if i != 0:
                 new_lst1.append(num1)
-                #print("num : %s" % num1)
+                # print("num : %s" % num1)
                 str11 = str(num1)
-                str11 = str11.replace("|","")
-                str11 = str11.replace("\n","")
+                str11 = str11.replace("|", "")
+                str11 = str11.replace("\n", "")
                 str11 = str11.lstrip()
                 str11 = str11.rstrip()
                 str11 = str(str11)
-                if ((" " in str11 ) or (")" in str11) or ("(" in str11) or ("<" in str11) or (">" in str11)) :
+                if (
+                    (" " in str11)
+                    or (")" in str11)
+                    or ("(" in str11)
+                    or ("<" in str11)
+                    or (">" in str11)
+                ):
                     print("Space / Paranthesis String : %s" % str11)
-                else :
-                    with open(corpdir+'/strcmp-str{0}'.format(n), 'w') as file:                    
-                            file.write(str11)
-                            print("AFL++ Autodict-QL by Microsvuln : Writing Token : %s" % str11)
-                            n=n+1
+                else:
+                    with open(corpdir + "/strcmp-str{0}".format(n), "w") as file:
+                        file.write(str11)
+                        print(
+                            "AFL++ Autodict-QL by Microsvuln : Writing Token : %s"
+                            % str11
+                        )
+                        n = n + 1
+
 
 def main():
-    args = parse_args()    
+    args = parse_args()
     ensure_dir(args.corpdir)
     do_string_analysis(args.corpdir, args.infile)
-if __name__ == '__main__':
-    main()
\ No newline at end of file
+
+
+if __name__ == "__main__":
+    main()
diff --git a/utils/autodict_ql/strncmp-strings.py b/utils/autodict_ql/strncmp-strings.py
index 0ad0e697..6206b4c4 100644
--- a/utils/autodict_ql/strncmp-strings.py
+++ b/utils/autodict_ql/strncmp-strings.py
@@ -5,7 +5,7 @@
 
 import os
 import string
-import binascii 
+import binascii
 import codecs
 import errno
 import struct
@@ -13,6 +13,7 @@ import argparse
 import re
 from binascii import unhexlify
 
+
 def ensure_dir(dir):
     try:
         os.makedirs(dir)
@@ -20,44 +21,63 @@ def ensure_dir(dir):
         if e.errno != errno.EEXIST:
             raise
 
+
 def parse_args():
-    parser = argparse.ArgumentParser(description=(
-        "Helper - Specify input file analysis and output folder to save corpus for strings in the overall project ---------------------------------------------------------------------------  Example usage : python2 thisfile.py outdir str.txt"    ))
-    parser.add_argument("corpdir",
-        help="The path to the corpus directory to generate strings.")
-    parser.add_argument("infile",
-        help="Specify file output of codeql analysis - ex. ooo-atr.txt, analysis take place on this file, example : python2 thisfile.py outdir strings.txt")
+    parser = argparse.ArgumentParser(
+        description=(
+            "Helper - Specify input file analysis and output folder to save corpus for strings in the overall project ---------------------------------------------------------------------------  Example usage : python2 thisfile.py outdir str.txt"
+        )
+    )
+    parser.add_argument(
+        "corpdir", help="The path to the corpus directory to generate strings."
+    )
+    parser.add_argument(
+        "infile",
+        help="Specify file output of codeql analysis - ex. ooo-atr.txt, analysis take place on this file, example : python2 thisfile.py outdir strings.txt",
+    )
 
     return parser.parse_args()
 
 
 def do_string_analysis(corpdir, infile1):
-    with open(infile1, "r") as f1:        
-        lines = f1.readlines()[1:]       
-        f1.close()       
+    with open(infile1, "r") as f1:
+        lines = f1.readlines()[1:]
+        f1.close()
         new_lst1 = []
         n = 1
         for i, num1 in enumerate(lines):
             if i != 0:
                 new_lst1.append(num1)
-                #print("num : %s" % num1)
+                # print("num : %s" % num1)
                 str11 = str(num1)
-                str11 = str11.replace("|","")
-                str11 = str11.replace("\n","")
+                str11 = str11.replace("|", "")
+                str11 = str11.replace("\n", "")
                 str11 = str11.lstrip()
                 str11 = str11.rstrip()
                 str11 = str(str11)
-                if ((" " in str11 ) or (")" in str11) or ("(" in str11) or ("<" in str11) or (">" in str11)) :
+                if (
+                    (" " in str11)
+                    or (")" in str11)
+                    or ("(" in str11)
+                    or ("<" in str11)
+                    or (">" in str11)
+                ):
                     print("Space / Paranthesis String : %s" % str11)
-                else :
-                    with open(corpdir+'/strncmp-str{0}'.format(n), 'w') as file:                    
-                            file.write(str11)
-                            print("AFL++ Autodict-QL by Microsvuln : Writing Token : %s" % str11)
-                            n=n+1
+                else:
+                    with open(corpdir + "/strncmp-str{0}".format(n), "w") as file:
+                        file.write(str11)
+                        print(
+                            "AFL++ Autodict-QL by Microsvuln : Writing Token : %s"
+                            % str11
+                        )
+                        n = n + 1
+
 
 def main():
-    args = parse_args()    
+    args = parse_args()
     ensure_dir(args.corpdir)
     do_string_analysis(args.corpdir, args.infile)
-if __name__ == '__main__':
-    main()
\ No newline at end of file
+
+
+if __name__ == "__main__":
+    main()