]> git.somenet.org - ctf/pub/submit_bot.git/blob - index_serviceflags.php
modified: submitbot_tcp.py
[ctf/pub/submit_bot.git] / index_serviceflags.php
1 <?php
2 /** board script
3 * Displayes the submitted flowIDs of the
4 * last X time with meta information
5 * If the submission to gameserver was successfull (submitsuccess)
6 * and we got points for it (scoresuccess) it should be green bg
7 *
8 * 2014-16 by Jan "Someone" Vales <someone@somenet.org>
9 * do not publish!
10 */
11
12 $GLOBALS['db'] = new PDO('pgsql:host=localhost;port=5432;dbname=flagbot;user=flagbot;password=flagbotpw');
13 $GLOBALS['db']->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
14
15 $query = "SELECT count(*) as count , submitter, service, status FROM flags WHERE (received + INTERVAL '30 minute') > now()  group by submitter, service, status order by count DESC";
16
17 if (isset($_REQUEST['all'])) $query = "SELECT count(*) as count , submitter, service, status FROM flags group by submitter, service, status order by count DESC";
18
19 ?>
20 <!DOCTYPE html>
21   <html>
22   <head>
23     <link rel="stylesheet" type="text/css" href="styles.css"></link>
24   </head>
25   <body>
26     <h1>Submission Board - Services/Exploits and their Flags</h1>
27     <p><a href="./index_serviceflags.php">Service + Exploit flags</a> <a href="./index_serviceflags.php?all">Alltime Service + Exploit flags</a> <a href="./index.php">Flaglist</a> <a href="./index_flag_ids.php">go to flag_ids</a></p>
28     <?php if (!isset($_REQUEST['all'])) echo '<p>Shows all submissions of the last 30 min<br>'; ?>
29
30     NUM ROWS: <?php echo sizeof($GLOBALS['db']->query($query)->fetchAll()); ?></p>
31     <table style="width: 100%">
32       <thead>
33         <tr>
34             <th>count</th>
35             <th>service</th>
36             <th>submitter</th>
37             <th>status</th>
38           </tr>
39         </thead>
40         <tbody>
41           <?php
42           $stmt = $GLOBALS['db']->query($query);
43           while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
44           ?>
45             <tr class="score-<?php echo $row['status']; ?>">
46               <td><?php echo $row['count']; ?>&nbsp;</td>
47               <td><?php echo $row['service']; ?>&nbsp;</td>
48               <td><?php echo $row['submitter']; ?>&nbsp;</td>
49               <td><?php echo $row['status']; ?></td>
50             </tr>
51             <?php
52           }
53           ?>
54         </tbody>
55       </table>
56     <p>Status: 0=submission pending; 1=submitted:OK; 2=submitted:Fail</p>
57     </body>
58     </html>