firejail/test/network/net_noip.exp
2018-07-16 09:49:55 -04:00

48 lines
917 B
Text
Executable file

#!/usr/bin/expect -f
# This file is part of Firejail project
# Copyright (C) 2014-2018 Firejail Authors
# License GPL v2
set timeout 10
spawn $env(SHELL)
match_max 100000
# check ip address
send -- "firejail --noprofile --net=br0 --ip=none\r"
expect {
timeout {puts "TESTING ERROR 0\n";exit}
"eth0" {puts "TESTING ERROR 1\n";exit}
"Child process initialized"
}
sleep 1
send -- "bash\r"
sleep 1
send -- "stty -echo\r"
after 100
# no default gateway configured
send -- "netstat -rn;echo done\r"
expect {
timeout {puts "TESTING ERROR 2\n";exit}
"0.0.0.0" {puts "TESTING ERROR 3\n";exit}
"eth0" {puts "TESTING ERROR 4\n";exit}
"done"
}
sleep 1
# eth0 configured
send -- "/sbin/ifconfig;echo done\r"
expect {
timeout {puts "TESTING ERROR 5\n";exit}
"eth0"
}
expect {
timeout {puts "TESTING ERROR 6\n";exit}
"10.10.20" {puts "TESTING ERROR 7\n";exit}
"done"
}
send -- "exit\r"
after 100
puts "all done\n"