貳:+自动登录文件系统
$cat /mnt/squashfs-root/txt
#!/usr/bin/expect
sleep 5
set timeout 5
spawn "/bin/login"
expect "(none) login: " { send "root\n" }
expect "Password: " { send "ecoo1234\n" }
interact
$
chmod +x /mnt/squashfs-root/txt
$ cat /etc/profile
...
ip link set eth0 up
sleep 5
route add -net 192.168.1.0 netmask 255.255.255.0 dev eth0 && ifconfig eth0 192.168.1.10 && ip route add default via 192.168.1.1 && rm -r /etc/resolv.conf; echo "nameserver 114.114.114.114" > /etc/resolv.conf
cd /mnt/squashfs-root; mount -t devtmpfs none dev; mount -t sysfs none sys; mount -t devpts -o gid=5,mode=620 more dev/pts; mount -t proc proc proc; mount -t tmpfs none tmp; chroot ./ /txt
#must execute by bash here, not dash.
a=(` mount `)
str=/mnt/squashfs-root/
for word in ${a[*]}; do
if [[ $word == *$str* ]]; then
echo $word | awk -v m=$str '{gsub(m, ""); print}' |
tee umount
fi
done
poweroff
$
注:后来发现,应用下载的busybox static binary去mount --bind这些特殊分区,否则我这里会出现问题。