Skip to content

Instantly share code, notes, and snippets.

View MattMoony's full-sized avatar
🦆
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

Matthias Monschein MattMoony

🦆
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
View GitHub Profile
#!/usr/bin/python3
import json
import requests as req
from time import sleep
from datetime import datetime
def get_public_ip():
try:
status = json.loads(req.get('https://wtfismyip.com/json').text)
@MattMoony
MattMoony / ipinfo.sh
Last active September 28, 2020 18:16
Generate a JSON with GEO information on all ips contained in the output of the `last` command (in the example, the output of the `last` command is loaded from`ips`)
echo "["$(echo $(cat ips|head -n -3|awk '{print $3}'|sort|uniq|xargs -I% curl -s "https://freegeoip.app/json/%"|sed "s/\}/\},/")|rev|cut -c2-|rev)"]">ips.json
@MattMoony
MattMoony / public_ip.py
Created September 27, 2020 22:07
View public IP address via Python Script
import requests as req;print(f'\033[92m[+]\033[39m Public IP: \033[96m{req.get("https://wtfismyip.com/text").text.strip()}\033[39m')
@MattMoony
MattMoony / solutions.py
Last active September 27, 2020 22:02
View CTFd solution history - exact timestamps not, e.g.: "3 days ago" ...
import json, datetime
import requests as req
from tabulate import tabulate
CTFURL=input('CTF-URL (e.g.: ctf.csaw.io): ')
SESSCOOKIE=input('Session-Cookie: ')
CHID=input('Challenge-ID: ')
print(tabulate([(e['name'], datetime.datetime.fromisoformat(e['date'][:-1]).strftime('%d.%m.%Y %H:%M:%S')) for e in json.loads(req.get(f'https://{CTFURL}/api/v1/challenges/{CHID}/solves',cookies=dict(session=SESSCOOKIE)).text)['data']], headers=('User', 'Timestamp',)))