Skip to content

Instantly share code, notes, and snippets.

@toby-bro
Created August 4, 2025 17:17
Show Gist options
  • Select an option

  • Save toby-bro/82e8c2e4854af984d2cc6a4c04a0d04c to your computer and use it in GitHub Desktop.

Select an option

Save toby-bro/82e8c2e4854af984d2cc6a4c04a0d04c to your computer and use it in GitHub Desktop.
Get the CTF's that are counted by ctftime for the team score (the 10 best)
#!/bin/bash
TEAM=00001 #REPLACE WITH THE TEAM NUMBER THAT INTERESTS YOU
table=$(curl -s https://ctftime.org/team/${TEAM} | grep -P '<div class="tab-pane active" id="rating_202\d"' -A 999 | grep -P '<div class="tab-pane" id="rating_202\d"' -B 999 | grep -P '<tr><td class="place_ico"></td><td class="place">\d+</td><td><a href="/event/\d+">[\s\w\d]+</a></td><td>[\d\.]+</td><td>[\d\.]+</td></tr>'); for i in $(echo $table | grep -Po '(?<=<td>)[\d\.]+(?=</td></tr>)' | sort -h | tail -n 10) ; do echo -n "$i -- "; echo $table | grep $i | grep -Po '(?<=<a href="/event/\d{4}">)[\w\s\d]+(?=</a>)' ; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment