Files
.github
bin
builder
pwnagotchi
scripts
backup.sh
changelog.sh
language.sh
linux_connection_share.sh
macos_connection_share.sh
preview.py
pypi_upload.sh
release.sh
restore.sh
win_connection_share.ps1
.DEREK.yml
.editorconfig
.gitignore
.travis.yml
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE.md
MANIFEST.in
Makefile
README.md
requirements.txt
setup.py
pwnagotchi/scripts/macos_connection_share.sh

22 lines
516 B
Bash
Executable File

#!/usr/bin/env bash
UPSTREAM_IFACE=${1:-en0}
USB_IFACE=''
USB_IP=${2:-10.0.0.1}
for i in $(ifconfig -lu); do
if ifconfig $i | grep -q "${USB_IP}" ; then USB_IFACE=$i; fi;
done
if [ -z "$USB_IFACE" ]
then
echo "can't find usb interface with ip $USB_IP"
exit 1
fi
echo "sharing connecting from upstream interface $UPSTREAM_IFACE to usb interface $USB_IFACE ..."
sysctl -w net.inet.ip.forwarding=1
pfctl -e
echo "nat on ${UPSTREAM_IFACE} from ${USB_IFACE}:network to any -> (${UPSTREAM_IFACE})" | pfctl -f -