Skip to content

Instantly share code, notes, and snippets.

View h4sh5's full-sized avatar

Haoxi Tan h4sh5

View GitHub Profile
@h4sh5
h4sh5 / RC4.c
Created April 28, 2024 01:54 — forked from rverton/RC4.c
/*
robin verton, dec 2015
implementation of the RC4 algo
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define N 256 // 2^8
@h4sh5
h4sh5 / Exploitation.md
Created February 16, 2024 15:48 — forked from yezz123/Exploitation.md
Pentesting-Exploitation
@h4sh5
h4sh5 / smtp_send_email.py
Created January 13, 2024 08:21
send email (text and html) using python
#!/usr/bin/env python3
import sys
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import dns.resolver
msg = MIMEMultipart('alternative')
@h4sh5
h4sh5 / touchid_sudo.sh
Last active October 14, 2023 06:13 — forked from RichardBronosky/touchid_sudo.sh
Use TouchID for sudo on modern MacBook Pro machines
#!/bin/bash
# curl -sL https://gist.githubusercontent.com/RichardBronosky/31660eb4b0f0ba5e673b9bc3c9148a70/raw/touchid_sudo.sh | bash
# This script is ready to copy-paste in whole, or just the line above (without the leading #)
# Use TouchID for sudo on modern MacBook Pro machines
# This script adds a single line to the top of the PAM configuration for sudo
# See: https://apple.stackexchange.com/q/259093/41827 for more info.
touchid_sudo(){
docker run --name squid-container -e TZ=UTC -p 3128:3128 ubuntu/squid:5.2-22.04_beta
@h4sh5
h4sh5 / tracing.dockerfile
Created August 17, 2023 22:51
python tracing pip with hunter
FROM python:3.10-buster
RUN pip install hunter
# COPY /entrypoint.sh /
CMD PYTHONHUNTER="Q(module='pip')|Q(module='os')|Q(module='subprocess')" python -m pip install requests
@h4sh5
h4sh5 / patch_nops.py
Created July 3, 2023 14:01
patch hex patterns in file
#!/usr/bin/env python3
import re
import binascii
import sys
import time
if len(sys.argv) < 3:
print("usage: %s <file> <hex pattern> [replace pattern (default all NOPs)]" %sys.argv[0])
exit(1)
@h4sh5
h4sh5 / swagger_check_sec.py
Created June 23, 2023 04:28
check swagger docs for security or the lack thereof
#!/usr/bin/env python3
import yaml
import sys
filename = sys.argv[1]
with open(filename,'r') as f:
d = yaml.safe_load(f)
if 'security' in d:
@h4sh5
h4sh5 / squeeze_two_cols.sh
Created March 30, 2023 13:01
using pandoc to squeeze a lot fo text into an A4 page
(echo -e "---\nclassoption:\n- twocolumn\nlinestretch: 0\n---"; cat $1) | pandoc --variable papersize="A4" --variable margin-left="0.2cm" --variable margin-right="0.2cm" --variable margin-top="0.2cm" --variable margin-bottom="0.2cm" --variable fontsize="8pt" - -o $1.pdf
@h4sh5
h4sh5 / log.php
Created December 27, 2022 01:23
log request data
<?php
// a script that just logs stuff, from something like echo 123 | curl -d@- url
$entityBody = file_get_contents('php://input');
file_put_contents('just_the_log.txt', "\n---" . $_SERVER["REMOTE_ADDR"] . "|" . $_SERVER["HTTP_X_FORWARDED_FOR"] . "|" . $entityBody, FILE_APPEND | LOCK_EX);
?>