diff options
author | Malfurious <m@lfurio.us> | 2021-08-03 19:53:26 -0400 |
---|---|---|
committer | Malfurious <m@lfurio.us> | 2021-08-03 19:53:26 -0400 |
commit | 5970194d1303e16364ff1405f974c995de46203b (patch) | |
tree | d3f748eeb0112205bb7784bd353b22376ee827ae /tools/sploit/sploitutil.py | |
parent | ef6e3a502bf8498a8f641eb3dad11d3065359bbb (diff) | |
parent | aa9da0f6f27759f5f3201bafb0e52f41367f08ef (diff) | |
download | lib-des-gnux-5970194d1303e16364ff1405f974c995de46203b.tar.gz lib-des-gnux-5970194d1303e16364ff1405f974c995de46203b.zip |
Merge tag 'pull-duso-imaginary-writeups' of https://github.com/Dusoleil/lib-des-gnux
Writeups and other tools/docs from ImaginaryCTF from Dusoleil.
* tag 'pull-duso-imaginary-writeups' of https://github.com/Dusoleil/lib-des-gnux:
Adding Initial Commit of the Sploit Tool
Adding Various Docs
Adding Various Small Tools
Git Ignore __pycache__ for All Tools
Writeups from Imaginary CTF 2021
Diffstat (limited to 'tools/sploit/sploitutil.py')
-rwxr-xr-x | tools/sploit/sploitutil.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tools/sploit/sploitutil.py b/tools/sploit/sploitutil.py new file mode 100755 index 0000000..00d2151 --- /dev/null +++ b/tools/sploit/sploitutil.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python3 + +import sploitconfig as config +from sploitlog import sploitlog + +def btoi(b): + return int.from_bytes(b,'little') + +def itob(i): + return i.to_bytes(8,'little',signed=True) + +class Libc: + def __init__(self,libc_addr,libc_offset): + self.libc_base = btoi(libc_addr)-btoi(libc_offset) + def base(self): + return itob(self.libc_base) + def addr(self,offset): + return itob(self.libc_base + btoi(offset)) + +def log(s): + if config.use_popen: + sploitlog(s) + +class Communication: + def __init__(self,stdin,stdout): + self.stdin = stdin + self.stdout = stdout + def send(self,s): + self.stdout.write(s) + self.stdout.flush() + def recv(self): + out = self.stdin.readline() + log(out) + return out |