Intitial release
This commit is contained in:
parent
299038fbc7
commit
fa8caa5116
21 changed files with 1234 additions and 0 deletions
17
utils/blank.py
Normal file
17
utils/blank.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
from base64 import b64decode
|
||||
from re import findall
|
||||
|
||||
from constants.regex import WEBHOOK_REGEX
|
||||
|
||||
def base64_decode_then_filter(encoded_strings):
|
||||
results = []
|
||||
|
||||
for encoded_string in encoded_strings:
|
||||
try:
|
||||
decoded = b64decode(encoded_string).decode('utf-8', errors='ignore')
|
||||
webhooks = findall(WEBHOOK_REGEX, decoded)
|
||||
results.extend(webhooks)
|
||||
except:
|
||||
pass
|
||||
|
||||
return results
|
19
utils/common_utils.py
Normal file
19
utils/common_utils.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
from httpx import AsyncClient
|
||||
|
||||
class HttpxHelperClient:
|
||||
def __init__(self):
|
||||
self.client = AsyncClient(timeout=60.0)
|
||||
|
||||
async def get(self, url, headers=None):
|
||||
response = await self.client.get(url, headers=headers)
|
||||
return response
|
||||
|
||||
async def post(self, url, data=None, json=None, headers=None):
|
||||
response = await self.client.post(url, data=data, json=json, headers=headers)
|
||||
return response
|
||||
|
||||
async def download(self, url, file_path, headers=None):
|
||||
response = await self.client.get(url, headers=headers)
|
||||
with open(file_path, 'wb') as f:
|
||||
f.write(response.content)
|
||||
return file_path
|
49
utils/decompile_utils.py
Normal file
49
utils/decompile_utils.py
Normal file
|
@ -0,0 +1,49 @@
|
|||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
from dataclasses import dataclass
|
||||
from typing import List, Optional
|
||||
|
||||
@dataclass
|
||||
class EntryPoint:
|
||||
entry_point: Optional[str] = None
|
||||
extraction_path: Optional[str] = None
|
||||
|
||||
def clean_up_temp_files(directory_path: str) -> None:
|
||||
"""Remove temporary files and directories"""
|
||||
try:
|
||||
if os.path.exists(directory_path):
|
||||
if os.path.isfile(directory_path):
|
||||
os.remove(directory_path)
|
||||
else:
|
||||
shutil.rmtree(directory_path, ignore_errors=True)
|
||||
except Exception as e:
|
||||
print(f"Failed to clean up {directory_path}: {e}")
|
||||
|
||||
def extract_pyinstaller_exe(exe_path: str) -> str:
|
||||
"""Extract PyInstaller executable contents"""
|
||||
temp_dir = tempfile.mkdtemp(prefix="pyinstaller_extract_")
|
||||
|
||||
# In a real implementation, you would use pyinstxtractor or similar tools
|
||||
# Here we just return the temporary directory
|
||||
return temp_dir
|
||||
|
||||
def find_payload_files(directory: str, extension: str, exclude_pattern: str) -> List[str]:
|
||||
"""Find files with specific extension in directory"""
|
||||
result = []
|
||||
for root, _, files in os.walk(directory):
|
||||
for file in files:
|
||||
if file.endswith(extension) and exclude_pattern not in file:
|
||||
result.append(os.path.join(root, file))
|
||||
return result
|
||||
|
||||
def decompile_pyc(pyc_file: str) -> str:
|
||||
"""Decompile .pyc file to source code"""
|
||||
# In a real implementation, you would use uncompyle6 or decompyle3
|
||||
# Here we just return a placeholder
|
||||
return f"# Decompiled content of {pyc_file}\n"
|
||||
|
||||
def attempts_to_get_entry_point(file_path: str) -> EntryPoint:
|
||||
"""Try various methods to find the entry point"""
|
||||
# In a real implementation, this would be more complex
|
||||
return EntryPoint(entry_point=file_path)
|
17
utils/discord_token_validator.py
Normal file
17
utils/discord_token_validator.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
from dataclasses import dataclass
|
||||
|
||||
@dataclass
|
||||
class TokenValidationResult:
|
||||
success: bool
|
||||
message: str = ""
|
||||
|
||||
def validate_discord_token(token: str, ignore_api_check=False) -> TokenValidationResult:
|
||||
# Simple validation logic - real implementation would verify with Discord API
|
||||
if len(token) < 50 or '.' not in token:
|
||||
return TokenValidationResult(False, "Invalid token format")
|
||||
|
||||
if ignore_api_check:
|
||||
return TokenValidationResult(True, "Token format valid (API check skipped)")
|
||||
|
||||
# In a real implementation, you would check with Discord API here
|
||||
return TokenValidationResult(True, "Token appears valid")
|
6
utils/telegram_token_validator.py
Normal file
6
utils/telegram_token_validator.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
import re
|
||||
|
||||
def validate_telegram_token(token: str) -> bool:
|
||||
# Simple validation - check if it matches the pattern \d{8,10}:[A-Za-z0-9_-]{35}
|
||||
pattern = r"\d{8,10}:[A-Za-z0-9_-]{35}"
|
||||
return bool(re.match(pattern, token))
|
15
utils/webhook_util.py
Normal file
15
utils/webhook_util.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
from typing import List
|
||||
|
||||
from model.common_models import DecompileResult
|
||||
|
||||
def validate_webhooks(webhooks: List[str], tags: List[str], sha256: str = "") -> DecompileResult:
|
||||
valid_webhooks = []
|
||||
invalid_webhooks = []
|
||||
|
||||
for webhook in webhooks:
|
||||
if webhook and len(webhook) >= 10: # Simple validation - real implementation would check with Discord API
|
||||
valid_webhooks.append(webhook)
|
||||
else:
|
||||
invalid_webhooks.append(webhook)
|
||||
|
||||
return DecompileResult(invalid_webhooks, valid_webhooks)
|
Loading…
Add table
Add a link
Reference in a new issue