This guide is implemented in hostfs_builder.sh
Create a hostfs with a tool like buildroot https://github.com/getCUJO/MIPS-X/blob/main/hostfs_builder/buildroot_notes.txt or download a qcow2 from https://people.debian.org/~aurel32/qemu/
Boot into the hostfs with qemu and copy from hostfs_builder directory etc/network/interfaces to hostfs in qemu /etc/network/interfaces
and run
service networking restart
Check with ifconfig that eth0 has 192.168.100.2. This is important. If yes, test ping 192.168.100.1
Copy root/.ssh/authorized_keys to hostfs /root/.ssh/authorized_keys
chmod 400 authorized_keys
Copy from etc/profile.d/armx.sh to hostfs /etc/profile.d/armx.sh
chmod 700 /etc/profile.d/armx.sh
mkdir /armx
echo "\n192.168.100.1:/armx /armx nfs intr,nolock,noauto 0 0\n" >> /etc/fstab
Copy from hostfs_builder root/test-eth0.sh and etc/crontabs/root
chmod 700 /root/test-eth0.sh
Copy from hostfs_builder etc/ssh/ssh_host_dsa_key and etc/ssh/ssh_host_rsa_key
Add add to /etc/rc.local before the exit 0 line
mount /armx
Download or compile a static gdbserver binary. This guide worked for me: https://wiki.muc.ccc.de/ctf:compile
Copy the binary to /usr/sbin/gdbserver
chmod 700 /usr/sbin/gdbserver
Add whatever into /etc/issue
In order to use the menu from armx, or to add new packages from repo to the hostfs, I found the following way to have a network with proxy in the QEMU:
- Start a network proxy on your host. Use Burp Suite, or something like https://github.com/inaz2/SimpleHTTPProxy
- Start socat for DNS forwarding
sudo socat UDP4-RECVFROM:53,fork UDP4-SENDTO:8.8.8.8:53 - Change the nameserver in /etc/resolv.conf to 192.168.100.1
- In case you are using a debian qcow2 configure apt to use proxy
echo 'Acquire::http::Proxy "http://192.168.100.1:8080/";' > /etc/apt/apt.conf.d/proxy.conf - In case you are using a debian qcow2 change the apt repositories. Replace everything http://ftp. and http://security. to http://archive.
- apt-get should work
apt-get --allow-unauthenticated update
apt-get --allow-unauthenticated install dialog mc
Change the SSHD port from 22 to 22222 in /etc/sshd_config The restart with
service ssh restart