 Hey, how's it going everybody? My name is John Hammond. Welcome back to another Python challenge video Looking at challenge 17 now, and we are presented with this image of cookies I can only assume this challenge has to do with cookies and web browser and cookies stuff like that So let's start to poke at it. I'm just gonna assume that there it's probably this page has probably said a cookie for us although I see this picture of Another challenge we had before that was that was a level four, I think and I Honestly don't remember which one that was I'm just gonna look for Totally Python challenge You guys don't look at my YouTube. Don't look at my YouTube page. All right What was it? Oh follow the chain zero four before yeah, okay, it was this one And that link is PC def linkless, okay? I'm gonna keep that open just in case we need it But first I want to poke at this page to see if this is the one that actually sets the cookie for us so I'm gonna create a new file. I'll put it in a new folder for level 17 of Python challenge And I'll just call this solved up. Hi, you can name whatever you want and I will add my shebang line As usual and I'm gonna use requests to play with this webpage So I'll steal that URL paste it there and response can be requests dot get URL and I can print that response just to see if we get anything response with an s and 401 what is that? Oh We're not I didn't I didn't actually authorize my bet I Remember it later on in the challenges. You do have to supply like I think it was huge After after the inflate this be challenge you have to supply huge and file to be able to access this stuff off Equals off. I'll just pass in that to pull there now. We should okay. We did get a response. It is Response 200 cool. So we had a response. So we have our whole page since we can read that response Let's see if there are any cookies there and there are nothing so Let's try that Level four one the linked list dot PHP. Let's try that was it PC deaf PC deaf. Yep deaf linked lists That PHP and we don't need to authorize for that one. So I won't I'll just actually just remove that line That was before the inflate this be challenge. Just see what this is response. Text Okay, we do get the page. Are there any cookies on that page? Whoa. Yes, there are cookie info That looks like the key Info you should have followed busy nothing. What does that mean when we go to this page? I remember the challenge You'll relive my help. Don't try on nothing. Oh, right. Right. Yeah, you would click on this and it would take you to Same page with a get variable HTTP variable pass through nothing equals 1 2 3 4 5 and then you would just follow the chain I remember that so we should have followed it. It said busy nothing. I wonder if Busy nothing should equal that same 1 2 3 4 5 Yep B. Okay. Oh Whoa, wait, wait, whoa B. What? What the heck is it info B info equals B We're on the right page, right? If you came here from level four go back Okay, that makes sense because nothing should have been level level four should have been nothing and this level level 17 Should be busy. Nothing. I guess you should follow the obvious chain. The next busy. Nothing is 4 4 8 7. Okay But we had What does that mean? Let's try and do this multiple times for I in range just do it three times To see how far we can follow the chain. I'm just gonna set this as a placeholder busy Nothing so I can replace out of it URL equals URL dot replace Busy nothing with Our next nothing so before we start looping. Let's have our next nothing equal this And we were able to get a nothing out of it, right next nothing Well, hang on before we all before we do all of this equals Oh, I have to Move all this indentation next busy. Nothing is that thing. Is that right? So, yeah, we just have to split it was at the very it was at the very end, right? So let's split and Let's get the last one Let's just set that to next nothing because that's what we're using to loop through it and let's just say info equals At responses cookies With info and let's try and loop through this now. Should be good. Oh, oh, yeah, let's actually print that stuff out print next nothing next nothing Just to see what these variables are and let's replace next Nothing in that text with info. I Added an eye in there Next nothing info be blah blah blah. Oh, oh, I'm sorry. This should all be in our for loop That's nothing be oh sweet. We're getting data. We're getting data Let's do that ten times Whoa, whoa, whoa, whoa. Oh, we're totally getting data. Let's do this forever See how much we can get let's go. Oh, that's cool All right, I'm gonna let this run and I'll let you know once it ends I'll pause this now Okay, I would think we'd be getting towards the end here. Oh, yeah, cool. It's finished And the last next nothing is it so that must be the end of it. Let's see what that last one was busy Nothing equals that I Said that's it. Okay. Okay, but it does get one last value there. So let's put all these into a thing say data equals an An empty list and then let's do data dot append the info and I know this this obviously just gave us an error. So Once we get that error, we should know that we have finished So let's just put this in a try and accept thing Break once we're done and then we can print out data Dots, no, no, no, we want to join this because it's an array now. Oh info cool No data data data is the list we're working with. I'm sorry guys. I'm trying to think. All right. So now when we run this Let's just keep it printing so we know what stuff is going on All right, so now it's doing all the stuff for us and once this is done We should have all of the data put together. I'll pause this again and get back to you What's it's done should be finishing up here real soon With all these are percent signs. I'm sure these are like URL encoded data. Okay. Yeah, sweet So now we have our full data Let's just call this data Sweet and since we have a lot to work with now We've accomplished we've gotten all the stuff that we need. Let's just comment out all this stuff because I don't think we'll need anymore now We just have this string Whatever this is This looks to me with we see this BZ here this looks Admittedly like BZF data because that BZ like file header that magic number You know that begins at the this looks like compressed BZF data But it has all these URL encoded stuff in it. So let's actually get rid of those I can do this with url lib url lib and since this all came from a web source, right? there might be percent sign 20 or like a plus sign in there Like, oh, yeah. Yeah, I see one right there. I see a plus sign There's a URL lib is gonna do that or like a request is gonna do that one. It seems like it's like joining characters. So Let's do your lib Dot un quotes underscore plus unquote. We'll get rid of all of those percent encoded Variables like values for us and plus we'll remove that plus sign. That's being weird and it'll properly encode that too Data equals your lib to unquote plus data. Now you can print out that data Oh, and obviously since it's all actual data now. Yeah, like with encoded stuff We you're not gonna be able to read all of it unless we take up the string representation of it. So that's it, right now We have BZ data. Let's actually uncompress it Let's import BZ to If you don't know the syntax for this stuff, you should be able to find it I'm just calling mine decompressor and BZ to yeah, you can just look at the documentation for this online BZ to decompressor it needs to create an object for itself and then decompressor.Decompress and we can pass in that data string that we're working with now. Let's just say Data again, hopefully, hopefully zero that so let's data. Let's say that hopefully. Oh cool. Is it the 26th already? Let's call his father and inform him that the flowers are on their way. He'll understand. What does that mean? Is it the 26th already? Call his father. Oh, oh, oh, oh, oh, oh, oh the 26th. That's reference to the older challenge of the calendar thing, right? I had something on that didn't I? I had a video on that one Who is this evil? Oh, no, no, no the counter. Whom? Whom? Back up Mozart, right? Yeah. Yeah. Yeah. Yeah. That was Mozart. That was the last one Call his father Mozart called Mozart's father. Who is Mozart's father? Mozart's father Google Leopold Mozart Okay He's dead obviously. I can't really call him Call his father Call Leopold Mozart and tell him the flowers are on their way. Oh Call shit. That was another that was another challenge. That was uh Who is this evil? That was when we were looking at the phone stuff, right? Yeah, yeah, yeah. Yeah. Yeah. Yeah. That was the phone one. Oh They must have his number. It must have his number in the phone book. Oh What was that? What was the syntax for that? XML RPC Lib the server name was that and then it just called Like you could yeah, yeah, yeah, you could phone other people and get a phone number for them, right? Let's try and do that idle import XML RPC Lib Cool Server was what was it in the video? pythonchallenge.com pc phonebook.php. It had to have that Python challenge Wait, wait, wait. What was the syntax for it? Server name client equals XML Lib server proxy server proxy, okay server proxy With that server name. So Oh, oh what what? Oh, oh it needs to have HTTP Duh Actually know that it's doing the thing do the thing on the internet. Okay. Cool. So now we have client and you used phone to phone people Leopold Mozart Leopold Mozart He is not damn. Is it just his first name? I remember in this one It was Burt who was like Yeah, yeah, it was Burt that got us the actual Goddesses actual name. So let's just use Leopold. Oh 555 violin. Shh. Is that it? Is that it? I'm gonna do it. Oh, whoa, I moved this to the wrong monitor. I've got two monitors going on right now. It's pretty nice. I remember violin, oh No, I mean, yes, what but stuff violin page. Okay So parent directory up stuff violin dot PHP. Oh Hello, hello, Mr. Leopold Mozart. Hello there Um, what do you have to say to me? You have nothing in your source code. The title is it's me. What do you want? Damn it? Um Is it a 26 already call his father and inform him that the flowers are on their way How do I do that? I mean he is a web page right now I Wonder if I can just send him that stuff. Oh, you know what I Wonder if I have to send him it as a cookie just like everything else is or has been in this freaking in this freaking challenge Everything has been cookies that we just put out. So yeah Let's create a header Info because that was everything else was a dictionary for our cookies and let's say What was it the flowers The flowers are on their way So now so we don't need any of this stuff now, but we can use what is that URL? take it URL now equals HTTP Request, let's just do a response requests I should bring this up for you Get URL Let's actually print that out see what we get if anything 200 What does that say? Okay, cool. So we have the we have the web page. We see leo pulled it. It's me. What do you want? Well, I want to tell you the flowers are on their way. Let's pass in that cookies a Dictionary that we have here cookies equals cookies. Oh Oh Well, don't you dare to forget the balloons What don't you dare to forget the balloons is that it is it just is it just balloons? I'll try that balloons What balloon? Balloons, damn it Wait, wait, wait. The stuff is different, right as we were on when we were on level 17 It was return. What was it? Level 17 URL was pace, you know, that's level four It was a different turn right you see return Romance Yeah, okay, cool. That was level 17. It's got to be Balloons Oh, we found it. We got it. We win Level 18 everybody damn That was really cool. That was super cool was referencing a bunch of different levels and Looping through cookie data and sending our own cookie data decompressing DZ to junk. Oh, that was awesome. Cool Sweet finally level 18 guys Huh, thanks for watching. Hope you enjoyed this one. Hope you're enjoying the Python challenge video series and all the stuff We've been doing here Yeah, oh man And my heart's like my heart feels good right now My heart stopped for a little bit now. I just feel like a good feels Thanks again, guys. Hope you're enjoying this if you are maybe please, uh, please like maybe please leave me a comment Ask me what else you want to see and if you're feeling generous, maybe subscribe. You know, I love that. Thanks guys See you in the next tutorial