diff --git a/pi-gen/stageDTPM3/01-proxmark3/00-run-chroot.sh b/pi-gen/stageDTPM3/01-proxmark3/00-run-chroot.sh index 29fa9b6..838e38d 100644 --- a/pi-gen/stageDTPM3/01-proxmark3/00-run-chroot.sh +++ b/pi-gen/stageDTPM3/01-proxmark3/00-run-chroot.sh @@ -4,7 +4,5 @@ su - dt git clone https://github.com/RfidResearchGroup/proxmark3 cd proxmark3 echo PLATFORM=PM3GENERIC > Makefile.platform -#make clean && make -j +make clean && make exit -#make install - diff --git a/pi-gen/stageDTPM3/03-ttyd/00-run-chroot.sh b/pi-gen/stageDTPM3/03-ttyd/00-run-chroot.sh index 91566c7..512a039 100644 --- a/pi-gen/stageDTPM3/03-ttyd/00-run-chroot.sh +++ b/pi-gen/stageDTPM3/03-ttyd/00-run-chroot.sh @@ -1,16 +1,71 @@ #!/bin/bash -e -#cd /usr/local/bin -wget https://github.com/tsl0922/ttyd/releases/download/1.6.3/ttyd.aarch64 -wget https://github.com/tsl0922/ttyd/releases/download/1.6.3/ttyd.armhf -wget https://github.com/tsl0922/ttyd/releases/download/1.6.3/ttyd.arm +cd /usr/local/bin +for i in aarch64 arm armhf +do + wget https://github.com/tsl0922/ttyd/releases/download/1.6.3/ttyd.${i} +done + +case `uname -m` in + "armv7l") model=armhf ;; + "aarch64") model=aarch64 ;; + *) model=arm ;; +esac + +cp ttyd.${model} /usr/local/bin/ttyd +chown root:root /usr/local/bin/ttyd +chmod a+x /usr/local/bin/ttyd + +cat > /etc/systemd/system/ttyd-bash.service << EOF +[Unit] +Description=Web Terminal Service running Bash +After=network.target + +[Install] +WantedBy=multi-user.target + +[Service] +User=dt +WorkingDirectory=/home/dt +ExecStart=/usr/local/bin/ttyd -p 8000 -u dt -m 1 -c dt:proxmark3 /usr/bin/bash +Restart=always +Type=simple +RestartSec=1 -cat << EOF > /usr/local/bin/ttyd -#! /bin/bash -/usr/local/bin/ttyd.`/usr/bin/uname -m` $@ EOF -chown root:root /usr/local/bin/ttyd* -chmod a+x /usr/local/bin/ttyd* +cat > /etc/systemd/system/ttyd-pm3.service << EOF +[Unit] +Description=Web Terminal Service for PM3 +After=network.target +ConditionFileIsExecutable=/usr/local/bin/pm3 +[Install] +WantedBy=multi-user.target + +[Service] +User=dt +WorkingDirectory=/home/dt +ExecStart=/usr/local/bin/ttyd -p 8080 -u dt -m 1 /usr/local/bin/pm3 +Restart=always +Type=simple +RestartSec=1 + +EOF + +chmod 755 /etc/systemd/system/ttyd*.service +chown root:root /etc/systemd/system/ttyd*.service + +if [ ! -L /etc/systemd/system/multi-user.target.wants/ttyd-bash.service ] +then + ln -s /etc/systemd/system/ttyd-bash.service /etc/systemd/system/multi-user.target.wants +fi + +if [ ! -L /etc/systemd/system/multi-user.target.wants/ttyd-pm3.service ] +then + ln -s /etc/systemd/system/ttyd-pm3.service /etc/systemd/system/multi-user.target.wants +fi + +cd /home/dt/proxmark3 +make install