#!/usr/bin/expect -f # This file is part of Firejail project # Copyright (C) 2014-2019 Firejail Authors # License GPL v2 set timeout 10 spawn $env(SHELL) match_max 100000 # check ip address send -- "firejail --noprofile --net=br1 --ip=none --defaultgw=10.10.30.78\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.30" {puts "TESTING ERROR 7\n";exit} "done" } send -- "exit\r" after 100 puts "all done\n"