Skip to content

Instantly share code, notes, and snippets.

@c4mx
c4mx / wpa2_psk_auth.py
Last active March 6, 2025 21:15
Calculate PMK, PTK, MIC and MIC verification in WPA2-PSK authentication
#!/usr/bin/env python
# __author__ = 'c4mx'
from pbkdf2 import PBKDF2
from binascii import a2b_hex
import hmac, hashlib, binascii
# passphrase: WPA wifi password
def calc_pmk(passphrase, ssid):
return PBKDF2(passphrase, ssid, 4096).read(32)
@c4mx
c4mx / check_ip_virustotal.sh
Created April 29, 2020 14:28
Check a list of IP via VirusTotal API
#echo 'sleep 60s to begin...'
#sleep 60
apikey='...virustotal_apikey...'
result_file='ip_vt_result.txt'
ip_file='ip_ext.txt'
ctr=0
total=0
for i in `cat $ip_file`;do
@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
@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 / 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 / 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 / .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 / 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 / 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_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"
}