This repository has been archived by the owner on Mar 12, 2024. It is now read-only.
forked from evilsocket/pwnagotchi
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fixed, refactored and centralized launchers logic (closes evilso…
- Loading branch information
Simone Margaritelli
committed
Oct 31, 2019
1 parent
13cc8cb
commit c8d0ccc
Showing
7 changed files
with
75 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,11 @@ | ||
#!/usr/bin/env bash | ||
source /usr/bin/pwnlib | ||
|
||
# start mon0 | ||
/usr/bin/monstart | ||
start_monitor_interface | ||
|
||
# if usb0 or eth0 are up | ||
if [[ $(ifconfig | grep usb0 | grep RUNNING) ]] || [[ !$(grep '1' /sys/class/net/eth0/carrier) ]]; then | ||
# if override file exists, go into auto mode | ||
if [ -f /root/.pwnagotchi-auto ]; then | ||
/usr/bin/bettercap -no-colors -caplet pwnagotchi-auto -iface mon0 | ||
else | ||
/usr/bin/bettercap -no-colors -caplet pwnagotchi-manual -iface mon0 | ||
fi | ||
else | ||
if is_auto_mode; then | ||
/usr/bin/bettercap -no-colors -caplet pwnagotchi-auto -iface mon0 | ||
else | ||
/usr/bin/bettercap -no-colors -caplet pwnagotchi-manual -iface mon0 | ||
fi |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
#!/usr/bin/env bash | ||
iw phy phy0 interface add mon0 type monitor && ifconfig mon0 up | ||
source /usr/bin/pwnlib | ||
start_monitor_interface |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
#!/usr/bin/env bash | ||
ifconfig mon0 down && iw dev mon0 del | ||
source /usr/bin/pwnlib | ||
stop_monitor_interface |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,11 @@ | ||
#!/usr/bin/env bash | ||
source /usr/bin/pwnlib | ||
|
||
# blink 10 times to signal ready state | ||
/usr/bin/bootblink 10 & | ||
blink_led 10 & | ||
|
||
# if usb0 or eth0 are up | ||
if [[ $(ifconfig | grep usb0 | grep RUNNING) ]] || [[ !$(grep '1' /sys/class/net/eth0/carrier) ]]; then | ||
# if override file exists, go into auto mode | ||
if [ -f /root/.pwnagotchi-auto ]; then | ||
rm /root/.pwnagotchi-auto | ||
/usr/local/bin/pwnagotchi | ||
else | ||
/usr/local/bin/pwnagotchi --manual | ||
fi | ||
else | ||
if is_auto_mode; then | ||
/usr/local/bin/pwnagotchi | ||
else | ||
/usr/local/bin/pwnagotchi --manual | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/env bash | ||
|
||
# well ... it blinks the led | ||
blink_led() { | ||
for i in $(seq 1 "$1"); do | ||
echo 0 >/sys/class/leds/led0/brightness | ||
sleep 0.3 | ||
echo 1 >/sys/class/leds/led0/brightness | ||
sleep 0.3 | ||
done | ||
echo 0 >/sys/class/leds/led0/brightness | ||
sleep 0.3 | ||
} | ||
|
||
# starts mon0 | ||
start_monitor_interface() { | ||
iw phy phy0 interface add mon0 type monitor && ifconfig mon0 up | ||
} | ||
|
||
# stops mon0 | ||
stop_monitor_interface() { | ||
ifconfig mon0 down && iw dev mon0 del | ||
} | ||
|
||
# returns 0 if the specificed network interface is up | ||
is_interface_up() { | ||
if grep -qi 'up' /sys/class/net/$1/operstate; then | ||
return 0 | ||
fi | ||
return 1 | ||
} | ||
|
||
# returns 0 if conditions for AUTO mode are met | ||
is_auto_mode() { | ||
# check override file first | ||
if [ -f /root/.pwnagotchi-auto ]; then | ||
# remove the override file if found | ||
rm -rf /root/.pwnagotchi-auto | ||
return 0 | ||
fi | ||
|
||
# if usb0 is up, we're in MANU | ||
if is_interface_up usb0; then | ||
return 1 | ||
fi | ||
|
||
# if eth0 is up (for other boards), we're in MANU | ||
if is_interface_up eth0; then | ||
return 1 | ||
fi | ||
|
||
# no override, but none of the interfaces is up -> AUTO | ||
return 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters