Skip to content

Instantly share code, notes, and snippets.

@chadbrewbaker
Created February 16, 2018 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chadbrewbaker/8a2af91e9b0ec11f3bc81a5486513dda to your computer and use it in GitHub Desktop.
Save chadbrewbaker/8a2af91e9b0ec11f3bc81a5486513dda to your computer and use it in GitHub Desktop.
Script for SecDSM MiniCTF
from PIL import Image
import io
import base64
import pytesseract
URI = 'http://ctf.secdsm.org:5557'
from subprocess import call
import urllib
import urllib2
response = urllib2.urlopen(URI)
html = response.read()
x = html.split('/')
y =filter(lambda k: 'png' in k, x)
img = y[0]
imgsplit = img.split()
print imgsplit[0]
theImage = imgsplit[0]
prefix = 'https://ctf.secdsm.org:5556/'
urllib.urlretrieve(prefix+theImage, theImage)
text = pytesseract.image_to_string(Image.open(theImage))
print text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment