#!/usr/bin/expect -f # # new /proc # set timeout 10 spawn $env(SHELL) match_max 100000 set overlay [lindex $argv 0] set chroot [lindex $argv 1] # # N # send -- "firejail --noprofile\r" expect { timeout {puts "TESTING ERROR 0\n";exit} "Child process initialized" } sleep 1 send -- "cat /proc/mounts | grep proc --color=never\r" expect { timeout {puts "TESTING ERROR 1.1\n";exit} "proc /proc proc" } expect { timeout {puts "TESTING ERROR 1.2\n";exit} "proc /proc proc" } expect { timeout {puts "TESTING ERROR 1.3\n";exit} "proc /proc/sys proc" } expect { timeout {puts "TESTING ERROR 1.4\n";exit} "proc /proc/sysrq-trigger proc" } #expect { # timeout {puts "TESTING ERROR 1.5\n";exit} # "proc /proc/sys/kernel/hotplug" #} expect { timeout {puts "TESTING ERROR 1.6\n";exit} "proc /proc/irq proc" } expect { timeout {puts "TESTING ERROR 1.7\n";exit} "proc /proc/bus proc" } after 100 send -- "exit\r" sleep 1 # # O # if { $overlay == "overlay" } { send -- "firejail --noprofile --overlay\r" expect { timeout {puts "TESTING ERROR 2\n";exit} "Child process initialized" } sleep 1 send -- "cat /proc/mounts | grep proc --color=never\r" expect { timeout {puts "TESTING ERROR 3.1\n";exit} "proc /proc proc" } expect { timeout {puts "TESTING ERROR 3.3\n";exit} "proc /proc/sys proc" } expect { timeout {puts "TESTING ERROR 3.4\n";exit} "proc /proc/sysrq-trigger proc" } # expect { # timeout {puts "TESTING ERROR 3.5\n";exit} # "proc /proc/sys/kernel/hotplug" # } expect { timeout {puts "TESTING ERROR 3.6\n";exit} "proc /proc/irq proc" } expect { timeout {puts "TESTING ERROR 3.7\n";exit} "proc /proc/bus proc" } after 100 send -- "exit\r" sleep 1 } # # C # if { $chroot == "chroot" } { send -- "firejail --noprofile --chroot=/tmp/chroot\r" expect { timeout {puts "TESTING ERROR 4\n";exit} "Child process initialized" } sleep 1 send -- "cat /proc/mounts | grep proc --color=never\r" expect { timeout {puts "TESTING ERROR 5.1\n";exit} "proc /proc proc" } expect { timeout {puts "TESTING ERROR 5.3\n";exit} "proc /proc/sys proc" } expect { timeout {puts "TESTING ERROR 5.4\n";exit} "proc /proc/sysrq-trigger proc" } # expect { # timeout {puts "TESTING ERROR 5.5\n";exit} # "proc /proc/sys/kernel/hotplug" # } expect { timeout {puts "TESTING ERROR 5.6\n";exit} "proc /proc/irq proc" } expect { timeout {puts "TESTING ERROR 5.7\n";exit} "proc /proc/bus proc" } after 100 send -- "exit\r" sleep 1 } puts "\nall done\n"