fix: fixed race condition (again) on override files
This commit is contained in:
parent
00e7c04980
commit
e336fca0de
@ -4,7 +4,7 @@ source /usr/bin/pwnlib
|
|||||||
# start mon0
|
# start mon0
|
||||||
start_monitor_interface
|
start_monitor_interface
|
||||||
|
|
||||||
if is_auto_mode; then
|
if is_auto_mode_no_delete; then
|
||||||
/usr/bin/bettercap -no-colors -caplet pwnagotchi-auto -iface mon0
|
/usr/bin/bettercap -no-colors -caplet pwnagotchi-auto -iface mon0
|
||||||
else
|
else
|
||||||
/usr/bin/bettercap -no-colors -caplet pwnagotchi-manual -iface mon0
|
/usr/bin/bettercap -no-colors -caplet pwnagotchi-manual -iface mon0
|
||||||
|
@ -32,6 +32,13 @@ is_interface_up() {
|
|||||||
|
|
||||||
# returns 0 if conditions for AUTO mode are met
|
# returns 0 if conditions for AUTO mode are met
|
||||||
is_auto_mode() {
|
is_auto_mode() {
|
||||||
|
# check override file first
|
||||||
|
if [ -f /root/.pwnagotchi-manual ]; then
|
||||||
|
# remove the override file if found
|
||||||
|
rm -rf /root/.pwnagotchi-manual
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
# check override file first
|
# check override file first
|
||||||
if [ -f /root/.pwnagotchi-auto ]; then
|
if [ -f /root/.pwnagotchi-auto ]; then
|
||||||
# remove the override file if found
|
# remove the override file if found
|
||||||
@ -52,3 +59,29 @@ is_auto_mode() {
|
|||||||
# no override, but none of the interfaces is up -> AUTO
|
# no override, but none of the interfaces is up -> AUTO
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# returns 0 if conditions for AUTO mode are met
|
||||||
|
is_auto_mode_no_delete() {
|
||||||
|
# check override file first
|
||||||
|
if [ -f /root/.pwnagotchi-manual ]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check override file first
|
||||||
|
if [ -f /root/.pwnagotchi-auto ]; then
|
||||||
|
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
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user