ctf-2011

old assets from capture-the-flag ictf 2011

git clone https://9o.is/git/ctf-2011.git

steps

(1699B)


      1 #!/bin/bash
      2 
      3 #setup router with ubuntu
      4 sudo su
      5 
      6 apt-get update
      7 apt-get upgrade
      8 
      9 apt-get install openjdk-7-jre icedtea6-plugin python2.7 python2.7-dev python-scapy openvpn wireshark isc-dhcp-serve openssh-client openssh-server p7zip-full
     10 
     11 
     12 #Enable forwarding
     13 comment1="#net.ipv4.ip_forward=1"
     14 file1="/etc/sysctl.conf"
     15 sed -i "/"${comment1}"/ s/# *//" $file1
     16 sysctl -p
     17 
     18 # enable NAT & put it in /etc/rc.local to run it automatically during boot.
     19 iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
     20 echo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE >> /etc/rc.local
     21 
     22 #setup vpn files "sudo openvpn --config client.cfg"
     23 openvpn --config vpn/client.cfg
     24 
     25 #start ssh
     26 /etc/init.d/\ssh start
     27 
     28 #Setup DHCP
     29 echo subnet 10.13.147.0 netmask 255.255.255.0 \{ >> /etc/dhcp/dhcpd.conf
     30 echo range 10.13.147.10 10.13.147.99\; >> /etc/dhcp/dhcpd.conf
     31 echo option routers 10.13.147.1\; >> /etc/dhcp/dhcpd.conf
     32 echo \} >> /etc/dhcp/dhcpd.conf
     33 
     34 /etc/init.d/isc-dhcp-server restart
     35 
     36 #Set the IP of each team's workstation taking out one from 10.13.147.0/24 pool.
     37 #Set the 10.13.147.1 as a gateway.
     38 #Set the 10.13.147.3 as a vuln vm.
     39 
     40 #setup vm
     41 wget http://download.virtualbox.org/virtualbox/4.1.6/virtualbox-4.1_4.1.6-74713~Ubuntu~oneiric_amd64.deb
     42 dpkg -i virtualbox-4.1_4.1.6-74713~Ubuntu~oneiric_amd64.deb
     43 # vm is in vm/ folder
     44 #in VM
     45 # set passwd of user
     46 # set static ip 10.13.147.3/24
     47 # gw 10.13.147.1
     48 
     49 #setup firewall
     50 iptables --append FORWARD --in-interface eth0 --out-interface tun0 -j DROP
     51 iptables --append FORWARD --in-interface tun0 --out-interface eth0 -j DROP
     52 iptables --append FORWARD -s 10.13.147.3 --out-interface eht0 -j DROP
     53 iptables --append FORWARD --in-interface eth0 -d 10.13.147.3 -j DROP