 What's up, YouTube? This is a video right up for the challenge Garfield from the cryptography category of ICTF. Sorry, this video is a little bit late. I have admittedly been kind of behind in some of these video recordings here. And unfortunately, the platform infrastructure for the CTF is still offline. So I'm just going to showcase what we have actually to work with that you would have downloaded from the problem. So it's this Garfeld, Seinfeld and Garfield picture. At the very bottom, you can see what looks like the flag format, ICTF curly braces and some text in there. However, it's not actually the flag. Obviously, that doesn't say ICTF it's jumbled up a little bit. So at the very top, we see a little bit of numbers. And that is kind of the sticking point for this challenge. And is that the numbers are essentially what will guide you to the solution in the end flag here. So what I did and unfortunately, you may have to do on your own is just translating out what that message was at the very, very end or the bottom of the picture. And then we can work with it. So I'm going to just create a script where I can, oh, that's the solution. Well, just edit that out in your mind, pretend you didn't see that, whatever. We've got a little shebang line script, so we can work with it just fine. And I'm going to use a context manager to open this file, because people tell me that I should do that. So with open message dot text as handle, we can say message can equal handle dot read. And then we could go ahead and print out the message that we're working with. So there's just that ICTF string. Let's go ahead and grab the numbers as well. So I'm going to have to display that Garfeld and then it's 07271978. Okay, great. What we actually are going to find is that if we were to loop through this bit of numbers or try it for the starting segment of the message, this essentially shows a difference in the alphabet as to what letter could come next. So obviously here, I'll try and write this out in some comments here. I plus or minus zero is going to equal I, if you consider zero, some offset in the alphabet. So J being the next letter here, plus or minus, but I'll let the cat out of the bag and just say it's minus. J minus seven is going to go ahead and equal C. And then G, again, minus two is going equal E. And you'll see that as we as we code it. So what I'm going to do is actually loop through the letters in the message and then actually determine whether or not it's in the alphabet. So we're going to need the alphabet to work with. There's enough uppercase in here that I'm just going to actually from string import uppercase. How about that? And then we'll just consider everything as uppercase. And then we'll actually keep track of a counter variable that works as a number and we'll use the modulus to loop through the set of numbers. So I'll do that right now. Let's say for character in message, we could print out the character if you wanted to. And you can see some of these underscores and curly braces are going to get in the way, but that's all right. And we do want to actually, again, test for those things that aren't in the uppercase. So let's just set character equal to character dot upper. That's just fine. And we'd want to have that numeric counter to keep track of where we are in the numbers. If you wanted to, you could use iter tools and use like a cyclic generator to go ahead and like loop that. But we'll just use a modulus. And again, you'll see that in the code if you don't entirely know what I'm getting at just now. So we'll look through the characters and we'll test if character is in uppercase. If it is, we can process it and then do that subtraction like modify that offset. If it's not, let's go ahead and add it to what we're going to try and build out here. So let's just say the flag, which again, if you're trying to do this challenge going in cold, you may not know that's actually the flag. You could just say, okay, maybe that's some text that I want to read out while you're while you're working while you're processing. Let's just say flag dot append character and let's go ahead and process this if it is actually in the uppercase. Let's get the index as to where it is in the alphabet. So index can equal uppercase dot index of that character. So we'll get the numeric position of J in the alphabet and then let's grab the offset, which will be the numbers indexed at the counter that we're going to go ahead and iterate. So if we actually have a character that we're going to be changing here, again, that doesn't happen if it's not in the uppercase letters, if it's not in the alphabet. So those special characters like the curly braces and the underscores won't change. It's kind of essentially like a veneer cipher. If you were to change this to like letters in the alphabet, I would be willing to bet that this code would just pump out if you use a veneer cipher. Maybe I'll try that at the end of the video. I don't know. All right, once we have that offset, we want to subtract the, we'll convert it to an integer, by the way. And again, we'll want to modulus it by the length of the numbers so we wrap around. Let's go ahead and make that an integer. So then we can just go ahead and have the new character equal the uppercase. So anywhere in the alphabet with the index to begin with, minus the offset. And then we can go ahead and add that new character to our flag. At the very, very end of our loop, we can join the flag all together. And let's go ahead and display that out. And you can see ICTF, I don't think Gronsfield likes Mondays. So you could lowercase that, it's like CTF format, get that flag format, just find the way you wanted to. But it should go ahead and work for you. So that's how we can build it. Again, just taking the numbers as kind of an offset, shifting the alphabet around. And we're going to keep track of that in the loop. And then we'll use a modulus operator for every single character. Try that position again in those numbers. Hope I didn't make that more confusing by trying to put that carrot on top. Let's go ahead and see if we can get this flag with the veneer cipher. So what I'm going to do is actually going to locate veneer. See if I've got some code for this here already, which I think I do. And I think I've covered this in the TJCTF video vinegar. So if you haven't seen that before, go check that video out. Let's get veneer cipher. This is a bunch of nonsense. We'll change the message dot text in this case. And then we'll use the key. So the way we can get the key is just taking the numbers here. And we will use, we are getting strings. So string dot uppercase indexed at numbers. Accept that. So for X in numbers, really just I or the character that we're looking at in numbers, we'll change that to a C. We'll convert it to a number. So key can equal an empty string to begin with or an empty array. And then we can say key dot append this stuff. And then we will say key can equal the key all put together. Let's print out the key and then just stop the script. So there is essentially our key. Now let's try and run message and decrypt the message and key ICTF. I don't think Ron's field likes Monday. So again, essentially veneer cipher. However, it doesn't have support with this rendition of the code to display those different special characters. So quick shout out to the people that support me on Patreon. Thank you guys so much. I cannot say it enough $1 a month or more on Patreon will give you a special shout out just like this. At the end of every video $5 or more on Patreon will give you early access to everything that released on YouTube before it goes live. That's not so far been the best thing because I am admittedly a little bit behind on some of my recording. I'm sorry. I'm human, whatever. It's cool. Anyway, you guys are the best. Thank you so much. It's incredible that you're willing to donate and support. If you like this video, please you like comment and subscribe. Please do join our discord server link in description cool community full of CTO players, programmers and hackers. You can hang out with me and other people that love this stuff. Hope to see you guys on Patreon. Hope to see you in the next video. Love ya. Bye.