Google CTF: Beginner Quest: OCR IS COOL! (Simple Cryptography)
Key Takeaways
Recovers original text from a screenshot using OCR for the Google CTF OCR is cool challenge
Full Transcript
What is up everybody? John Hammond here still looking at some of the Google capture the flag competition and uh the beginner's quest content. So before we jump into that, quick shout out to Live Overflow who is another awesome YouTuber. Um does the same cyber security capture flag hacking content stuff that I do and he was willing to play and take a look at the Google CTF with me this past weekend. Uh he looked at some legitimate hardcore challenges. Um, Google CTF puts out some significant brain teasers and and uh pretty difficult challenges for a capture the flag competition. Stuff that's over my head, but we took a gander at one of the web challenges, JSafe 2.0. Uh, and he was able to solve it. He did some really awesome reverse engineering work with it and debugging and cool stuff. Um, so props to him. Um, and hopefully we'll be able to cover some more video content together. Um, but if you haven't seen him before, check him out on YouTube, subscribe to his stuff, and uh we'll work together soon. So, let's go back to Google Captures Flag. A little bit of the beginner's quest. I'll showcase what I can here. And let's move to one of the later miscellaneous challenges up at the top here after that path is opened up. This challenge is called OCR is cool. Um, Caesar once said, "Don't stab me." But taking a screenshot of an image sure feels like being stabbed. You connect to a VNC server on the Fubizer 9000. It was view only. Screenshot is alo is present, but it's gibberish. Can you recover the original text? So, let's go ahead and download this attachment. See what we've got to work with. I'm working in a uh my own directory here, GCTF. Um, and let's call this OCR is cool to match the challenge prompt. That challenge here. And let's actually get a command line open so we can work with this. Let's get into OCR is cool. Looks like we have another hash file name here. It's a zip archive. So, let's move that to um OCR.zip. Unzip it. And now we've got OCR is cool.png. Let's see what this file is. It looks like a Gmail email. So, okay, Google mail email. Um, your eyeropper drive is ready. The content of this email looks like gibberish, just like the challenge said. Um, I don't know why or how. Hm. Okay, let's take a look here and figure out what this thing really is. OCR reference that that challenge title and that the challenge prompt is uh a note and a nod towards the optical character recognition. So, from an image being able to read out some of the plain text characters. So my methodology for challenge like this is for one thing get the image really really big. Um that way you can get better OCR or better optical character recognition. Um right now this is 199 by 1079. So 1,919 characters by,79 characters. Not that huge. Um so what I like to do is I like to use the convert command from the image magic suite and I'll convert that original image. OCR is cool. And I'll scale it like tax scale. And I'll make it like 200% or 300%. I don't know. Let's see what we go. See how we do with like output.png. It needs a needs a saving file name. And that might take a second, but now we have output.png, which is significantly larger, right? But it's still the same image, just scaled to be a lot larger. So now we can run an OCR program. And a good command line one that I know on Linux is called tesseract. Um if you don't have it installed I think you can pseudo apt install like tessoract tac ocr I think is a package name. Got to admit I don't know. Um but if you try to type tessoract it may be able to recommend it for you. So I can type tesseract on output.png and this says it needs a image name and an output base. So let's call it like out and it will run. May take a little bit of time but once we're done that output base name in this case I just specified out should be filled or created with a out.ext. Um, and again, this will take longer depending on the size of the image, but if you give it a good image with some highdefinition characters, hopefully you'll get better quality OCR process. So now we see we have an out.ext file. Let's try and view it. Cat out.ext. And this probably has some errors, right? I see compose. That works well. Your I drew us ready inbox. Some of these words aren't all coming through correctly. Dump drive blah blah blah. So, not the best results, but something we can still work with, I guess. Um, I wonder what this thing is, right? The challenge prompt here when we looked at Firefox said Caesar. So, maybe this is a Caesar cipher. Um, I tried to pipe this to rot 13, which is a command line program that's installed, um, when you pseudo app install BSD games. And if you actually look at the man page for it, it gives you a note that you also have another program like Caesar, which will give you an let you use an argument for the number of rotations that you want to use here. So, it will try and do a Caesar cipher. It attempts to decrypt Caesar ciphers using the English letter frequency statistics. Caesar reads from centered input and writes to centered output. So we can use that program Caesar if we wanted to. Let's pipe this to ROT 13. See if we get any results. Looks like not whatever. Okay. So let's try and bring it to Caesar. Caesar one still looks like nonsense. Caesar 2 still looks like nonsense, etc. Um, let's try and bring this through a loop through all of the possible letters and let's see if we can get anything. So, what I did is a four I in and then I use my curly braces and I go 0 dot dot 26. So, the alphabet's 26 characters long. Do cat out.ext. And if we done this right now, it looks like it'll run through 26 times. I'm trying to cat out that that thing. But let's pipe that into Caesar dollar sign I. So if we want to we can echo um inside of our do right because that's the noting our code block echo i dot dot dot dot. So we have a note of what iteration we're actually on. And let's less this so we can start to look through zero obviously not going to do much. Um one not going to do much. We can if we'd like do forward slash dot dot dot dot dot. So, we can Oh, that was probably a bad key to use because that will match just about anything. So, let's change this to um hyphen hyphen hyphen. Cool. So, now we can search for hyphens hyphens hyphens and we'll jump over and over again to the next iteration. Four still looks like nothing. Five still looks like nothing. Six still looks like nothing. Seven. I starting to see some English words here. We happy to welcome PP that's not real English but we're our newest cloud maybe file sharing place blah blah blah. So so wherever you go your files follow. Oh you can quickly there's this there's a flag there. There is what looks like a flag here. Um okay so we can determine that that is the key or is the Caesar cipher number that we want to use. So seven and we have the actual flag that we can grip or we can we can observe out of the image. So if I were to EOG the OCR is cool here we can zoom around. Okay. And that this text VMY inside the curly braces must be what we're actually going to work with. So let's background that so we can see it. Let's get nano open side by side. Flag dot Caesar. And we can if we wanted to write that out if you wanted to do it by hand. Not the best methodology because we want to do that all by C. uh OCR. But if we the flag honestly isn't going to be too long, so it'll be okay for us to try and type that out. Um at least I say that as I'm trying to say some filler filler statements. So I can actually type this all out. But now if we cat flag Caesar into Caesar 7 because we know that's the key. It says CTF Caesar cipher is a substitution cipher. So, we finally got the flag just like that. Cool. Again, this one's kind of hard to automate, so I didn't create a uh a get flag script for this when I was playing the game, but that methodology is what I used. I can jot that down in like a solution.ext if I wanted to to maybe create a write up later on. But that is how I solved that challenge. Um I kind of looked through, okay, what text can I get out with OCR? um looking at Caesar ciphers or possible keys for a Caesar cipher. Um and then found the flag and tried to ease it out on my own just like that. Cool. Let's mark this challenge as complete. And uh thank you guys for watching. I hope you're enjoying this and hope you're enjoying some of these videos. Um I know it is the beginner's quest, so it's not the hardcore real stuff of the Google capture the flag, but hey, we're all beginners in some way. We're all starting to learn and uh that's what's important, learning, getting better. So, another shout out to Live Overflow. Please check out some of his content. He's a really cool guy. Um and hopefully we'll be able to do more collaborative stuff pretty soon. Check out his channel. You totally should. Hey, if you'd like this video, please click that like button. Uh if you'd like to leave me a comment, let me know what you think. Let me know what else you'd like to see. Please do. If you're willing to subscribe, I would Thanks again. See you soon.
Original Description
If you would like to support me, please like, comment & subscribe, and check me out on Patreon: https://patreon.com/johnhammond010
E-mail: johnhammond010@gmail.com
PayPal: http://paypal.me/johnhammond010
GitHub: https://github.com/JohnHammond
Site: http://www.johnhammond.org
Twitter: https://twitter.com/_johnhammond
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from John Hammond · John Hammond · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Code Commentaries? PHP to JavaScript in Bash and PHP!
John Hammond
Tutorials? MySQL connection with PHP and Bash!
John Hammond
Variable Naming in Python! Happy Birthday, Linux! Nokia N900!
John Hammond
JavaScript Splits The URL!
John Hammond
HTML Tables in Python!
John Hammond
HTML, Net Shares, GML!
John Hammond
Python 08 Programming Style and Comments
John Hammond
Python 26 Object Oriented Programming
John Hammond
75 Python Tutorials, Out Now!
John Hammond
Batch 14 Mathematical Expressions
John Hammond
Batch 85 Array Append
John Hammond
Batch 86 Array Count
John Hammond
Batch 87 Array Index
John Hammond
Batch 88 Array Insert
John Hammond
Batch 89 Array Remove
John Hammond
Batch 90 Array Reverse
John Hammond
Python [colorama] 00 Installing on Linux
John Hammond
Python [colorama] 09 Cursor Position
John Hammond
Python [hashlib] 02 Algorithms
John Hammond
Python 00 Installing IDLE on Linux
John Hammond
Python [pygame] 11 Rectangular Collision Detection
John Hammond
Python [pygame] 12 Platforming Rectangular Collision Resolution
John Hammond
Python [XML-RPC] 01 Research
John Hammond
Python [pyenchant] 03 Personal Word Lists
John Hammond
FancyURLopener Authentication and User-Agent [urllib] 03
John Hammond
Python 04: PEP8 Coding
John Hammond
Python Challenge! 17 COOKIES
John Hammond
Google CTF 2016: Ernst Echidna
John Hammond
Google CTF 2016: Spotted Quoll
John Hammond
Google CTF 2016: Can you Repo It?
John Hammond
Google CTF 2016: No Big Deal
John Hammond
Google CTF 2016: In Recorded Conversation
John Hammond
Homemade CTF Challenge: 01 "Orchestra"
John Hammond
Homemade CTF Challenge: 02 "Bae's Base"
John Hammond
Homemade CTF Challenge: 03 "Web Hunt"
John Hammond
Homemade CTF Challenge: 04 "UPX"
John Hammond
Homemade CTF Challenge: 05 "The Assumption Song"
John Hammond
Homemade CTF Challenge: 06 "A Brisk Stroll"
John Hammond
Homemade CTF Challenge: 06 "I lost my password!"
John Hammond
web25 :: Mr. Robot : EKOPARTY CTF 2016
John Hammond
web50 : RFC 7230 :: EKOPARTY CTF 2016
John Hammond
misc50 : Hidden inside EKO :: EKOPARTY CTF 2016
John Hammond
Hack The Vote 2016 CTF: Sander's Fan Club [web100]
John Hammond
Hack The Vote 2016 CTF Warpspeed [forensics150]
John Hammond
Juniors CTF 2016 :: Black Suprematic Square
John Hammond
Juniors CTF 2016 :: Six Strange Tales
John Hammond
Juniors CTF 2016 :: Lost Code
John Hammond
Juniors CTF 2016 :: Here Goes!
John Hammond
Juniors CTF 2016 :: Southern Cross
John Hammond
Juniors CTF 2016 :: Clone Attack
John Hammond
Juniors CTF 2016 :: Dirty Repo
John Hammond
Juniors CTF 2016 :: Hackers Blog
John Hammond
Juniors CTF 2016 :: Voting!!!
John Hammond
Juniors CTF 2016 :: The Good, The Bad and The Junkman
John Hammond
Juniors CTF 2016 :: Stop Thief!
John Hammond
Juniors CTF 2016 :: ROFL
John Hammond
Juniors CTF 2016 :: Restriced Area
John Hammond
Juniors CTF 2016 :: Oh SSH!
John Hammond
HackCon CTF 2017 TRIVIA and BONUS Challenges
John Hammond
HackCon CTF 2017 "Bacche" Challenges
John Hammond
Related Reads
📰
📰
📰
📰
The AI spending debate seems to have changed this week.
Reddit r/artificial
The AI giants just broke with OpenAI and Anthropic on open weights
The Next Web AI
Meta leaves RE100 clean energy pact after a decade as its gas buildout for AI outpaces renewables
The Next Web AI
AI As The Official Reason You Got Laid Off
Medium · AI
🎓
Tutor Explanation
DeepCamp AI