-
-
Notifications
You must be signed in to change notification settings - Fork 450
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #197 from intelowlproject/develop
v1.7.1
- Loading branch information
Showing
16 changed files
with
169 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
api_app/script_analyzers/file_analyzers/xlm_macro_deobfuscator.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import logging | ||
from XLMMacroDeobfuscator.deobfuscator import process_file | ||
from api_app.script_analyzers.classes import FileAnalyzer | ||
from celery.exceptions import SoftTimeLimitExceeded | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class XlmMacroDeobfuscator(FileAnalyzer): | ||
def set_config(self, additional_config_params): | ||
self.passwords_to_check = [""] | ||
additional_passwords_to_check = additional_config_params.get( | ||
"passwords_to_check", [] | ||
) | ||
if isinstance(additional_passwords_to_check, list): | ||
self.passwords_to_check.extend(additional_passwords_to_check) | ||
elif isinstance(additional_passwords_to_check, str): | ||
self.passwords_to_check.append(additional_passwords_to_check) | ||
|
||
def run(self): | ||
results = {} | ||
try: | ||
for password in self.passwords_to_check: | ||
results = self.decrypt(password) | ||
if results: | ||
break | ||
if not results: | ||
results["error"] = "Can't decrypt with current passwords" | ||
except SoftTimeLimitExceeded: | ||
self._handle_base_exception("Soft Time Limit Exceeded") | ||
return results | ||
|
||
def decrypt(self, xlmpassword=""): | ||
args = { | ||
"file": self.filepath, | ||
"noindent": True, | ||
"nointeractive": True, | ||
"return_deobfuscated": True, | ||
"output_level": 3, | ||
} | ||
if xlmpassword: | ||
args["password"] = xlmpassword | ||
try: | ||
results = {"output": process_file(**args), "correct_password": xlmpassword} | ||
|
||
return results | ||
except Exception as e: | ||
if "Failed to decrypt" in str(e): | ||
return {} | ||
return {"errors": str(e)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.