Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Builder patch #9

Merged
merged 2 commits into from
Mar 3, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix: Check for c++ 16380 max single byte strings
  • Loading branch information
joshfaust committed Mar 3, 2021
commit 10599a44d89879cc0bbfa47f71582760fc83410a
13 changes: 9 additions & 4 deletions builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,20 +136,25 @@ def move_binary(path: str) -> str:

if os.path.exists(exe_path):
shutil.move(current_location, path)
else:
path = os.getcwd()
shutil.move(current_location, path)
else:
shutil.move(current_location, path)
path = path + "loader.exe"

return path


def is_max_string(string: str) -> bool:
"""
Checks to make sure the Base64 Shellcode string is not too
large. C++ has a max character limit of 4294967294
large. https://docs.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2026?view=msvc-160&viewFallbackFrom=vs-2019
"""
cpp_max_size = 4294967294
cpp_max_size = 16380
if len(string) >= cpp_max_size:
print(f"{Fore.RED}[!] Shellcode Too Large, C++ Max String is 4294967294 characters.")
print(f"{Fore.RED}[!] Shellcode Too Large, a string can't be longer than 16380 single-byte characters.")
print(f"{Fore.CYAN}[i] https://docs.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2026?view=msvc-160&viewFallbackFrom=vs-2019")
return True
return False

Expand Down Expand Up @@ -235,5 +240,5 @@ def parse_shellcode(shellcode_file: str) -> bytes:
print(f"{Fore.CYAN}[i] Variable Swap:{Fore.GREEN}\tSuccessful{Fore.RESET}")
if compile():
print(f"{Fore.CYAN}[i] Compiling:{Fore.GREEN}\t\tSuccessful{Fore.RESET}")
print(f"{Fore.CYAN}[i] Binary Location:{Fore.MAGENTA}\t{move_binary(args.out_path)}\loader.exe{Fore.RESET}")
print(f"{Fore.CYAN}[i] Binary Location:{Fore.MAGENTA}\t{move_binary(args.out_path)}{Fore.RESET}")