110 likes | 260 Views
AP 專題 : web server & FSM. Student: 余尚哲 Perfessor: 李正帆教授. agenda. install usb key install web server filters Monitor FSM. install usb key (1). #Insert USB stick killall stupid-ftpd umount /tmp/harddisk/ fdisk /dev/discs/disc0/disc
E N D
AP專題 : web server & FSM Student: 余尚哲 Perfessor: 李正帆教授
agenda • install usb key • install web server • filters • Monitor FSM
install usb key (1) • #Insert USB stick killall stupid-ftpdumount /tmp/harddisk/fdisk /dev/discs/disc0/disc • #add two partition {3GB ext3, 1GB swap}fdisk /dev/discs/disc0/discmke2fs -j /dev/discs/disc0/part1mkswap /dev/discs/disc0/part2 reboot
install usb key (2) • #Post-boot Scriptmount /dev/discs/disc0/part1 /optswapon /dev/discs/disc0/part2touch /usr/local/sbin/post-boottouch /usr/local/sbin/commitchmod +x /usr/local/sbin/*vi /usr/local/sbin/post-bootvi /usr/local/sbin/commitcommit /usr/local/sbin/commit #!/bin/shflashfs saveflashfs commitflashfs enablereboot
install usb key (3) /usr/local/sbin/post-boot #!/bin/sh # Install USB serial communication insmod usbserial insmod pl2303 mknod /dev/ttyUSB0 c 188 0 chmod 666 /dev/ttyUSB0 /bin/sh < /dev/ttyUSB0 > /dev/ttyUSB0 2>&1 # wait for /opt to mount mount /dev/discs/disc0/part1 /opt i=0 while [ $i -le 30 ] && ! [ -d /opt/etc ]; do sleep 1 i=`expr $i + 1` done # Activate swap swapon /dev/discs/disc0/part2 # Run all active services /opt/etc/init.d/rc.unslung
install web server (1) /opt/etc/thttpd.confdir=/opt/share/www port=81 user=nobody nochroot nosymlink novhost logfile=/opt/var/log/thttpd.log pidfile=/opt/var/run/thttpd.pid • mkdir /opt/tmpmkdir /opt/tmp/ipkgipkg.sh updateipkg.sh install ipkg/opt/bin/ipkg update/opt/bin/ipkg install libiconv/opt/bin/ipkg install php-thttpdmkdir /opt/share/mkdir /opt/share/wwwvi /opt/etc/thttpd.conf mkdir /opt/varmkdir /opt/var/logmkdir /opt/var/runvi /opt/share/www/index.php /opt/share/www/index.php <?phpphpinfo();?>
Filter channel Name Type : TCP, HTTP GET From : 192.168.0.0/255.255.0.0 To : stat.ppstream.com(210.51.188.91), port 80 Data : pattern =>GET /action/notice.php?....&cn= <channel NAME> Filter Peerlist Type : UDP From :{60.28.213.175,61.172.196.108,121.9.201.98,125.46.57.13}, port 8000 To : <Host IP> Data : (offset = data frame offset ) Peer Number => offset 0x40, 1 Byte N th Peer IP =>offset 0x41+(16*(N-1)), 4 Byte N th Peer Port =>offset 0x41+(16*(N-1))+4, 2 Byte Filter
Monitor FSM (1) • Problem: • Only first play has HTTP request ,witch contained Channel Name • Idea: • On first play session: (Ch name & Peer List)Associate Peer List with Channel Name • On replay session: (Peer List)Looking for similar Peer List => find Channel Name