ctf-2011

old assets from capture-the-flag ictf 2011

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

index.html

(3466B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 	<head>
      4 		<title>Flag Tracker</title>
      5 		<link rel="stylesheet" href="screen.css" media="screen" type="text/css" />
      6 		<link rel="stylesheet" href="facebox/facebox.css" media="screen" type="text/css" />
      7 
      8 		<script src="jquery-1.6.2.min.js" type="text/javascript"></script>
      9 		<script src="facebox/facebox.js"></script>
     10 
     11 		<!--<script src="/rwthctf.js" type="text/javascript"></script>
     12 		<script src="/jquery-ui-1.8.16.custom.min.js" type="text/javascript"></script>-->
     13 		<script type="text/javascript">
     14 		$.fn.htmlTo = function(elem) {
     15         return this.each(function() {
     16             $(elem).html($(this).html());
     17         });
     18     }
     19     
     20     function convertScapyToHTML(str)
     21     {
     22       str = str.replace(/&/g, "&amp;");
     23       str = str.replace(/>/g, "&gt;");
     24       str = str.replace(/</g, "&lt;");
     25       str = str.replace(/"/g, "&quot;");
     26       str = str.replace(/'/g, "&#039;");
     27       str = str.replace(/#\[#/g, "<");
     28       str = str.replace(/#\]#/g, ">");
     29       str = str.replace(/\n/g, "<br/>");
     30       return str;
     31     }
     32     
     33     var loaded_items = []
     34     
     35     function updateFlags()
     36     {
     37       $.getJSON('/get/flags', function(data) {
     38          var items = [];
     39 
     40          data.reverse()
     41 
     42          $.each(data, function(key, val) {
     43            s = '<tr id="flags" class="'+ val[3] +'"><td>'+ val[0] +'</td><td class="direction">'+ val[3].toUpperCase() +'</td><td class="flag"><a href="#/get/'+ val[4] +'/'+ val[1] +'">'+ val[2] +'</a></td><td class="info">'+ convertScapyToHTML(val[5]) +'</td></tr>';
     44            
     45            if($.inArray(s, loaded_items) == -1) {
     46             loaded_items.unshift(s);
     47            }
     48            
     49            $('<table/>', {
     50               'class': 'flag-list',
     51               html: loaded_items.join('')
     52             }).htmlTo('div#flags');
     53 
     54 
     55             $("a[href*='#/get/']").click(function() { 
     56                $.getJSON(this.href.split('#')[1], function(data) {
     57                   var items = [];
     58 
     59                   $.each(data['packets'], function(key, val) {
     60                     items.push('<li id="packet">'+convertScapyToHTML(val)+'</li>');
     61                   });
     62 
     63                   $('<ul/>', {
     64                     'class': 'packet-list',
     65                     html: items.join('')
     66                    }).htmlTo('div#packets');
     67 
     68                   if(data['payload'] == null) {
     69                      $('div#packets').css('display', 'inline');
     70                   }
     71 
     72                   p = document.getElementById('payload');
     73                   p.innerHTML = '<h2>Stream content:</h1>'+convertScapyToHTML(data['payload']);
     74 
     75                   if(data['payload'] != null) {
     76                     $('div#payload').css('display', 'inline');
     77                   } else {
     78                     $('div#payload').css('display', ' none');
     79                   }
     80                  });
     81              });
     82           });
     83           });
     84     }
     85 		
     86 		$(document).ready(function() {
     87      // do stuff when DOM is ready
     88      
     89 		  document.getElementById('flags').innerHTML = ''
     90       updateFlags();
     91       //setInterval('updateFlags()', 5*1000);
     92      });
     93 		</script>
     94 	</head>
     95 	<body>
     96 		<div id="header">
     97 			<h1>Realtime Flag Tracker and Packet Analyzer</h1>
     98 		</div>
     99 		
    100 		<div id="flags">
    101 			<div>This page requires JavaScript to be enabled for insane fancyness.</div>
    102 		</div>
    103 		
    104 		<div id="packets", style="display: none;">
    105 		  No flag selected.
    106 	  </div>
    107 	  
    108 	  <div id="payload", style="display: none;">
    109 		  No flag selected.
    110 	  </div>
    111 	</body>
    112 </html>