summaryrefslogtreecommitdiffstats
path: root/tools/sploit/sploitrunner.py
diff options
context:
space:
mode:
authordusoleil <howcansocksbereal@gmail.com>2021-08-02 00:36:28 -0400
committerdusoleil <howcansocksbereal@gmail.com>2021-08-03 19:45:57 -0400
commitaa9da0f6f27759f5f3201bafb0e52f41367f08ef (patch)
treed3f748eeb0112205bb7784bd353b22376ee827ae /tools/sploit/sploitrunner.py
parent4338f0862dae3b33862bb32c5dd9fc2eb5f6f90a (diff)
downloadlib-des-gnux-aa9da0f6f27759f5f3201bafb0e52f41367f08ef.tar.gz
lib-des-gnux-aa9da0f6f27759f5f3201bafb0e52f41367f08ef.zip
Adding Initial Commit of the Sploit Tool
Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
Diffstat (limited to '')
-rwxr-xr-xtools/sploit/sploitrunner.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/tools/sploit/sploitrunner.py b/tools/sploit/sploitrunner.py
new file mode 100755
index 0000000..f0e5ac6
--- /dev/null
+++ b/tools/sploit/sploitrunner.py
@@ -0,0 +1,38 @@
+#!/usr/bin/env python3
+
+import os
+import sys
+import subprocess
+import time
+
+import sploitconfig as config
+import sploitutil as util
+
+#infrastructure to run sploit
+#if sploit is called with command line arguments,
+#it will use them to call the target program with popen
+#otherwise, sploit will use stdin/stdout
+#you can use sploitpipe to run sploit with pipes spltin/spltout
+#which can be used with the target program
+#<spltin ./target &>spltout
+#or from within gdb
+#r <spltin &>spltout
+def runsploit(sploit):
+ if config.use_popen:
+ print(sys.argv[1:])
+ p = subprocess.Popen(sys.argv[1:],stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
+
+ stdin = p.stdout if config.use_popen else os.fdopen(0,"rb")
+ stdout = p.stdin if config.use_popen else os.fdopen(1,"wb")
+
+ if config.wait_for_gdb > 0:
+ time.sleep(config.wait_for_gdb)
+
+ #exec custom sploit
+ sploit(stdin,stdout)
+
+ #read anything else out and wait for termination
+ for line in stdin:
+ util.log(line)
+ if config.use_popen:
+ p.wait()