Skip to content

Instantly share code, notes, and snippets.

@eyJhb
eyJhb / transpose.py
Last active January 31, 2019 14:20
Transpose HTML table
from bs4 import BeautifulSoup
f = open("index.html", "r")
data = f.read()
f.close()
bs = BeautifulSoup(data, "html.parser")
elements = {}
@eyJhb
eyJhb / backup.sh
Created November 14, 2018 21:20
Simple script I use to backup my servers - uses PGP for encryption and SCP for uploading
#!/bin/bash
# Linux SCP Backup Script
# how it works
# -
#date string
d=$(date --iso)
@eyJhb
eyJhb / skousen.py
Created October 17, 2018 16:35
page enumeration for Skousen RMA images
import requests
url = "https://images.wagcdn.com/800/600/scale/p/skadesformular/{0}_{1}.jpg"
for caseNumber in range(77667, 100000):
for caseImage in range(0, 5):
req = requests.get(url.format(caseNumber, caseImage))
if not req.status_code == 200:
continue
@eyJhb
eyJhb / cyberhack-laas.py
Last active October 16, 2018 10:45
Cyberhack script for LaaS
import html
import requests
from bs4 import BeautifulSoup
import random
import base64
class lass(object):
def __init__(self):
self.s = requests.session()
@eyJhb
eyJhb / cyberhack-raid.py
Created October 13, 2018 21:41
Cyberhack - RAID fix
import os
import shutil
# function to find missing disk in block dict
def missingDisk(minDisk, maxDisk, blockDict):
disks = []
for disk in range(minDisk, maxDisk+1):
try:
blockDict[disk]
except:
@eyJhb
eyJhb / image_sorter.py
Created August 7, 2018 15:27
Simple image sorter for screenshots and photos
import exifread
import shutil
import os
for f in os.listdir("images/"):
if not os.path.isfile("images/"+f):
continue
fb = open("images/"+f, "rb")
tags = exifread.process_file(fb)
@eyJhb
eyJhb / schedule-finder.sh
Last active September 4, 2021 21:44
Schedule finder for AAU
#!/usr/bin/env bash
START=6100
KEYWORD=$1
for i in {1..2000}; do
if [ $(($i%100)) -eq 0 ]; then
echo "Currently at: $i"
fi
@eyJhb
eyJhb / debug-inserter.py
Created July 27, 2018 19:37
Quick script for inserting debug statements in smali code.. Somewhat works!
import os
import re
class debug_inserter(object):
def __init__(self, path_to_files, prefix):
self.path_to_files = path_to_files
self.debug_prefix = prefix
self.debug_statement = """const-string {0}, \"{1} - {2}\"
invoke-static {{0}, {0}}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I"""
self.re_filename = re.compile("\.smali$")
@eyJhb
eyJhb / flask-shutdown-restart.py
Created July 22, 2018 19:13
Simple flask web server to shutdown and restart a server
from flask import Flask
import subprocess
app = Flask(__name__)
@app.route("/")
def index():
return "Please visit /shutdown or /restart"
@app.route("/restart")
def restart():
@eyJhb
eyJhb / pfsense-backup.sh
Last active July 13, 2018 16:30
Simple bash script to login on a pfsense router to download the configuration and save it as a file for backups
#!/bin/bash
username="backup"
password="password"
router_ip="https://192.168.1.1"
backup_location="/tmp"
csrf=$(wget -qO- --keep-session-cookies --save-cookies cookies.txt \
--no-check-certificate $router_ip/diag_backup.php \
| grep "name='__csrf_magic'" | sed 's/.*value="\(.*\)".*/\1/')