 Hey, what's going on everybody? My name is John Hammond. Welcome back to another video still showing off the hacked the vote CTF capture flag competition that was going on this past weekend on November 4th to November 6th I didn't solve a whole ton of challenges and I'm recording these videos in advance So it is still Saturday although I want to show off next. That's 150 point of forensics question It got a lot of solves 290 because it wasn't extremely difficult. It just took a little bit of scripting So the challenge is called warp speed and it says our trump advertising campaign is incredible It's skyrocketing its astronomical weights all down etc So we get this file warp speed And it's a jpeg image and it's crazy jumbled up and and messed up so I See clear text here. I see the word trump and I don't know what stuff is over on the side here And I'm curious what all this this this is although I think I see like the beginning letters f l a g for flag So this we clearly have to be able to like decipher this in in some way So what I'm gonna end up doing is going ahead and starting to script this solution I Admittedly have already solved this because I have the flag and that's why I'm recording this right up, but I Want to just showcase the code that I wrote the simple python stuff that I that I whipped out So I won't go into too much depth as to how I ended up like viewing all of this although admittedly I just like open it in color paint and try to view the width and heights and Mentally piece together what has been done the image, but anyway, let's just create a hack the vote Directory we'll get in there and we'll make directory for warp speed and then we'll save this image totally in there Warp speed and I'm just gonna call this warp speed dot jpeg. I'm removed a hash in here Cool, so let's start up a sublime text And I'm gonna create a new script in My hack the vote warp speed Ape Python and I'll zoom in a bit so you can actually see this stuff Throw much a bang line as usual And hopefully I can whip this stuff out So I use Python's imaging library Python image library pill and all I actually need from it is the Image portion And I go ahead and open the thing warp This should be Capital image and I'll just call it image. Okay, and admittedly while I was checking out the File in color paints, that's not I Saw all of the bars for one thing are shifted. They're offset like each row is offset by About each okay, so each row is eight pixels high for one thing. I Saw that by putting in grid mode and examining each like section You can see just down at the bottom. I've selected about eight. I don't know if you can barely see that And it that they've all been like rolled to the left So I ended up like assuming if I take this like 32 times I saw I have to take this 500 like with image Rolled about eight times for each one. I went through about 32 iterations of it. So I did a For loop here and I ended up cropping each like portion cropping each section I should just call it a region and I did image crop Starting from the very left going from that eight width pixel high in each like 32 Or like the multiplication iteration of how far I'm going and then I got the entire image Which the width is about a thousand and again, I did the next portion of that That height eight and I just I multiply by one here. So I got that box. It got each region The 8-bit portion and it shifts it over. I'm gonna end up doing is I'm gonna move that on to Pace it backwards pretty much Again, I'm just using eight times I to index each call or each each row Plus one because we want to move on to the next row. So So now I want to check out that image or see what we have so far. I'll run this and I I can't really zoom in that well, but hopefully you can see that okay now Trump is aligned and the November 28th Or whatever that actually is supposed to say is is put together and now I notice Again, I can't zoom in on this. I'm sorry but it looks like They're they're kind of shuffled like each column has now been shuffled a little bit I see like the start of a curly brace beginning here and the next End of a curly brace on the other side I see this start of an end at the very top here on the right is missing on the left It's like each one of them has been shuffled in an alternating order and You because you see this pattern going back and forth throughout it. So Then I whipped out some quick another another strange kind of loop to To put those together and the width of the image now is still a thousand So since there are two of them and I'm trying to just jam them together I ended up creating a like 500 by 500 image. So I do that here I call it image to Gosh, I should learn to type again, I just said I use 500 by 500 image And I alternated through those 32 rows again but I just use like a a quick Again, this is the quick code that you write during a CTF I determined that I was using like a first half by it like a Boolean and I did this by for I Range 64 this time here. Actually, I think it was it was Q. I Did like Yeah, I use an I and a Q I like to use a while loop because I wanted to keep track of two different Variables at the same time. So while I was less than 64 what I ended up doing was I would determine Okay, is this the first half is my thing still true and I grabbed the region again image dot crop This time again the zero eight times the row or the column that I'm actually looking at Sorry in the row. I should I should say again 500 being my width and I get the Height of it being or my Y2 in this case being eight times it etc I do an else in case it's not because I'm alternating with every duration So I'll toggle that first half Boolean value and I go from the 500 and because when it's when it's, you know X2 or x1 x2 for these values You can check out the documentation for image dot crop if you need to but it just takes an x1 x2 Y1 y2 for the the section or the selection that's actually trying to Crop out and regions variable end up creating and Then we just paste it onto the Q that we're working through each time Which I just used to index each individual row Since now they're being combined, you know again. I'm just putting them all in one That's why I only go from 0 to 500 for the X values and now my Q iterates after each row that I do For after I've determined what the region is and I'll toggle that first half variable So it alternates each row as I go through it Now we should be able to image to show because that's the one that we've started to work with and this is somewhat readable I would again try to zoom in on this for you but flag Leet photo skills, I'll save this so you can see it a little better So now you can get to our terminal and we can EOG winner Once I'm in warp speed Once I'm in warp speed and I'll zoom in on this. Can I rotate it for you rotate? Dang it. I chose the wrong one Okay Now you can see flag 1337 Like leet Leet photo skills SK one or maybe one LL five lead photo skills and that's our flag to submit crazy Pretty disgusting Python code But again, it's the kind of thing that you whip out during a CTF. So thanks for watching guys. Hope you enjoyed it Really, it was just two effects that I was trying to unwrap or unravel for the for the get in the flag That roll effect by offsetting each of the rows and then that shuffled card effects and sort of like alternated on one side to another So hope you guys enjoyed and I'll see you in the next video. Bye