myph-v2~ rust shellcode loader with evasive capabilities |
| git clone https://github.com/djnnvx/myph-v2.git |
| log | files | refs | archive | README |
| commit 7295aaf7537ee178550bc44479383a31bf06dec8
parent 5ca24034a78250e578eb38f63af03236f8aa3818 Author: djnn <[email protected]> Date: Sun, 11 Jan 2026 18:43:04 +0900 feat(cli): adding `--low-ressources` mode Diffstat:
|
| 6 files changed, 643 insertions(+), 259 deletions(-) | |||||
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml @@ -122,21 +122,21 @@ jobs: # Create a test directory mkdir -p e2e-test cd e2e-test - + # Create a test shellcode file echo -ne '\x90\x90\x90\xc3' > test_shellcode.raw echo "✓ Created test shellcode file (4 bytes)" - + # Test 1: EXE binary generation with default encryption (AES) echo "=== Test 1: EXE binary with AES encryption ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_aes.exe -e aes - + # Verify the EXE binary was created if [ ! -f "test_aes.exe" ]; then echo "Error: Binary 'test_aes.exe' was not created" exit 1 fi - + # Verify it's a Windows PE executable if file test_aes.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ EXE is a Windows PE32+ executable" @@ -144,129 +144,129 @@ jobs: echo "Error: File is not a Windows PE executable" exit 1 fi - + if file test_aes.exe | grep -q "stripped"; then echo "✓ EXE binary is stripped" else echo "Warning: EXE binary may not be stripped" fi - + BINARY_SIZE=$(stat -f%z test_aes.exe 2>/dev/null || stat -c%s test_aes.exe) echo "✓ EXE binary size: $BINARY_SIZE bytes" - + # Test 2: EXE binary generation with ChaCha20 encryption echo "" echo "=== Test 2: EXE binary with ChaCha20 encryption ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_chacha20.exe -e chacha20 - + if [ ! -f "test_chacha20.exe" ]; then echo "Error: Binary 'test_chacha20.exe' was not created" exit 1 fi - + if file test_chacha20.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ ChaCha20 encrypted binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 3: EXE binary generation with XOR encryption echo "" echo "=== Test 3: EXE binary with XOR encryption ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_xor.exe -e xor - + if [ ! -f "test_xor.exe" ]; then echo "Error: Binary 'test_xor.exe' was not created" exit 1 fi - + if file test_xor.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ XOR encrypted binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 4: EXE binary generation with Blowfish encryption echo "" echo "=== Test 4: EXE binary with Blowfish encryption ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_blowfish.exe -e blowfish - + if [ ! -f "test_blowfish.exe" ]; then echo "Error: Binary 'test_blowfish.exe' was not created" exit 1 fi - + if file test_blowfish.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ Blowfish encrypted binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 4a: EXE binary generation with AES-256 encryption echo "" echo "=== Test 4a: EXE binary with AES-256 encryption ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_aes256.exe -e aes256 - + if [ ! -f "test_aes256.exe" ]; then echo "Error: Binary 'test_aes256.exe' was not created" exit 1 fi - + if file test_aes256.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ AES-256 encrypted binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 4b: EXE binary generation with Twofish encryption echo "" echo "=== Test 4b: EXE binary with Twofish encryption ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_twofish.exe -e twofish - + if [ ! -f "test_twofish.exe" ]; then echo "Error: Binary 'test_twofish.exe' was not created" exit 1 fi - + if file test_twofish.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ Twofish encrypted binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 4c: EXE binary generation with Camellia encryption echo "" echo "=== Test 4c: EXE binary with Camellia encryption ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_camellia.exe -e camellia - + if [ ! -f "test_camellia.exe" ]; then echo "Error: Binary 'test_camellia.exe' was not created" exit 1 fi - + if file test_camellia.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ Camellia encrypted binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 5: DLL binary generation with encrypted shellcode echo "" echo "=== Test 5: DLL binary with AES encryption ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_output.dll -b dll -e aes - + # Verify the DLL binary was created if [ ! -f "test_output.dll" ]; then echo "Error: DLL 'test_output.dll' was not created" exit 1 fi - + # Verify it's a Windows PE DLL if file test_output.dll | grep -q "PE32+ executable.*DLL.*MS Windows"; then echo "✓ DLL is a Windows PE32+ DLL" @@ -274,50 +274,50 @@ jobs: echo "Error: File is not a Windows PE DLL" exit 1 fi - + if file test_output.dll | grep -q "stripped"; then echo "✓ DLL binary is stripped" else echo "Warning: DLL binary may not be stripped" fi - + DLL_SIZE=$(stat -f%z test_output.dll 2>/dev/null || stat -c%s test_output.dll) echo "✓ DLL binary size: $DLL_SIZE bytes" - + # Test 6: EXE binary generation with fixed key (AES) echo "" echo "=== Test 6: EXE binary with AES encryption and fixed key ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_aes_fixed_key.exe -e aes -k "MyFixedKey12345" - + if [ ! -f "test_aes_fixed_key.exe" ]; then echo "Error: Binary 'test_aes_fixed_key.exe' was not created" exit 1 fi - + if file test_aes_fixed_key.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ AES encrypted binary with fixed key is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 7: EXE binary generation with fixed key (XOR) echo "" echo "=== Test 7: EXE binary with XOR encryption and fixed key ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_xor_fixed_key.exe -e xor -k "SecretXORKey" - + if [ ! -f "test_xor_fixed_key.exe" ]; then echo "Error: Binary 'test_xor_fixed_key.exe' was not created" exit 1 fi - + if file test_xor_fixed_key.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ XOR encrypted binary with fixed key is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 8: Verify encrypted shellcode is embedded (should be larger than raw) echo "" echo "=== Test 8: Verify encryption increased embedded data size ===" @@ -326,102 +326,102 @@ jobs: echo "Original shellcode size: $ORIGINAL_SIZE bytes" echo "Note: Encrypted shellcode in binary should be larger due to IV/nonce/padding" echo "✓ Encryption is applied before embedding" - + # Test 9: CRT (CreateRemoteThread) technique with notepad.exe echo "" echo "=== Test 9: EXE binary with CRT technique ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_crt.exe -e aes --technique crt --process notepad.exe - + if [ ! -f "test_crt.exe" ]; then echo "Error: Binary 'test_crt.exe' was not created" exit 1 fi - + if file test_crt.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ CRT technique binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 10: CRTx (CreateRemoteThreadEx) technique with cmd.exe echo "" echo "=== Test 10: EXE binary with CRTx technique ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_crtx.exe -e xor --technique crtx --process cmd.exe - + if [ ! -f "test_crtx.exe" ]; then echo "Error: Binary 'test_crtx.exe' was not created" exit 1 fi - + if file test_crtx.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ CRTx technique binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 11: EnumCalendar technique (no process injection) echo "" echo "=== Test 11: EXE binary with EnumCalendar technique ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_enum_calendar.exe -e chacha20 --technique enum-calendar - + if [ ! -f "test_enum_calendar.exe" ]; then echo "Error: Binary 'test_enum_calendar.exe' was not created" exit 1 fi - + if file test_enum_calendar.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ EnumCalendar technique binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 12: DLL with CRT technique echo "" echo "=== Test 12: DLL binary with CRT technique ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_crt.dll -b dll -e aes --technique crt --process explorer.exe - + if [ ! -f "test_crt.dll" ]; then echo "Error: DLL 'test_crt.dll' was not created" exit 1 fi - + if file test_crt.dll | grep -q "PE32+ executable.*DLL.*MS Windows"; then echo "✓ CRT technique DLL is a valid PE32+ DLL" else echo "Error: File is not a Windows PE DLL" exit 1 fi - + # Test 13: CreateFiber technique echo "" echo "=== Test 13: EXE binary with CreateFiber technique ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_create_fiber.exe -e xor --technique create-fiber - + if [ ! -f "test_create_fiber.exe" ]; then echo "Error: Binary 'test_create_fiber.exe' was not created" exit 1 fi - + if file test_create_fiber.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ CreateFiber technique binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 13a: LNK binary generation with AES encryption echo "" echo "=== Test 13a: LNK binary with AES encryption ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_output.lnk -b lnk -e aes --technique create-fiber - + if [ ! -f "test_output.lnk" ]; then echo "Error: Binary 'test_output.lnk' was not created" exit 1 fi - + # Verify the file exists and has non-zero size LNK_SIZE=$(stat -f%z test_output.lnk 2>/dev/null || stat -c%s test_output.lnk) if [ "$LNK_SIZE" -gt 0 ]; then @@ -430,24 +430,24 @@ jobs: echo "Error: LNK file is empty" exit 1 fi - + # Verify it's recognized as a Windows shortcut if file test_output.lnk | grep -q "MS Windows shortcut"; then echo "✓ LNK file is recognized as MS Windows shortcut" else echo "Warning: file command may not recognize LNK format on this system" fi - + # Test 13b: LNK binary with XOR encryption echo "" echo "=== Test 13b: LNK binary with XOR encryption ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_xor.lnk -b lnk -e xor --technique syscall - + if [ ! -f "test_xor.lnk" ]; then echo "Error: Binary 'test_xor.lnk' was not created" exit 1 fi - + LNK_SIZE=$(stat -f%z test_xor.lnk 2>/dev/null || stat -c%s test_xor.lnk) if [ "$LNK_SIZE" -gt 0 ]; then echo "✓ LNK file with XOR encryption created successfully ($LNK_SIZE bytes)" @@ -455,17 +455,17 @@ jobs: echo "Error: LNK file is empty" exit 1 fi - + # Test 13c: LNK binary with ChaCha20 encryption echo "" echo "=== Test 13c: LNK binary with ChaCha20 encryption ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_chacha.lnk -b lnk -e chacha20 --technique enum-calendar - + if [ ! -f "test_chacha.lnk" ]; then echo "Error: Binary 'test_chacha.lnk' was not created" exit 1 fi - + LNK_SIZE=$(stat -f%z test_chacha.lnk 2>/dev/null || stat -c%s test_chacha.lnk) if [ "$LNK_SIZE" -gt 0 ]; then echo "✓ LNK file with ChaCha20 encryption created successfully ($LNK_SIZE bytes)" @@ -473,856 +473,890 @@ jobs: echo "Error: LNK file is empty" exit 1 fi - + # Test 14: Etwp technique echo "" echo "=== Test 14: EXE binary with Etwp technique ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_etwp.exe -e aes --technique etwp - + if [ ! -f "test_etwp.exe" ]; then echo "Error: Binary 'test_etwp.exe' was not created" exit 1 fi - + if file test_etwp.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ Etwp technique binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 15: NtCreateThreadEx technique echo "" echo "=== Test 15: EXE binary with NtCreateThreadEx technique ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_nt_create_thread_ex.exe -e chacha20 --technique nt-create-thread-ex - + if [ ! -f "test_nt_create_thread_ex.exe" ]; then echo "Error: Binary 'test_nt_create_thread_ex.exe' was not created" exit 1 fi - + if file test_nt_create_thread_ex.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ NtCreateThreadEx technique binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 16: ProcessHollowing technique echo "" echo "=== Test 16: EXE binary with ProcessHollowing technique ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_process_hollowing.exe -e blowfish --technique process-hollowing --process notepad.exe - + if [ ! -f "test_process_hollowing.exe" ]; then echo "Error: Binary 'test_process_hollowing.exe' was not created" exit 1 fi - + if file test_process_hollowing.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ ProcessHollowing technique binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 17: SetTimer technique echo "" echo "=== Test 17: EXE binary with SetTimer technique ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_set_timer.exe -e xor --technique set-timer - + if [ ! -f "test_set_timer.exe" ]; then echo "Error: Binary 'test_set_timer.exe' was not created" exit 1 fi - + if file test_set_timer.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ SetTimer technique binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 18: Syscall technique echo "" echo "=== Test 18: EXE binary with Syscall technique ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_syscall.exe -e aes --technique syscall - + if [ ! -f "test_syscall.exe" ]; then echo "Error: Binary 'test_syscall.exe' was not created" exit 1 fi - + if file test_syscall.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ Syscall technique binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 19: EnumWindows technique echo "" echo "=== Test 19: EXE binary with EnumWindows technique ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_enum_windows.exe -e chacha20 --technique enum-windows - + if [ ! -f "test_enum_windows.exe" ]; then echo "Error: Binary 'test_enum_windows.exe' was not created" exit 1 fi - + if file test_enum_windows.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ EnumWindows technique binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 20: EnumSystemLocales technique echo "" echo "=== Test 20: EXE binary with EnumSystemLocales technique ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_enum_system_locales.exe -e blowfish --technique enum-system-locales - + if [ ! -f "test_enum_system_locales.exe" ]; then echo "Error: Binary 'test_enum_system_locales.exe' was not created" exit 1 fi - + if file test_enum_system_locales.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ EnumSystemLocales technique binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 21: QueueUserAPC technique echo "" echo "=== Test 21: EXE binary with QueueUserAPC technique ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_queue_user_apc.exe -e xor --technique queue-user-apc - + if [ ! -f "test_queue_user_apc.exe" ]; then echo "Error: Binary 'test_queue_user_apc.exe' was not created" exit 1 fi - + if file test_queue_user_apc.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ QueueUserAPC technique binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 21a: ImageGetDigestStream technique echo "" echo "=== Test 21a: EXE binary with ImageGetDigestStream technique ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_image_get_digest_stream.exe -e aes --technique image-get-digest-stream - + if [ ! -f "test_image_get_digest_stream.exe" ]; then echo "Error: Binary 'test_image_get_digest_stream.exe' was not created" exit 1 fi - + if file test_image_get_digest_stream.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ ImageGetDigestStream technique binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 22: EXE binary with API Hammering echo "" echo "=== Test 22: EXE binary with API Hammering (AES encryption) ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_api_hammering.exe -e aes --with-api-hammering - + if [ ! -f "test_api_hammering.exe" ]; then echo "Error: Binary 'test_api_hammering.exe' was not created" exit 1 fi - + if file test_api_hammering.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ API Hammering binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - - # Test 23: DLL binary with API Hammering + + # Test 23: DLL binary with API Hammering echo "" echo "=== Test 23: DLL binary with API Hammering (XOR encryption) ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_api_hammering.dll -b dll -e xor --with-api-hammering --technique crt --process notepad.exe - + if [ ! -f "test_api_hammering.dll" ]; then echo "Error: DLL 'test_api_hammering.dll' was not created" exit 1 fi - + if file test_api_hammering.dll | grep -q "PE32+ executable.*DLL.*MS Windows"; then echo "✓ API Hammering DLL is a valid PE32+ DLL" else echo "Error: File is not a Windows PE DLL" exit 1 fi - + # Test 24: EXE binary with AMSI Patch echo "" echo "=== Test 24: EXE binary with AMSI Patch (AES encryption) ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_amsi_patch.exe -e aes --with-amsi-patch - + if [ ! -f "test_amsi_patch.exe" ]; then echo "Error: Binary 'test_amsi_patch.exe' was not created" exit 1 fi - + if file test_amsi_patch.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ AMSI Patch binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 25: DLL binary with AMSI Patch echo "" echo "=== Test 25: DLL binary with AMSI Patch (XOR encryption) ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_amsi_patch.dll -b dll -e xor --with-amsi-patch --technique crt --process explorer.exe - + if [ ! -f "test_amsi_patch.dll" ]; then echo "Error: DLL 'test_amsi_patch.dll' was not created" exit 1 fi - + if file test_amsi_patch.dll | grep -q "PE32+ executable.*DLL.*MS Windows"; then echo "✓ AMSI Patch DLL is a valid PE32+ DLL" else echo "Error: File is not a Windows PE DLL" exit 1 fi - + # Test 26: EXE binary with combined features (API Hammering + AMSI Patch) echo "" echo "=== Test 26: EXE binary with API Hammering and AMSI Patch ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_combined.exe -e chacha20 --with-api-hammering --with-amsi-patch --technique crt --process notepad.exe - + if [ ! -f "test_combined.exe" ]; then echo "Error: Binary 'test_combined.exe' was not created" exit 1 fi - + if file test_combined.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ Combined features binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 27: EXE binary with String Encryption echo "" echo "=== Test 27: EXE binary with String Encryption (AES encryption) ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_string_encryption.exe -e aes --with-string-encryption - + if [ ! -f "test_string_encryption.exe" ]; then echo "Error: Binary 'test_string_encryption.exe' was not created" exit 1 fi - + if file test_string_encryption.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ String Encryption binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 28: DLL binary with String Encryption echo "" echo "=== Test 28: DLL binary with String Encryption (XOR encryption) ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_string_encryption.dll -b dll -e xor --with-string-encryption --technique crt --process notepad.exe - + if [ ! -f "test_string_encryption.dll" ]; then echo "Error: DLL 'test_string_encryption.dll' was not created" exit 1 fi - + if file test_string_encryption.dll | grep -q "PE32+ executable.*DLL.*MS Windows"; then echo "✓ String Encryption DLL is a valid PE32+ DLL" else echo "Error: File is not a Windows PE DLL" exit 1 fi - + # Test 29: EXE binary with Dynamic Function Resolver echo "" echo "=== Test 29: EXE binary with Dynamic Function Resolver (XOR encryption) ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_dynamic_resolver.exe -e xor --with-dynamic-function-resolver --technique create-fiber - + if [ ! -f "test_dynamic_resolver.exe" ]; then echo "Error: Binary 'test_dynamic_resolver.exe' was not created" exit 1 fi - + if file test_dynamic_resolver.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ Dynamic Function Resolver binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 30: DLL binary with Dynamic Function Resolver echo "" echo "=== Test 30: DLL binary with Dynamic Function Resolver (AES encryption) ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_dynamic_resolver.dll -b dll -e aes --with-dynamic-function-resolver --technique crt --process notepad.exe - + if [ ! -f "test_dynamic_resolver.dll" ]; then echo "Error: DLL 'test_dynamic_resolver.dll' was not created" exit 1 fi - + if file test_dynamic_resolver.dll | grep -q "PE32+ executable.*DLL.*MS Windows"; then echo "✓ Dynamic Function Resolver DLL is a valid PE32+ DLL" else echo "Error: File is not a Windows PE DLL" exit 1 fi - + # Test 31: Multiple techniques with Dynamic Function Resolver echo "" echo "=== Test 31: Testing Dynamic Function Resolver with multiple techniques ===" - + echo "Testing EnumCalendar technique..." ../target/release/myph_v2 -s test_shellcode.raw -f test_dynamic_enum.exe -e xor --with-dynamic-function-resolver --technique enum-calendar if [ -f "test_dynamic_enum.exe" ] && file test_dynamic_enum.exe | grep -q "PE32+ executable"; then echo "✓ EnumCalendar with dynamic resolver works" fi - + echo "Testing SetTimer technique..." ../target/release/myph_v2 -s test_shellcode.raw -f test_dynamic_timer.exe -e aes --with-dynamic-function-resolver --technique set-timer if [ -f "test_dynamic_timer.exe" ] && file test_dynamic_timer.exe | grep -q "PE32+ executable"; then echo "✓ SetTimer with dynamic resolver works" fi - + echo "Testing Syscall technique..." ../target/release/myph_v2 -s test_shellcode.raw -f test_dynamic_syscall.exe -e chacha20 --with-dynamic-function-resolver --technique syscall if [ -f "test_dynamic_syscall.exe" ] && file test_dynamic_syscall.exe | grep -q "PE32+ executable"; then echo "✓ Syscall with dynamic resolver works" fi - + echo "Testing Etwp technique..." ../target/release/myph_v2 -s test_shellcode.raw -f test_dynamic_etwp.exe -e blowfish --with-dynamic-function-resolver --technique etwp if [ -f "test_dynamic_etwp.exe" ] && file test_dynamic_etwp.exe | grep -q "PE32+ executable"; then echo "✓ Etwp with dynamic resolver works" fi - + echo "Testing NtCreateThreadEx technique..." ../target/release/myph_v2 -s test_shellcode.raw -f test_dynamic_nt.exe -e xor --with-dynamic-function-resolver --technique nt-create-thread-ex if [ -f "test_dynamic_nt.exe" ] && file test_dynamic_nt.exe | grep -q "PE32+ executable"; then echo "✓ NtCreateThreadEx with dynamic resolver works" fi - + echo "Testing CRTx technique..." ../target/release/myph_v2 -s test_shellcode.raw -f test_dynamic_crtx.exe -e aes --with-dynamic-function-resolver --technique crtx --process cmd.exe if [ -f "test_dynamic_crtx.exe" ] && file test_dynamic_crtx.exe | grep -q "PE32+ executable"; then echo "✓ CRTx with dynamic resolver works" fi - + echo "Testing ProcessHollowing technique..." ../target/release/myph_v2 -s test_shellcode.raw -f test_dynamic_hollowing.exe -e xor --with-dynamic-function-resolver --technique process-hollowing --process notepad.exe if [ -f "test_dynamic_hollowing.exe" ] && file test_dynamic_hollowing.exe | grep -q "PE32+ executable"; then echo "✓ ProcessHollowing with dynamic resolver works" fi - + echo "Testing EnumWindows technique..." ../target/release/myph_v2 -s test_shellcode.raw -f test_dynamic_enum_windows.exe -e aes --with-dynamic-function-resolver --technique enum-windows if [ -f "test_dynamic_enum_windows.exe" ] && file test_dynamic_enum_windows.exe | grep -q "PE32+ executable"; then echo "✓ EnumWindows with dynamic resolver works" fi - + echo "Testing EnumSystemLocales technique..." ../target/release/myph_v2 -s test_shellcode.raw -f test_dynamic_enum_locales.exe -e chacha20 --with-dynamic-function-resolver --technique enum-system-locales if [ -f "test_dynamic_enum_locales.exe" ] && file test_dynamic_enum_locales.exe | grep -q "PE32+ executable"; then echo "✓ EnumSystemLocales with dynamic resolver works" fi - + echo "Testing QueueUserAPC technique..." ../target/release/myph_v2 -s test_shellcode.raw -f test_dynamic_queue_apc.exe -e blowfish --with-dynamic-function-resolver --technique queue-user-apc if [ -f "test_dynamic_queue_apc.exe" ] && file test_dynamic_queue_apc.exe | grep -q "PE32+ executable"; then echo "✓ QueueUserAPC with dynamic resolver works" fi - + echo "Testing ImageGetDigestStream technique..." ../target/release/myph_v2 -s test_shellcode.raw -f test_dynamic_image_digest.exe -e xor --with-dynamic-function-resolver --technique image-get-digest-stream if [ -f "test_dynamic_image_digest.exe" ] && file test_dynamic_image_digest.exe | grep -q "PE32+ executable"; then echo "✓ ImageGetDigestStream with dynamic resolver works" fi - + # Test 32: Fairy-Law technique (privilege escalation) echo "" echo "=== Test 32: EXE binary with Fairy-Law technique ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_fairy_law.exe -e aes --technique fairy-law - + if [ ! -f "test_fairy_law.exe" ]; then echo "Error: Binary 'test_fairy_law.exe' was not created" exit 1 fi - + if file test_fairy_law.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ Fairy-Law technique binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 33: Fairy-Law with ChaCha20 encryption echo "" echo "=== Test 33: Fairy-Law with ChaCha20 encryption ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_fairy_law_chacha.exe -e chacha20 --technique fairy-law - + if [ ! -f "test_fairy_law_chacha.exe" ]; then echo "Error: Binary 'test_fairy_law_chacha.exe' was not created" exit 1 fi - + if file test_fairy_law_chacha.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ Fairy-Law with ChaCha20 binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 34: Fairy-Law with Dynamic Function Resolver echo "" echo "=== Test 34: Fairy-Law with Dynamic Function Resolver ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_fairy_law_dynamic.exe -e xor --with-dynamic-function-resolver --technique fairy-law - + if [ ! -f "test_fairy_law_dynamic.exe" ]; then echo "Error: Binary 'test_fairy_law_dynamic.exe' was not created" exit 1 fi - + if file test_fairy_law_dynamic.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ Fairy-Law with dynamic resolver is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 35: Fairy-Law with AMSI Patch echo "" echo "=== Test 35: Fairy-Law with AMSI Patch ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_fairy_law_amsi.exe -e blowfish --technique fairy-law --with-amsi-patch - + if [ ! -f "test_fairy_law_amsi.exe" ]; then echo "Error: Binary 'test_fairy_law_amsi.exe' was not created" exit 1 fi - + if file test_fairy_law_amsi.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ Fairy-Law with AMSI Patch is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 36: Fairy-Law with combined evasion features echo "" echo "=== Test 36: Fairy-Law with API Hammering and String Encryption ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_fairy_law_combined.exe -e aes256 --technique fairy-law --with-api-hammering --with-string-encryption - + if [ ! -f "test_fairy_law_combined.exe" ]; then echo "Error: Binary 'test_fairy_law_combined.exe' was not created" exit 1 fi - + if file test_fairy_law_combined.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ Fairy-Law with combined features is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 37: Fairy-Law DLL generation echo "" echo "=== Test 37: DLL binary with Fairy-Law technique ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_fairy_law.dll -b dll -e twofish --technique fairy-law - + if [ ! -f "test_fairy_law.dll" ]; then echo "Error: DLL 'test_fairy_law.dll' was not created" exit 1 fi - + if file test_fairy_law.dll | grep -q "PE32+ executable.*DLL.*MS Windows"; then echo "✓ Fairy-Law technique DLL is a valid PE32+ DLL" else echo "Error: File is not a Windows PE DLL" exit 1 fi - + echo "" echo "Testing Fairy-Law technique..." ../target/release/myph_v2 -s test_shellcode.raw -f test_dynamic_fairy_law.exe -e camellia --with-dynamic-function-resolver --technique fairy-law if [ -f "test_dynamic_fairy_law.exe" ] && file test_dynamic_fairy_law.exe | grep -q "PE32+ executable"; then echo "✓ Fairy-Law with dynamic resolver works" fi - + + # Test: Low-resource mode + echo "" + echo "=== Test: EXE binary with low-resource mode ===" + ../target/release/myph_v2 -s test_shellcode.raw -f test_low_resources.exe -e aes --technique create-fiber --low-resources + + if [ ! -f "test_low_resources.exe" ]; then + echo "Error: Binary 'test_low_resources.exe' was not created" + exit 1 + fi + + if file test_low_resources.exe | grep -q "PE32+ executable.*MS Windows"; then + echo "✓ Low-resource mode binary is a valid PE32+ executable" + else + echo "Error: File is not a Windows PE executable" + exit 1 + fi + + # Test: Low-resource mode with DLL + echo "" + echo "=== Test: DLL binary with low-resource mode ===" + ../target/release/myph_v2 -s test_shellcode.raw -f test_low_resources.dll -b dll -e xor --technique crt --process notepad.exe --low-resources + + if [ ! -f "test_low_resources.dll" ]; then + echo "Error: DLL 'test_low_resources.dll' was not created" + exit 1 + fi + + if file test_low_resources.dll | grep -q "PE32+ executable.*DLL.*MS Windows"; then + echo "✓ Low-resource mode DLL is a valid PE32+ DLL" + else + echo "Error: File is not a Windows PE DLL" + exit 1 + fi + echo "" echo "✓ All end-to-end tests passed!" - + # Test 32: Module Stomping technique echo "" echo "=== Test 32: EXE binary with Module Stomping technique ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_module_stomping.exe -e aes --technique module-stomping - + if [ ! -f "test_module_stomping.exe" ]; then echo "Error: Binary 'test_module_stomping.exe' was not created" exit 1 fi - + if file test_module_stomping.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ Module Stomping technique binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 33: Thread Hijacking technique echo "" echo "=== Test 33: EXE binary with Thread Hijacking technique ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_thread_hijacking.exe -e chacha20 --technique thread-hijacking --process notepad.exe - + if [ ! -f "test_thread_hijacking.exe" ]; then echo "Error: Binary 'test_thread_hijacking.exe' was not created" exit 1 fi - + if file test_thread_hijacking.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ Thread Hijacking technique binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 34: Early Bird APC technique echo "" echo "=== Test 34: EXE binary with Early Bird APC technique ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_early_bird.exe -e xor --technique early-bird --process cmd.exe - + if [ ! -f "test_early_bird.exe" ]; then echo "Error: Binary 'test_early_bird.exe' was not created" exit 1 fi - + if file test_early_bird.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ Early Bird APC technique binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 35: Anti-VM evasion echo "" echo "=== Test 35: EXE binary with Anti-VM evasion ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_anti_vm.exe -e aes --technique create-fiber --with-anti-vm - + if [ ! -f "test_anti_vm.exe" ]; then echo "Error: Binary 'test_anti_vm.exe' was not created" exit 1 fi - + if file test_anti_vm.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ Anti-VM evasion binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 36: Anti-Sandbox evasion echo "" echo "=== Test 36: EXE binary with Anti-Sandbox evasion ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_anti_sandbox.exe -e chacha20 --technique syscall --with-anti-sandbox - + if [ ! -f "test_anti_sandbox.exe" ]; then echo "Error: Binary 'test_anti_sandbox.exe' was not created" exit 1 fi - + if file test_anti_sandbox.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ Anti-Sandbox evasion binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 37: Anti-Debugger evasion echo "" echo "=== Test 37: EXE binary with Anti-Debugger evasion ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_anti_debugger.exe -e xor --technique enum-calendar --with-anti-debugger - + if [ ! -f "test_anti_debugger.exe" ]; then echo "Error: Binary 'test_anti_debugger.exe' was not created" exit 1 fi - + if file test_anti_debugger.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ Anti-Debugger evasion binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 38: Combined evasion features echo "" echo "=== Test 38: EXE binary with combined evasion features ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_all_evasion.exe -e aes --technique module-stomping \ --with-anti-vm --with-anti-sandbox --with-anti-debugger --with-amsi-patch --with-string-encryption - + if [ ! -f "test_all_evasion.exe" ]; then echo "Error: Binary 'test_all_evasion.exe' was not created" exit 1 fi - + if file test_all_evasion.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ Combined evasion features binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 39: Call stack spoofing alone echo "" echo "=== Test 39: EXE binary with call stack spoofing ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_callstack_spoofing.exe -e xor --technique create-fiber --with-callstack-spoofing - + if [ ! -f "test_callstack_spoofing.exe" ]; then echo "Error: Binary 'test_callstack_spoofing.exe' was not created" exit 1 fi - + if file test_callstack_spoofing.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ Call stack spoofing binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 40: Call stack spoofing with dynamic resolver echo "" echo "=== Test 40: EXE binary with call stack spoofing and dynamic resolver ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_callstack_dynamic.exe -e aes --technique syscall \ --with-callstack-spoofing --with-dynamic-function-resolver - + if [ ! -f "test_callstack_dynamic.exe" ]; then echo "Error: Binary 'test_callstack_dynamic.exe' was not created" exit 1 fi - + if file test_callstack_dynamic.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ Call stack spoofing with dynamic resolver binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 41: Maximum evasion with call stack spoofing echo "" echo "=== Test 41: EXE binary with maximum evasion including call stack spoofing ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_max_evasion.exe -e chacha20 --technique early-bird --process cmd.exe \ --with-callstack-spoofing --with-dynamic-function-resolver --with-amsi-patch \ --with-anti-vm --with-anti-sandbox --with-anti-debugger - + if [ ! -f "test_max_evasion.exe" ]; then echo "Error: Binary 'test_max_evasion.exe' was not created" exit 1 fi - + if file test_max_evasion.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ Maximum evasion with call stack spoofing binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 29: AMSI Patch with String Encryption echo "" echo "=== Test 29: AMSI Patch with String Encryption ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_amsi_string_enc.exe -e aes --with-amsi-patch --with-string-encryption - + if [ ! -f "test_amsi_string_enc.exe" ]; then echo "Error: Binary 'test_amsi_string_enc.exe' was not created" exit 1 fi - + if file test_amsi_string_enc.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ AMSI Patch with String Encryption binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 30: AMSI Patch with Dynamic Function Resolver echo "" echo "=== Test 30: AMSI Patch with Dynamic Function Resolver ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_amsi_dynamic.exe -e xor --with-amsi-patch --with-dynamic-function-resolver --technique create-fiber - + if [ ! -f "test_amsi_dynamic.exe" ]; then echo "Error: Binary 'test_amsi_dynamic.exe' was not created" exit 1 fi - + if file test_amsi_dynamic.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ AMSI Patch with Dynamic Function Resolver binary is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 31: AMSI Patch with both String Encryption and Dynamic Function Resolver echo "" echo "=== Test 31: AMSI Patch with String Encryption and Dynamic Function Resolver ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_amsi_both.exe -e chacha20 --with-amsi-patch --with-string-encryption --with-dynamic-function-resolver --technique syscall - + if [ ! -f "test_amsi_both.exe" ]; then echo "Error: Binary 'test_amsi_both.exe' was not created" exit 1 fi - + if file test_amsi_both.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ AMSI Patch with both String Encryption and Dynamic Function Resolver is a valid PE32+ executable" else echo "Error: File is not a Windows PE executable" exit 1 fi - + echo "" echo "✓ All end-to-end tests passed!" - + # Test 39: Dynamic Function Resolver with VirtualAlloc (kernel32.dll) echo "" echo "=== Test 39: Dynamic Function Resolver with VirtualAlloc ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_dynres_virtualalloc.exe -e aes --technique create-fiber --with-dynamic-function-resolver - + if [ ! -f "test_dynres_virtualalloc.exe" ]; then echo "Error: Binary 'test_dynres_virtualalloc.exe' was not created" exit 1 fi - + if file test_dynres_virtualalloc.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ Dynamic resolver with VirtualAlloc (kernel32.dll) works" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Verify no static imports for key APIs if ! strings test_dynres_virtualalloc.exe | grep -q "VirtualAlloc"; then echo "✓ VirtualAlloc not found in static strings (dynamically resolved)" else echo "⚠ Warning: VirtualAlloc found in binary strings" fi - + # Test 40: Dynamic Function Resolver with CreateProcess (kernel32.dll) echo "" echo "=== Test 40: Dynamic Function Resolver with CreateProcess ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_dynres_createprocess.exe -e chacha20 --technique thread-hijacking --process notepad.exe --with-dynamic-function-resolver - + if [ ! -f "test_dynres_createprocess.exe" ]; then echo "Error: Binary 'test_dynres_createprocess.exe' was not created" exit 1 fi - + if file test_dynres_createprocess.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ Dynamic resolver with CreateProcess works" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 41: Dynamic Function Resolver with QueueUserAPC (kernel32.dll) echo "" echo "=== Test 41: Dynamic Function Resolver with QueueUserAPC ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_dynres_queueapc.exe -e xor --technique queue-user-apc --with-dynamic-function-resolver - + if [ ! -f "test_dynres_queueapc.exe" ]; then echo "Error: Binary 'test_dynres_queueapc.exe' was not created" exit 1 fi - + if file test_dynres_queueapc.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ Dynamic resolver with QueueUserAPC works" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 42: Dynamic Function Resolver with NtCreateThreadEx (ntdll.dll) echo "" echo "=== Test 42: Dynamic Function Resolver with NtCreateThreadEx ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_dynres_ntapi.exe -e aes --technique nt-create-thread-ex --process cmd.exe --with-dynamic-function-resolver - + if [ ! -f "test_dynres_ntapi.exe" ]; then echo "Error: Binary 'test_dynres_ntapi.exe' was not created" exit 1 fi - + if file test_dynres_ntapi.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ Dynamic resolver with NtCreateThreadEx (ntdll.dll) works" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Test 43: Dynamic Function Resolver + String Encryption + AMSI Patch echo "" echo "=== Test 43: Dynamic Resolver with String Encryption and AMSI Patch ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_dynres_full_evasion.exe -e aes --technique create-fiber \ --with-dynamic-function-resolver --with-string-encryption --with-amsi-patch - + if [ ! -f "test_dynres_full_evasion.exe" ]; then echo "Error: Binary 'test_dynres_full_evasion.exe' was not created" exit 1 fi - + if file test_dynres_full_evasion.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ Dynamic resolver with full evasion (string encryption + AMSI patch) works" else echo "Error: File is not a Windows PE executable" exit 1 fi - + # Verify encrypted function names if ! strings test_dynres_full_evasion.exe | grep -q "AmsiScanBuffer"; then echo "✓ AmsiScanBuffer not found in static strings (encrypted)" else echo "⚠ Warning: AmsiScanBuffer found in binary strings" fi - + # Test 44: Dynamic Function Resolver with all new techniques echo "" echo "=== Test 44: Dynamic Resolver with ModuleStomping ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_dynres_module_stomping.exe -e xor --technique module-stomping --with-dynamic-function-resolver - + if [ ! -f "test_dynres_module_stomping.exe" ]; then echo "Error: Binary 'test_dynres_module_stomping.exe' was not created" exit 1 fi - + if file test_dynres_module_stomping.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ Dynamic resolver with ModuleStomping works" else echo "Error: File is not a Windows PE executable" exit 1 fi - + echo "" echo "=== Test 45: Dynamic Resolver with EarlyBird ===" ../target/release/myph_v2 -s test_shellcode.raw -f test_dynres_early_bird.exe -e aes --technique early-bird --process notepad.exe --with-dynamic-function-resolver - + if [ ! -f "test_dynres_early_bird.exe" ]; then echo "Error: Binary 'test_dynres_early_bird.exe' was not created" exit 1 fi - + if file test_dynres_early_bird.exe | grep -q "PE32+ executable.*MS Windows"; then echo "✓ Dynamic resolver with EarlyBird works" else echo "Error: File is not a Windows PE executable" exit 1 fi - + echo "✓ Tested 7 encryption algorithms (AES-128, AES-256, ChaCha20, Twofish, Camellia, Blowfish, XOR)" echo "✓ Tested 3 binary formats (EXE, DLL, LNK)" echo "✓ Tested LNK format with 3 encryption methods (AES, XOR, ChaCha20) on Linux" @@ -1482,17 +1516,17 @@ jobs: shell: pwsh run: | echo "=== Running Windows End-to-End Tests ===" - + # Create test directory New-Item -ItemType Directory -Force -Path e2e-test | Out-Null - + # Create msf.raw with NOP instructions (8 NOPs + RET) $nopShellcode = @(0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0xC3) [System.IO.File]::WriteAllBytes("e2e-test\msf.raw", $nopShellcode) Write-Host "✓ Created msf.raw with NOP shellcode ($($nopShellcode.Length) bytes)" - + Set-Location e2e-test - + # Test 1: AES encryption with create-fiber Write-Host "" Write-Host "=== Test 1: AES encryption with create-fiber ===" @@ -1511,7 +1545,7 @@ jobs: Write-Host "✗ Failed to generate test_aes_fiber.exe" exit 1 } - + # Test 2: XOR encryption with enum-calendar Write-Host "" Write-Host "=== Test 2: XOR encryption with enum-calendar ===" @@ -1530,7 +1564,7 @@ jobs: Write-Host "✗ Failed to generate test_xor_enum.exe" exit 1 } - + # Test 3: ChaCha20 encryption with set-timer Write-Host "" Write-Host "=== Test 3: ChaCha20 encryption with set-timer ===" @@ -1549,7 +1583,7 @@ jobs: Write-Host "✗ Failed to generate test_chacha_timer.exe" exit 1 } - + # Test 4: Blowfish encryption with syscall Write-Host "" Write-Host "=== Test 4: Blowfish encryption with syscall ===" @@ -1568,7 +1602,7 @@ jobs: Write-Host "✗ Failed to generate test_blowfish_syscall.exe" exit 1 } - + # Test 5: AES with API hammering Write-Host "" Write-Host "=== Test 5: AES with API hammering ===" @@ -1587,7 +1621,7 @@ jobs: Write-Host "✗ Failed to generate test_aes_hammer.exe" exit 1 } - + # Test 6: XOR with AMSI patch Write-Host "" Write-Host "=== Test 6: XOR with AMSI patch ===" @@ -1606,7 +1640,7 @@ jobs: Write-Host "✗ Failed to generate test_xor_amsi.exe" exit 1 } - + # Test 7: ChaCha20 with string encryption Write-Host "" Write-Host "=== Test 7: ChaCha20 with string encryption ===" @@ -1625,7 +1659,7 @@ jobs: Write-Host "✗ Failed to generate test_chacha_strenc.exe" exit 1 } - + # Test 8: XOR with dynamic function resolver (XOR works with dynamic resolver) Write-Host "" Write-Host "=== Test 8: XOR with dynamic function resolver ===" @@ -1644,7 +1678,7 @@ jobs: Write-Host "✗ Failed to generate test_xor_dynres.exe" exit 1 } - + # Test 9: DLL generation Write-Host "" Write-Host "=== Test 9: DLL generation ===" @@ -1655,7 +1689,7 @@ jobs: Write-Host "✗ Failed to generate test_output.dll" exit 1 } - + # Test 10: Combined features (API hammering + AMSI patch) Write-Host "" Write-Host "=== Test 10: Combined features (API hammering + AMSI patch) ===" @@ -1674,7 +1708,7 @@ jobs: Write-Host "✗ Failed to generate test_combined.exe" exit 1 } - + # Test 11: LNK file generation with AES encryption Write-Host "" Write-Host "=== Test 11: LNK file with AES encryption ===" @@ -1687,7 +1721,7 @@ jobs: Write-Host "✗ Failed to generate test_output.lnk" exit 1 } - + # Test 12: LNK file with XOR encryption Write-Host "" Write-Host "=== Test 12: LNK file with XOR encryption ===" @@ -1698,7 +1732,7 @@ jobs: Write-Host "✗ Failed to generate test_xor.lnk" exit 1 } - + # Test 13: LNK file with ChaCha20 encryption Write-Host "" Write-Host "=== Test 13: LNK file with ChaCha20 encryption ===" @@ -1709,7 +1743,26 @@ jobs: Write-Host "✗ Failed to generate test_chacha.lnk" exit 1 } - + + # Test 14: Low-resource mode + Write-Host "" + Write-Host "=== Test 14: Low-resource mode ===" + ..\target\release\myph_v2.exe -s .\msf.raw -f test_low_resources.exe -e aes -t create-fiber --low-resources + if (Test-Path "test_low_resources.exe") { + Write-Host "✓ Generated test_low_resources.exe with low-resource mode" + $env:RUST_BACKTRACE=1 + & .\test_low_resources.exe + if ($LASTEXITCODE -eq 0) { + Write-Host "✓ test_low_resources.exe executed successfully" + } else { + Write-Host "✗ test_low_resources.exe failed with exit code $LASTEXITCODE" + exit 1 + } + } else { + Write-Host "✗ Failed to generate test_low_resources.exe" + exit 1 + } + Write-Host "" Write-Host "=== All Windows E2E Tests Passed ===" Write-Host "✓ Tested 4 encryption methods (AES, XOR, ChaCha20, Blowfish)" @@ -1729,6 +1782,7 @@ jobs: echo "✓ Verified no static API imports (strings check)" Write-Host "✓ Tested String Encryption feature" Write-Host "✓ Tested Dynamic Function Resolver feature" + Write-Host "✓ Tested Low-resource mode" Write-Host "✓ Tested DLL generation" Write-Host "✓ Tested combined features" Write-Host "✓ All generated binaries executed successfully without crashes" |