Skip to content

Instantly share code, notes, and snippets.

@c4mx
c4mx / test_href_schemes.html
Last active September 18, 2023 16:29
PortSwigger lab: Exploiting DOM clobbering to enable XSS
<html>
<head>
<script src='./domPurify-2.0.15.js'></script>
</head>
<body>
<style>
.text {
font-size: 16px;
font-weight: bold;
}
@c4mx
c4mx / setuid_shell.c
Last active July 20, 2021 16:28
Password-protected setuid shell
#include <stdlib.h>
#include <stdio.h>
#include <openssl/sha.h>
#include <stddef.h>
#include <errno.h>
#include <string.h>
// gcc -lcrypto setuid_shell.c -o setuid_shell
void sha256(char *string, char outputBuffer[65])
@c4mx
c4mx / set_resolution.sh
Created June 14, 2021 13:07
Set Kali resolution
# Set kali resolution
set_resolution () {
home_rez_name='1920x975-60'
home_rez='"1920x975-60" 155.25 1920 2040 2240 2560 975 978 988 1012 -hsync +vsync'
xrandr -s $home_rez_name || xrandr --newmode "1920x975-60" 155.25 1920 2040 2240 2560 975 978 988 1012 -hsync +vsync && \
xrandr --addmode Virtual1 $home_rez_name && \
xrandr -s $home_rez_name
echo "[+] The resolution switched to $home_rez_name"
}
@c4mx
c4mx / sqli_blind.py
Created June 12, 2021 12:16
SQL blind injection
#!/usr/bin/env python3
# author: c4mx
import requests
import sys
import time
import argparse
from bs4 import BeautifulSoup
URL = ''
@c4mx
c4mx / set_wifi_hotspot.sh
Created December 22, 2020 18:30
Set WiFi Hotspot
# by c4mx
set_wifi_hotspot () {
if [ "$#" -ne 2 ]; then
echo "Usage: $0 [start|stop] interface"
return 1
fi
action=$1
iface=$2
@c4mx
c4mx / .tmux.conf
Last active January 7, 2023 20:57
my tmux config file
set-option -g prefix C-z # bind ctrl-a as control key
bind | split-window -h -c "#{pane_current_path}" # Split panes horizontal
bind - split-window -v -c "#{pane_current_path}" # Split panes vertically
bind enter resize-pane -Z # "return" key to resize pane
set -g mouse on # enable mouse mode
bind-key -n MouseDrag1Status swap-window -d -t=
unbind C-z
bind R move-window -r\; display-message "Windows reordered..."
@c4mx
c4mx / show_wifi_clients.sh
Created August 4, 2020 21:26
OpenWrt show connected clients
#!/bin/sh
# show_wifi_clients.sh
# Shows MAC, IP address and any hostname info for all connected wifi devices
# modification based on https://openwrt.org/faq/how_to_get_a_list_of_connected_clients
echo "# All connected wifi devices, with IP address,"
echo "# hostname (if available), and MAC address."
printf "%-15s %-15s %15s\n" "IP address" "Host" "MAC"
@c4mx
c4mx / enable_monitor
Created June 15, 2020 12:57
Enable monitor mode for RTL8814AU
#!/usr/bin/env sh
# Enable monitor mode for RTL8814AU
if [ $# -lt 1 ]
then
echo "Usage: enable_monitor interface [channel]"
return
elif [ $# -eq 2 ]
then
@c4mx
c4mx / setuid_shell.c
Created May 12, 2020 15:19
setuid shell
#include <stdlib.h>
#include <unistd.h>
int main() {
setuid(0);
setgid(0);
system("/bin/sh");
}
@c4mx
c4mx / wps_pin_checksum.py
Created May 10, 2020 09:13
Calculate WPS pin checksum
#!/usr/bin/env python3
def wps_pin_checksum(pin):
if pin > 9999999 or pin < 1000000:
print("[-] Input should be 6 digits")
return None
accum = 0
while pin:
accum += 3 * (pin % 10)
pin //= 10