Tuesday, October 16, 2012

hackyou CTF: Steg 100

A cursory reading of the text file in question revealed scattered capital letters within words. A quick script that grabbed all of the capital letters not at the beginning of words is shown below.
import re
# Read the file into a string
text = open('stg100.txt', 'r').read()
# Create a regex to replace all non-letters with
# a space to allow us to split.
letters = re.compile('[^a-zA-Z]+')
words = letters.sub(' ', text).split(' ')

answer = ''
for word in words: # Iterate through the words
    count = -1
    for letter in word: # Iterate the letters
        count += 1
        if count and letter.isupper():
            answer += letter # It is part of the flag

print answer
This script revealed the string FLAGISSEXYSTEGOPANDAS.

-- suntzu_II

No comments:

Post a Comment