Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import json
- import urllib.request
- import sys
- import os
- def main():
- if len(sys.argv) < 2:
- print(f"Usage: python3 {sys.argv[0]} <suid_list.txt>")
- sys.exit(1)
- # 1. Fetch GTFOBins API
- try:
- url = "https://gtfobins.github.io/api.json"
- req = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0'})
- with urllib.request.urlopen(req) as response:
- data = json.loads(response.read()).get('executables', {})
- except Exception as e:
- print(f"[-] API Error: {e}")
- sys.exit(1)
- # 2. Read the list
- try:
- with open(sys.argv[1], "r") as f:
- binaries = [line.strip() for line in f if line.strip()]
- except:
- sys.exit(1)
- print(f"{'BINARY':<15} | {'METHOD'}")
- print("-" * 40)
- # 3. Output matches only
- for path in binaries:
- name = os.path.basename(path).lower()
- if name in data:
- funcs = data[name].get('functions', {})
- # Join all available methods (suid, shell, file-read, etc.)
- methods = ", ".join(funcs.keys())
- print(f"{name:<15} | {methods}")
- if __name__ == "__main__":
- main()
Advertisement