-
Notifications
You must be signed in to change notification settings - Fork 0
/
gdbHack.py
executable file
·44 lines (36 loc) · 900 Bytes
/
gdbHack.py
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
36
37
38
39
40
41
42
43
44
#!/usr/bin/python
import sys
import time
import threading
import string
from subprocess import Popen,PIPE
proc = Popen('gdb', shell=True, stdin=PIPE,)
def print_help():
print "usage : loadmod module IP"
def loadmod(arg):
if len(arg) < 2 :
print_help()
else :
try:
print arg[1] + "\n"
module = Popen(["/tmp/loadmod.sh", arg[1]] ,)
module.wait()
except :
print "could not execute /tmp/loadmod.sh"
while 1:
try:
keyboardInput = sys.stdin.readline()
command = keyboardInput.split()
try:
if command[0] == "loadmod":
print "sendload"
loadmod(command)
print "\r(gdb) ",
else :
print "sendgdb"
proc.stdin.write(keyboardInput)
except:
print "except"
proc.stdin.write(keyboardInput)
except:
sys.exit()