From c79beb5a151e28e1185e380638073d259f0da24b Mon Sep 17 00:00:00 2001 From: netblue30 Date: Mon, 6 Mar 2023 16:09:33 -0500 Subject: testing --- test/network/ip6.exp | 48 ++++++++++++++++++++++++++++++++++++++++++++++ test/network/ip6.profile | 3 +++ test/network/net-print.exp | 34 ++++++++++++++++++++++++++++++++ test/network/network.sh | 6 ++++++ 4 files changed, 91 insertions(+) create mode 100755 test/network/ip6.exp create mode 100644 test/network/ip6.profile create mode 100755 test/network/net-print.exp (limited to 'test') diff --git a/test/network/ip6.exp b/test/network/ip6.exp new file mode 100755 index 000000000..e2e83fe0e --- /dev/null +++ b/test/network/ip6.exp @@ -0,0 +1,48 @@ +#!/usr/bin/expect -f +# This file is part of Firejail project +# Copyright (C) 2014-2022 Firejail Authors +# License GPL v2 + +set timeout 10 +spawn $env(SHELL) +match_max 100000 + +send -- "firejail --noprofile --net=br0 --ip6=2001:0db8:0:f101::1/64 ip addr show\r" +expect { + timeout {puts "TESTING ERROR 0\n";exit} + -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms" +} +expect { + timeout {puts "TESTING ERROR 1\n";exit} + "eth0" +} +expect { + timeout {puts "TESTING ERROR 2\n";exit} + "inet6" +} +expect { + timeout {puts "TESTING ERROR 3\n";exit} + "2001:db8:0:f101::1/64" +} +sleep 1 + +send -- "firejail --profile=ip6.profile ip addr show\r" +expect { + timeout {puts "TESTING ERROR 4\n";exit} + -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms" +} +expect { + timeout {puts "TESTING ERROR 5\n";exit} + "eth0" +} +expect { + timeout {puts "TESTING ERROR 6\n";exit} + "inet6" +} +expect { + timeout {puts "TESTING ERROR 7\n";exit} + "2001:db8:0:f101::1/64" +} +after 500 +puts "\nall done\n" +exit diff --git a/test/network/ip6.profile b/test/network/ip6.profile new file mode 100644 index 000000000..d4611ec41 --- /dev/null +++ b/test/network/ip6.profile @@ -0,0 +1,3 @@ +net br0 +ip6 2001:0db8:0:f101::1/64 +#netfilter6 ipv6.net diff --git a/test/network/net-print.exp b/test/network/net-print.exp new file mode 100755 index 000000000..691114cf4 --- /dev/null +++ b/test/network/net-print.exp @@ -0,0 +1,34 @@ +#!/usr/bin/expect -f +# This file is part of Firejail project +# Copyright (C) 2014-2023 Firejail Authors +# License GPL v2 + +set timeout 10 +spawn $env(SHELL) +match_max 100000 + +send -- "firejail --name=test --net=br0 --ip=10.10.20.9\r" +expect { + timeout {puts "TESTING ERROR 0\n";exit} + -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms" +} +sleep 1 + +spawn $env(SHELL) +send -- "firejail --net.print=test\r" +expect { + timeout {puts "TESTING ERROR 1\n";exit} + "lo" +} +expect { + timeout {puts "TESTING ERROR 2\n";exit} + "eth0" +} +expect { + timeout {puts "TESTING ERROR 3\n";exit} + "10.10.20.9" +} + +after 500 + +puts "\nall done\n" diff --git a/test/network/network.sh b/test/network/network.sh index 319927493..877f16156 100755 --- a/test/network/network.sh +++ b/test/network/network.sh @@ -27,8 +27,14 @@ echo "TESTING: network scan (net_scan.exp)" echo "TESTING: netfilter (net_netfilter.exp)" ./net_netfilter.exp +echo "TESTING: print network (net-print.exp)" +./net-print.exp + echo "TESTING: print dns (dns-print.exp)" ./dns-print.exp +echo "TESTING: ipv6 (ip6.exp)" +./ip6.exp + sudo ip link set br0 down sudo brctl delbr br0 -- cgit v1.2.3-54-g00ecf