diff --git a/data/enhanced-c.bestType b/data/enhanced-c.bestType index ac09942..36bd812 100644 Binary files a/data/enhanced-c.bestType and b/data/enhanced-c.bestType differ diff --git a/data/enhanced-c.encodings b/data/enhanced-c.encodings index bcc309d..5e3bc16 100644 --- a/data/enhanced-c.encodings +++ b/data/enhanced-c.encodings @@ -1 +1 @@ -{"char2int": {"": 0, "": 1, "{": 2, "+": 3, "c": 4, "r": 5, "e": 6, "a": 7, "m": 8, "i": 9, "l": 10, "y": 11, "}": 12, " ": 13, "$": 14, "5": 15, "f": 16, "9": 17, "1": 18, "3": 19, "8": 20, "2": 21, "-": 22, "7": 23, "0": 24, "4": 25, "d": 26, "6": 27, "b": 28, "x": 29, "t": 30, "w": 31, "u": 32, "v": 33, "n": 34, "h": 35, "o": 36, "%": 37, "q": 38, "<": 39, "s": 40, "g": 41, "/": 42, "p": 43, "#": 44, "j": 45, "k": 46, "z": 47, ".": 48, "_": 49, ":": 50, "*": 51, "=": 52, ",": 53, "&": 54, "'": 55, "?": 56, "\"": 57, ">": 58, "!": 59, "(": 60, ")": 61, "\\": 62, "[": 63, "]": 64, "|": 65, "`": 66, "~": 67, ";": 68, "@": 69}, "label2int": {"": 0, "C": 1, "U": 2, "H": 3, "J": 4, "N": 5, "I": 6}} \ No newline at end of file +{"char2int": {"": 0, "": 1, "(": 2, "+": 3, "r": 4, "e": 5, "t": 6, "o": 7, "m": 8, "b": 9, ")": 10, "-": 11, "n": 12, "u": 13, "s": 14, "i": 15, "j": 16, "h": 17, "g": 18, "c": 19, "z": 20, "1": 21, "5": 22, "6": 23, "k": 24, "p": 25, "x": 26, "v": 27, "9": 28, ".": 29, "y": 30, "a": 31, "w": 32, "2": 33, "d": 34, "f": 35, "0": 36, "q": 37, "l": 38, "3": 39, "4": 40, "8": 41, "_": 42, "7": 43, " ": 44, "[": 45, "]": 46, "'": 47, "%": 48, ",": 49, "!": 50, "$": 51, "\\": 52, "#": 53, "~": 54, "<": 55, "@": 56, "=": 57, ":": 58, "{": 59, "}": 60, "?": 61, ";": 62, "\"": 63, "&": 64, "|": 65, "/": 66, "`": 67, ">": 68, "*": 69}, "label2int": {"": 0, "C": 1, "J": 2, "H": 3, "N": 4, "U": 5, "I": 6}} \ No newline at end of file diff --git a/data/enhanced-c.last b/data/enhanced-c.last index 0a9cfef..2dbb412 100644 Binary files a/data/enhanced-c.last and b/data/enhanced-c.last differ diff --git a/setup.py b/setup.py index d730c1b..aab518a 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ def parse_requirements(filename, session=None): setuptools.setup( name="stringlifier", - version="0.1.1.4", + version="0.1.1.5", author="Multiple authors", author_email="tiberiu44@gmail.com", description="Python module for detecting password, api keys hashes and any other string that resembles a randomly generated character sequence.", diff --git a/stringlifier/api.py b/stringlifier/api.py index 0d93b09..9f23af9 100644 --- a/stringlifier/api.py +++ b/stringlifier/api.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2020 Adobe Systems Incorporated. All rights reserved. +# Copyright (c) 2025 Adobe Systems Incorporated. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/stringlifier/modules/stringc.py b/stringlifier/modules/stringc.py index 7270cc1..afa6385 100644 --- a/stringlifier/modules/stringc.py +++ b/stringlifier/modules/stringc.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2020 Adobe Systems Incorporated. All rights reserved. +# Copyright (c) 2025 Adobe Systems Incorporated. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -267,7 +267,7 @@ def _start_train(params): model.to(params.device) if params.resume: model.load('{0}.last'.format(params.output_base)) - optimizer = torch.optim.Adam(model.parameters()) + optimizer = torch.optim.Adam(model.parameters(), lr=params.lr) criterion_t = torch.nn.CrossEntropyLoss() criterion_st = torch.nn.CrossEntropyLoss(ignore_index=0) # we ignore unknown types @@ -383,6 +383,7 @@ def _start_interactive(params): parser.add_option('--patience', action='store', dest='patience', type='int', default=20, help='(default=20)') parser.add_option('--batch-size', action='store', dest='batch_size', default=32, type='int', help='(default=32)') parser.add_option('--device', action='store', dest='device', default='cpu') + parser.add_option('--lr', action='store', dest='lr', type='int', default=1e-4, help='(default=1e-4)') (params, _) = parser.parse_args(sys.argv) diff --git a/stringlifier/modules/stringc2.py b/stringlifier/modules/stringc2.py index 09250aa..e474ac0 100644 --- a/stringlifier/modules/stringc2.py +++ b/stringlifier/modules/stringc2.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2020 Adobe Systems Incorporated. All rights reserved. +# Copyright (c) 2025 Adobe Systems Incorporated. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -215,7 +215,7 @@ def _make_batches(dataset, batch_size=32): def _get_targets(y, encodings): max_len = max([len(yy) for yy in y]) - y_t = np.zeros((len(y), max_len), dtype=np.long) + y_t = np.zeros((len(y), max_len), dtype=np.int64) for i in range(len(y)): for j in range(max_len): if j < len(y[i]): @@ -256,7 +256,7 @@ def _start_train(params): model.to(params.device) if params.resume: model.load('{0}.last'.format(params.output_base)) - optimizer = torch.optim.Adam(model.parameters()) + optimizer = torch.optim.Adam(model.parameters(), lr=params.lr) criterion_t = torch.nn.CrossEntropyLoss(ignore_index=0) patience_left = params.patience @@ -372,6 +372,7 @@ def _start_interactive(params): parser.add_option('--patience', action='store', dest='patience', type='int', default=20, help='(default=20)') parser.add_option('--batch-size', action='store', dest='batch_size', default=32, type='int', help='(default=32)') parser.add_option('--device', action='store', dest='device', default='cpu') + parser.add_option('--lr', action='store', dest='lr', type='int', default=1e-4, help='(default=1e-4)') (params, _) = parser.parse_args(sys.argv) diff --git a/stringlifier/modules/training.py b/stringlifier/modules/training.py index d51bd69..0da091b 100644 --- a/stringlifier/modules/training.py +++ b/stringlifier/modules/training.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2020 Adobe Systems Incorporated. All rights reserved. +# Copyright (c) 2025 Adobe Systems Incorporated. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.