-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Makes FCT scanner detect marshal.loads format as well - Reformats ast matches to use a more consistent indentation style, and removes Load() and Store() context and other extraneous information - Removes deprecated TextIO imports Signed-off-by: stickie <[email protected]>
- Loading branch information
1 parent
48fdbb0
commit f27ab80
Showing
6 changed files
with
82 additions
and
77 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,6 @@ | |
import codecs | ||
import lzma | ||
import re | ||
from typing import TextIO | ||
|
||
from ..utils import WEBHOOK_REGEX | ||
|
||
|
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 |
---|---|---|
|
@@ -9,7 +9,6 @@ | |
import marshal | ||
import re | ||
import zlib | ||
from typing import TextIO | ||
|
||
from cryptography.fernet import Fernet | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,41 @@ | ||
import ast | ||
import re | ||
from ast import Assign, Constant, Load, Name, Store, Tuple | ||
from ast import Assign, Constant, Name, Tuple | ||
|
||
|
||
class HyperionScanner(ast.NodeVisitor): | ||
def __init__(self): | ||
self.characteristic_found = False | ||
self.signature_found = False | ||
|
||
def visit_Assign(self, node): | ||
match node: | ||
case Assign( | ||
targets=[ | ||
Name(id='__obfuscator__', ctx=Store())], | ||
targets=[Name(id='__obfuscator__')], | ||
value=Constant(value='Hyperion'), | ||
) | Assign( | ||
targets=[ | ||
Name(id='__authors__', ctx=Store())], | ||
targets=[Name(id='__authors__')], | ||
value=Tuple( | ||
elts=[ | ||
Constant(value='billythegoat356'), | ||
Constant(value='BlueRed')], | ||
ctx=Load()) | ||
Constant(value='billythegoat356'), | ||
Constant(value='BlueRed') | ||
], | ||
) | ||
) | Assign( | ||
targets=[ | ||
Name(id='__github__', ctx=Store())], | ||
targets=[Name(id='__github__')], | ||
value=Constant(value='https://github.com/billythegoat356/Hyperion') | ||
): | ||
self.characteristic_found = True | ||
self.signature_found = True | ||
return | ||
|
||
|
||
COMMENT_REGEX = re.compile( | ||
r'# sourcery skip: collection-to-bool, remove-redundant-boolean, remove-redundant-except-handler' | ||
) | ||
|
||
|
||
def scan_hyperion(code: str): | ||
if COMMENT_REGEX.search(code): | ||
return True | ||
hyp_scanner = HyperionScanner() | ||
hyp_scanner.visit(ast.parse(code)) | ||
return hyp_scanner.characteristic_found | ||
return hyp_scanner.signature_found |
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