root@gawa root]# cd /usr/local/BootServer/tftpboot/firm/ [root@gawa firm]# ls initrd.boot* uImage* [root@gawa firm]# dd if=initrd.boot of=initrd.gz bs=64 skip=1 読み込んだブロック数は 113253+1 書き込んだブロック数は 113253+1 [root@gawa firm]# mkdir /mnt/pc-p1lan [root@gawa firm]# mv initrd.gz /mnt/pc-p1lan [root@gawa firm]# cd /mnt/pc-p1lan/ [root@gawa pc-p1lan]# gunzip initrd.gz [root@gawa pc-p1lan]# mv initrd initrd.orig [root@gawa pc-p1lan]# cp initrd.orig initrd
[root@gawa pc-p1lan]# mkdir /tmp/root [root@gawa pc-p1lan]# mount -o loop initrd /tmp/root [root@gawa pc-p1lan]# df ファイルシステム 1k-ブロック 使用中 空き 使用% マウント場所 /dev/hda1 2071384 1040032 926128 53% / none 63756 0 63756 0% /dev/shm /dev/hda3 285857724 39215052 232121924 15% /mnt /mnt/pc-p1lan/initrd 15863 13320 2543 84% /tmp/root [root@gawa pc-p1lan]#
以前 P1LAN では、inetd が起動していて、telnet すると、
[root@giga root]# telnet p1lan Trying 192.168.1.51... Connected to p1lan. Escape character is '^]'. telnetd: bind: Address already in use Connection closed by foreign host. [root@giga root]#となることを見つけた。
inetd から telnet を起動しないようにすれば
telnetd: bind: Address already in use
から
Connection refused
になって、書き換えられた事がわかるのではないか。
[root@gawa pc-p1lan]# pushd /tmp/root/etc /tmp/root/etc /mnt/pc-p1lan [root@gawa etc]# cat inetd.conf #telnet stream tcp nowait root /sbin/telnetd /sbin/telnetd telnet stream tcp nowait root /sbin/telnetd telnetd -l /bin/login #sshd support added below #sshd support added below #ssh stream tcp nowait root /usr/sbin/sshd sshd -i -q -f /etc/ssh/sshd_config [root@gawa etc]# vi inetd.conf : : [root@gawa etc]# cat inetd.conf #telnet stream tcp nowait root /sbin/telnetd /sbin/telnetd #telnet stream tcp nowait root /sbin/telnetd telnetd -l /bin/login #sshd support added below #sshd support added below #ssh stream tcp nowait root /usr/sbin/sshd sshd -i -q -f /etc/ssh/sshd_config [root@gawa etc]# popd /mnt/pc-p1lan [root@gawa pc-p1lan]# umount /tmp/root
[root@gawa pc-p1lan]# cat mkinitrd.boot.sh # tools/mkimage -A arch -O os -T type -C comp -a addr -e ep \ # -n name -d data_file image # -A ==> set architecture to 'arch' # -O ==> set operating system to 'os' # -T ==> set image type to 'type' # -C ==> set compression type 'comp' # -a ==> set load address to 'addr' (hex) # -e ==> set entry point to 'ep' (hex) # -n ==> set image name to 'name' # -d ==> use image data from 'datafile' # #[root@gawa u-boot-1.1.4]# ./tools/mkimage -l /tmp/p1lan/initrd.boot #Image Name: RAM Disk #Created: Sat Dec 17 16:43:56 2005 #Image Type: ARM Linux RAMDisk Image (gzip compressed) #Data Size: 7248200 Bytes = 7078.32 kB = 6.91 MB #Load Address: 0x00000000 #Entry Point: 0x00000000 # # u-boot-1.1.4/tools/mkimage \ -A "ARM" \ -O "Linux" \ -T "ramdisk" \ -C "gzip" \ -a "0x00000000" \ -e "0x00000000" \ -n "RAM Disk" \ -d "initrd" \ /usr/local/BootServer/tftpboot/firm/initrd.boot ls -l /usr/local/BootServer/tftpboot/firm/ [root@gawa pc-p1lan]#
[root@gawa pc-p1lan]# pushd /usr/local/BootServer /usr/local/BootServer /mnt/pc-p1lan [root@gawa BootServer]# ls fwupdated* rarpcfgd* rarpd* tftpboot/ tftpboot_1.00/ tftpd* [root@gawa BootServer]# mv tftpboot tftpboot_1.11 [root@gawa BootServer]# mkdir tftpboot [root@gawa BootServer]# (cd tftpboot_1.11; tar cf - .)|(cd tftpboot; tar xvf -) ./ ./files ./version ./firm/ ./firm/initrd.boot ./firm/uImage [root@gawa BootServer]# popd /mnt/pc-p1lan [root@gawa pc-p1lan]#
[root@gawa pc-p1lan]# sh mkinitrd.boot.sh Image Name: RAM Disk Created: Wed Feb 4 21:27:49 2006 Image Type: ARM Linux RAMDisk Image (gzip compressed) Data Size: 16777216 Bytes = 16384.00 kB = 16.00 MB Load Address: 0x00000000 Entry Point: 0x00000000 合計 17292 -rwxr--r-- 1 yasunari yamasita 16777280 Feb 4 21:27 initrd.boot -rwxr--r-- 1 yasunari yamasita 898316 Sep 24 18:41 uImage [root@gawa pc-p1lan]#
telnet してみる。
Connection refused になれば大正解
[root@gawa pc-p1lan]# telnet p1lan Trying 192.168.1.51... Connected to p1lan. Escape character is '^]'. telnetd: bind: Address already in use Connection closed by foreign host. [root@gawa pc-p1lan]#がー。大失敗。Address already in use のまま。
起動サーバを再起動する
[root@gawa pc-p1lan]# /etc/rc.d/init.d/ltbootd stop Stop services: rarpd/sbin/start-stop-daemon: warning: failed to kill 15262: No such process /sbin/start-stop-daemon: warning: failed to kill 15252: No such process /sbin/start-stop-daemon: warning: failed to kill 15250: No such process tftpd rarpcfgd/sbin/start-stop-daemon: warning: failed to kill 15264: No such process /sbin/start-stop-daemon: warning: failed to kill 15257: No such process fwupdated. [root@gawa pc-p1lan]# !:s/op/art/ /etc/rc.d/init.d/ltbootd start Starting services: rarpd tftpd rarpcfgd fwupdated. [root@gawa pc-p1lan]#注:「!:s/op/art/」って何してるか理解してから真似してくださいね。
[root@gawa pc-p1lan]# !telnet telnet p1lan Trying 192.168.1.51... telnet: connect to address 192.168.1.51: Connection refused [root@gawa pc-p1lan]#Good Job!
← U-Boot |
ハックの記録 PC-P1LAN をハックしよう |
→ PC-P1LAN に telnet |