diff options
Diffstat (limited to 'test/net_ip.exp')
-rwxr-xr-x | test/net_ip.exp | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/test/net_ip.exp b/test/net_ip.exp new file mode 100755 index 000000000..5995296c7 --- /dev/null +++ b/test/net_ip.exp | |||
@@ -0,0 +1,91 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | |||
3 | set timeout 10 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | |||
7 | # check ip address | ||
8 | send -- "firejail --net=br0 --ip=10.10.20.5\r" | ||
9 | expect { | ||
10 | timeout {puts "TESTING ERROR 0\n";exit} | ||
11 | "eth0" | ||
12 | } | ||
13 | expect { | ||
14 | timeout {puts "TESTING ERROR 1\n";exit} | ||
15 | "10.10.20.5" | ||
16 | } | ||
17 | expect { | ||
18 | timeout {puts "TESTING ERROR 2\n";exit} | ||
19 | "255.255.255.248" | ||
20 | } | ||
21 | expect { | ||
22 | timeout {puts "TESTING ERROR 3\n";exit} | ||
23 | "UP" | ||
24 | } | ||
25 | expect { | ||
26 | timeout {puts "TESTING ERROR 4\n";exit} | ||
27 | "Child process initialized" | ||
28 | } | ||
29 | sleep 2 | ||
30 | send -- "exit\r" | ||
31 | sleep 2 | ||
32 | |||
33 | # check loopback | ||
34 | send -- "firejail --net=br0 --ip=10.10.20.5\r" | ||
35 | expect { | ||
36 | timeout {puts "TESTING ERROR 5\n";exit} | ||
37 | "lo" | ||
38 | } | ||
39 | expect { | ||
40 | timeout {puts "TESTING ERROR 6\n";exit} | ||
41 | "127.0.0.1" | ||
42 | } | ||
43 | expect { | ||
44 | timeout {puts "TESTING ERROR 7\n";exit} | ||
45 | "255.0.0.0" | ||
46 | } | ||
47 | expect { | ||
48 | timeout {puts "TESTING ERROR 8\n";exit} | ||
49 | "UP" | ||
50 | } | ||
51 | expect { | ||
52 | timeout {puts "TESTING ERROR 9\n";exit} | ||
53 | "Child process initialized" | ||
54 | } | ||
55 | |||
56 | # check default gateway | ||
57 | send -- "bash\r" | ||
58 | sleep 1 | ||
59 | send -- "netstat -rn;pwd\r" | ||
60 | expect { | ||
61 | timeout {puts "TESTING ERROR 10.1\n";exit} | ||
62 | "0.0.0.0" | ||
63 | } | ||
64 | expect { | ||
65 | timeout {puts "TESTING ERROR 10.2\n";exit} | ||
66 | "10.10.20.1" | ||
67 | } | ||
68 | expect { | ||
69 | timeout {puts "TESTING ERROR 10.3\n";exit} | ||
70 | "eth0" | ||
71 | } | ||
72 | expect { | ||
73 | timeout {puts "TESTING ERROR 10.4\n";exit} | ||
74 | "10.10.20.0" | ||
75 | } | ||
76 | expect { | ||
77 | timeout {puts "TESTING ERROR 10.5\n";exit} | ||
78 | "0.0.0.0" | ||
79 | } | ||
80 | expect { | ||
81 | timeout {puts "TESTING ERROR 10.6\n";exit} | ||
82 | "eth0" | ||
83 | } | ||
84 | expect { | ||
85 | timeout {puts "TESTING ERROR 10\n";exit} | ||
86 | "home" | ||
87 | } | ||
88 | sleep 1 | ||
89 | |||
90 | puts "\n" | ||
91 | |||