From 96c708a169d037517ea898a6ff769802a4c3d9ee Mon Sep 17 00:00:00 2001 From: John Hammond Date: Wed, 13 May 2020 10:43:45 -0400 Subject: [PATCH] Added `requests` module into requrements. Should fix #9 --- data/gtfobins.json | 1 + gtfobinstest.py | 20 ++++++++++++++++++++ requirements.txt | 3 ++- 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 gtfobinstest.py diff --git a/data/gtfobins.json b/data/gtfobins.json index c3d0d10..4213b97 100644 --- a/data/gtfobins.json +++ b/data/gtfobins.json @@ -11,6 +11,7 @@ "payload": "{command} 2>/dev/null", // This is used to pass arguments to the application (auto-merged // into "{command}". + // IF YOUR COMMAND TAKES ARGUMENTS, YOU MUST SUPPLY THEM HERE. "args": ["if={lfile}"], // Prepends arguments, if any to the "args" for setuid context. "suid": [], diff --git a/gtfobinstest.py b/gtfobinstest.py new file mode 100644 index 0000000..aa4af03 --- /dev/null +++ b/gtfobinstest.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 + + +from pwncat.gtfobins import * +import subprocess + + +def which(path: str, quote=False): + try: + output = subprocess.check_output(f"which {path}", shell=True) + except subprocess.CalledProcessError: + return None + + return output.decode("utf-8").strip() + + +gtfo = GTFOBins("data/gtfobins.json", which) + +all_binaries = list(gtfo.iter_methods(Capability.SHELL)) +print(all_binaries[0].build(shell="/bin/bash", suid=True)) diff --git a/requirements.txt b/requirements.txt index 0ec472d..0dcec07 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,4 +4,5 @@ wcwidth==0.1.9 netifaces==0.10.9 pygments==2.6.1 base64io -commentjson \ No newline at end of file +commentjson +requests \ No newline at end of file