wait_for_link

don't blindly execute the payload, wait for a link first at least
pull/2/head
Rick Farina (Zero_Chaos) 2019-12-12 10:27:59 -05:00
parent 49cbd4460d
commit f3bf662795
No known key found for this signature in database
GPG Key ID: A29433C0AA431DDC
2 changed files with 13 additions and 0 deletions

View File

@ -88,6 +88,10 @@ function parse_state() {
} }
case $1 in case $1 in
"LINKSETUP")
parse_color "M"
parse_pattern "SLOW"
;;
"SETUP") "SETUP")
parse_color "M" parse_color "M"
parse_pattern "SOLID" parse_pattern "SOLID"

View File

@ -98,6 +98,14 @@ function execute_upgrade() {
} }
} }
function wait_for_link() {
LED LINKSETUP
while mii-tool eth0 | grep -q 'eth0: no link'; do
sleep 1
done
LED SETUP
}
function execute_payload() { function execute_payload() {
$LOG "Executing PAYLOAD" $LOG "Executing PAYLOAD"
@ -155,6 +163,7 @@ function enter_attack_mode() {
stop_http stop_http
stop_ssh stop_ssh
wait_for_link
execute_payload execute_payload
enter_idle_mode enter_idle_mode