Last active
April 4, 2017 15:40
-
-
Save und3ath/f018d4bf981457d9aa8d460281f3ffcb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
you need to download latest compiled snapshot of QEMU for windows and add the folder path to your PATH env . | |
you need also osfmount wich used to mount hda image fo extract vmlinuz and initrd after installation . | |
a least you need a vnc client (qemu kvm console in windows suck ( wrong keymap, dead keyboard alt ctrl touch ) , use the tightvnc-jviewer.jar standlone client ; | |
the script bellow download the latest ubuntu netinstall bootstrap for armhf , create a 16Go raw disk image and start installation | |
##################################" begin install step | |
@echo off | |
SET QEMU=C:\Program Files\qemu | |
echo 'Download Ubuntu Net install files.' | |
powershell -command "& { iwr http://ports.ubuntu.com/ubuntu-ports/dists/xenial-updates/main/installer-armhf/current/images/generic-lpae/netboot/initrd.gz -Outfile install-initrd.gz }" | |
powershell -command "& { iwr http://ports.ubuntu.com/ubuntu-ports/dists/xenial-updates/main/installer-armhf/current/images/generic-lpae/netboot/vmlinuz -Outfile install-vmlinuz }" | |
echo 'Create the hdd (16Gb)' | |
"%QEMU%\qemu-img" create -f raw ubuntu.img 16G | |
echo 'The installation process will start' | |
echo 'Please connect vnc client to localhost to open kvm console' | |
echo 'alt+ctrl+[1,2,3] to switch qemu console input [serial should be 2]' | |
echo 'When installation is finished, close quemu and run postinstall.bat script' | |
echo 'to extract vmlinuz and initrd.gz file.' | |
"%QEMU%\qemu-system-arm.exe" -M virt -m 2048M^ | |
-kernel install-vmlinuz^ | |
-initrd install-initrd.gz^ | |
-drive if=none,file=ubuntu.img,id=hd,format=raw^ | |
-device virtio-blk-device,drive=hd^ | |
-netdev user,id=mynet^ | |
-device virtio-net-device,netdev=mynet^ | |
-vnc :0 -k fr^ | |
-no-reboot | |
########################### end install step | |
The installation step finished, we need to extract vmlinuz and initrd to boot properly our arm vm . | |
########################### begin postinstall step | |
@echo off | |
echo 'Mouting /boot/ partition ...' | |
"%cd%\osfmount\osfmount.com" -a -t file -f "%cd%\ubuntu.img" -m "Z:" | |
if not exist Z:\ ( | |
echo 'Unable to mount, maybe Z: is already used ?' | |
quit | |
) | |
echo 'Copy initrd.gz and vmlinuz ..' | |
xcopy Z:\vmlinuz-* "%cd%\" | |
xcopy Z:\initrd-*.gz "%cd%\" | |
echo 'Unmouning ..' | |
"%cd%\osfmount\osfmount.com" -D -m Z: | |
#################################### end postinstall step | |
#################################### booting step | |
@echo off | |
SET QEMU=C:\Program Files\qemu | |
REM set the approprate filename for the kernel and initrd with the name of previously extracted from /boot partition . | |
SET kernel=vmlinuz | |
SET initrd=initrd.gz | |
SET hdd=ubuntu.img | |
"%QEMU%\qemu-system-arm.exe" -M virt -m 2048M^ | |
-kernel %kernel%^ | |
-initrd %initrd%^ | |
-drive if=none,file=%hdd%,id=hd^ | |
-device virtio-blk-device,drive=hd^ | |
-netdev user,id=mynet^ | |
-device virtio-net-device,netdev=mynet^ | |
-vnc :0 -k fr^ | |
##################################### end boot vm step | |
Some post install notice | |
if u need portfowarding ( to ssh or vnc .... ) modifie the following parameter -netdev user,id=mynet to -netdev user,id=mynet,hostfwd=tcp::2222-:22 | |
# install common deps. | |
apt-get update | |
apt-get install build-essential gdb strace git autoconf autogen | |
# Pour un ltrace pas daubé. | |
git clone git://git.debian.org/git/collab-maint/ltrace.git | |
cd ltrace &&./autogen.sh && ./configure && make && make install | |
# Install pwntools | |
apt-get install python2.7 python-pip python-dev git libssl-dev libffi-dev build-essential | |
pip install --upgrade pip | |
pip install --upgrade pwntools | |
# install pwndbg .. etc ; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment