From 879082c866488b8b7fc36ee83b4cc1cbe54883a7 Mon Sep 17 00:00:00 2001 From: TheKid Date: Sun, 20 Feb 2022 13:04:00 +0200 Subject: [PATCH 1/2] testing with mac spoofing --- build.sh | 4 ++-- torall.py | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 0fe2d85..a3dbeaf 100755 --- a/build.sh +++ b/build.sh @@ -70,11 +70,11 @@ prerequisites() { info "Starting TorAll Installer v1.5" info "Installing prerequisites " if command -v pacman > /dev/null; then - pacman -S --quiet --noconfirm --needed tor python-pip cython gcc + pacman -S --quiet --noconfirm --needed tor macchanger python-pip cython gcc info "Installing dependencies " pip3 install requests elif command -v apt > /dev/null; then - apt -y --quiet install tor python3-pip cython3 gcc + apt -y --quiet install tor macchanger python3-pip cython3 gcc info "Installing dependencies " pip3 install requests else diff --git a/torall.py b/torall.py index ff20096..1246d7b 100755 --- a/torall.py +++ b/torall.py @@ -112,6 +112,24 @@ def restore_nameservers(): os.system('mv /var/lib/torall/resolv.conf.bak /etc/resolv.conf') +def spoof_mac_addresses(): + print(MARGIN + clr.BLUE + 'Spoofing mac addresses...' + clr.END) + for iface in os.listdir('/sys/class/net/'): + if iface != 'lo': + os.system('ip link set ' + iface + ' down >/dev/null') + os.system('macchanger -r ' + iface + ' >/dev/null 2>&1') + os.system('ip link set ' + iface + ' up >/dev/null') + + +def revert_mac_addresses(): + print(MARGIN + clr.BLUE + 'Reverting mac addresses...' + clr.END) + for iface in os.listdir('/sys/class/net/'): + if iface != 'lo': + os.system('ip link set ' + iface + ' down >/dev/null') + os.system('macchanger -p ' + iface + ' >/dev/null 2>&1') + os.system('ip link set ' + iface + ' up >/dev/null') + + def start_daemon(): print(MARGIN + clr.BLUE + 'Starting new tor daemon...' + clr.END) os.system('sudo -u ' + TORUID + ' tor -f /etc/tor/torallrc >/dev/null') @@ -195,6 +213,7 @@ def start_torall(): print(MARGIN + clr.GREEN + clr.BOLD + 'STARTING TorAll...' + clr.END) if os.system('systemctl is-active --quiet tor') == 0: stop_daemon() + # spoof_mac_addresses() switch_nameservers() backup_sysctl() disable_ipv6() @@ -215,6 +234,7 @@ def stop_torall(): restore_sysctl() flush_iptables() stop_daemon() + # revert_mac_addresses() enable_firewall() restart_network_manager() print(MARGIN + clr.BLUE + 'Fetching current IP... ' + clr.END + ip() + '\n') From 9f509118b4fb4a09ce452acffc6f9675c60da110 Mon Sep 17 00:00:00 2001 From: Bissi Date: Tue, 22 Feb 2022 03:27:52 +0200 Subject: [PATCH 2/2] fixed mac spoofing issues --- build.sh | 10 ++++------ torall.py | 8 ++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/build.sh b/build.sh index a3dbeaf..bfbee1d 100755 --- a/build.sh +++ b/build.sh @@ -70,16 +70,14 @@ prerequisites() { info "Starting TorAll Installer v1.5" info "Installing prerequisites " if command -v pacman > /dev/null; then - pacman -S --quiet --noconfirm --needed tor macchanger python-pip cython gcc - info "Installing dependencies " - pip3 install requests + pacman -S --quiet --noconfirm --needed tor macchanger cython gcc python-pip elif command -v apt > /dev/null; then - apt -y --quiet install tor macchanger python3-pip cython3 gcc - info "Installing dependencies " - pip3 install requests + apt -y --quiet install tor macchanger cython3 gcc python3-pip else err "Unknown distro! TorAll currently supports only Arch and Debian based distros." fi + info "Installing dependencies " + pip3 install requests -q } create_torallrc() { diff --git a/torall.py b/torall.py index 1246d7b..93a89f3 100755 --- a/torall.py +++ b/torall.py @@ -116,18 +116,14 @@ def spoof_mac_addresses(): print(MARGIN + clr.BLUE + 'Spoofing mac addresses...' + clr.END) for iface in os.listdir('/sys/class/net/'): if iface != 'lo': - os.system('ip link set ' + iface + ' down >/dev/null') os.system('macchanger -r ' + iface + ' >/dev/null 2>&1') - os.system('ip link set ' + iface + ' up >/dev/null') def revert_mac_addresses(): print(MARGIN + clr.BLUE + 'Reverting mac addresses...' + clr.END) for iface in os.listdir('/sys/class/net/'): if iface != 'lo': - os.system('ip link set ' + iface + ' down >/dev/null') os.system('macchanger -p ' + iface + ' >/dev/null 2>&1') - os.system('ip link set ' + iface + ' up >/dev/null') def start_daemon(): @@ -213,10 +209,10 @@ def start_torall(): print(MARGIN + clr.GREEN + clr.BOLD + 'STARTING TorAll...' + clr.END) if os.system('systemctl is-active --quiet tor') == 0: stop_daemon() - # spoof_mac_addresses() switch_nameservers() backup_sysctl() disable_ipv6() + spoof_mac_addresses() start_daemon() disable_firewall() set_iptables() @@ -234,7 +230,7 @@ def stop_torall(): restore_sysctl() flush_iptables() stop_daemon() - # revert_mac_addresses() + revert_mac_addresses() enable_firewall() restart_network_manager() print(MARGIN + clr.BLUE + 'Fetching current IP... ' + clr.END + ip() + '\n')