stoker

DLL Injector

Apr 14th, 2014
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.13 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. import sys,ctypes
  4. kernel32 = windll.kernel32
  5.  
  6.  
  7. print """
  8. ______ _      _       _____      _           _            
  9. |  _  \ |    | |     |_   _|    (_)         | |            
  10. | | | | |    | |       | | _ __  _  ___  ___| |_ ___  _ __
  11. | | | | |    | |       | || '_ \| |/ _ \/ __| __/ _ \| '__|
  12. | |/ /| |____| |____  _| || | | | |  __/ (__| || (_) | |  
  13. |___/ \_____/\_____/  \___/_| |_| |\___|\___|\__\___/|_|  
  14.                               _/ |                        
  15.                              |__/                        
  16.                              
  17.                 Developed by : Muhammad Adeel | Founder UrduSec (c) 2014
  18.                 Mail - [email protected]
  19. """
  20.  
  21. target_pr0cess = raw_input('Enter the Process ID: ')
  22. target_dll_path = raw_input('Path to DLL(C:\Windows\Somefolder\file.dll): ')
  23.  
  24. print "[*] Opening Process...."
  25.  
  26. procID = kernel32.OpenProcess(0x1F0FFF,False,target_pr0cess)
  27.  
  28. print "[*] Allocation memory.."
  29.  
  30. memaddrs = kernel32.VirtualAllocEx(procID, 0,len(target_dll_path),0x3000,0x04)
  31.  
  32. print "[*] Writing into Process.."
  33.  
  34. kernel32.WriteProcessMemory(procID,memaddrs,target_dll_path,len(target_dll_path),byref(c_int(0)))
  35.  
  36. print "[*] Getting Module Handle.."
  37.  
  38. k32dll = kernel32.GetModuleHandleA("kernel32")
  39.  
  40. print "[*] Get Process Address"
  41.  
  42. loadlib_func = kernel32.GetProcAddress(k32dll,"LoadLibraryA")
  43.  
  44. print "[*] Remote Thread.."
  45.  
  46. if not kernel32.CreateRemoteThread(procID,None,0,loadlib_func,memaddrs,0,byref(c_ulong(0))):
  47.     print "[*] Injection Failed"
  48.     sys.exit(0)
  49. else:
  50.     print "[*] Injection Successfull"
  51.    
  52.  
  53. print """
  54. _   _         _       _____                      _ _        
  55. | | | |       | |     /  ___|                    (_) |        
  56. | | | |_ __ __| |_   _\ `--.  ___  ___ _   _ _ __ _| |_ _   _
  57. | | | | '__/ _` | | | |`--. \/ _ \/ __| | | | '__| | __| | | |
  58. | |_| | | | (_| | |_| /\__/ /  __/ (__| |_| | |  | | |_| |_| |
  59. \___/|_|  \__,_|\__,_\____/ \___|\___|\__,_|_|  |_|\__|\__, |
  60.                                                         __/ |
  61.                                                        |___/
  62.  
  63. """
Add Comment
Please, Sign In to add comment