‫Instructor: Hi, within this lecture
‫we're going to see how we can use these iHex
‫that we have downloaded in order to edit the IPA file.
‫And then later on we are going to continue looking
‫for clues or hints in our Hopper Disassembler as well.
‫So we are not gonna do any assembly editing
‫actually in this section, but if you need to do
‫some kind of editing in future
‫then you should know this because a free version
‫of Hopper Disassemble won't allow you to edit
‫and then export the file afterwards.
‫So first of all, we are going to have to convert
‫this IPA into a .zip file
‫because we want to get the contents out of it.
‫So if you change the extension like this to, Zip
‫then it will be a zip file.
‫It's very simple.
‫Make sure you spell it right, Z IP
‫and then make sure you say, Use zip.
‫And then if you don't have any WinZip or WinRAR
‫in your MacBook, then you should go and download it.
‫It's for free, all you have to do
‫is just go to winzip.com and just download it.
‫Actually, it's not free,
‫but it has a free trial version as well.
‫So it will be sufficient for you.
‫Just download it and install it,
‫and then you can use it by double clicking on it.
‫If you double click on this zip file right now,
‫you are gonna have to see this payload and you can just copy
‫or drag and drop it to your desktop and try to use it, okay?
‫That's it, that's how you get content out of IPA files.
‫Now, if you right click on it and say Show package contents,
‫you can actually see the package contents
‫of the IPA file as well.
‫And as you can see, we see the executable of IPA inside
‫of this content.
‫So yeah, as you can see, we still get the info.plist
‫and other signatures and stuff in here also.
‫And we are going to have to work with this executable file
‫in order to to edit it in iHex.
‫But it doesn't allow me to drag and drop onto the desktop
‫because we already have Detect Jail on desktop.
‫So let me close this down and show you a better way.
‫And as you can see, Hopper Dissembler stopped working
‫because it's a free version and it only allows us to use it
‫for 30 minutes per session.
‫Of course, we can open it later on one more time.
‫And I'm gonna come over here and say Open file
‫then I go to my desktop, if I choose this payload, okay?
‫If I double click on it, it will show me
‫the executable one more time
‫and I can just double click on it
‫and see the hexadecimal code.
‫And maybe you can think right now
‫that, yeah, we see this hexadecimal code
‫in Hopper Disassembler as well.
‫So why are we bothering about this?
‫The first reason is to teach you how to get content
‫out of IPA files, okay?
‫And the second reason is that
‫you can just start editing this in here.
‫Now, this is in override mode.
‫If I write something, it will just edit it like this.
‫If I change something, like if I'm just typing random keys
‫on my keyboard, it just edits it, okay?
‫So maybe there might be a time for you in future
‫that you should edit the hexadecimal code
‫or you should edit the assembly code,
‫now you can find the related section on your iHex
‫and then edit it and then can save it like this, okay?
‫File, Save, and it will be saved.
‫And then you can try to actually see and match
‫the important parts from the Hopper Disassembler as well.
‫So let me open the Hopper disassembler, here you go.
‫So let me just close this down.
‫Okay, let me just bring this down
‫so we can actually see the Hopper Disassembler
‫because I want to come over here
‫and bring this into my Hopper Disassembler
‫in order to decompile it like this, okay?
‫And then if I go to this hexadecimal tab,
‫if I find someone, I find some code
‫that I want to edit from here,
‫for example, let me find the beginning
‫of a procedure or let me find a function or method.
‫Suppose that I want to change that function, okay?
‫And I found the line that I want to change,
‫if I highlight it, and if I go back to my hexadecimal,
‫I can see where it starts.
‫So if I know this is where I should actually edit on iHex,
‫I can come over here and hit Control F or Command F
‫and find the related hexadecimal code
‫and then I can change it if I want.
‫And then I can save it.
‫So this is how you do hex editing.
‫Of course you should know about assembly
‫in order to do that, okay?
‫After you're done, you can just double click on this
‫one more time and just replace the file
‫with the new edited file and then close this down
‫and then change Zip to IPA.
‫So let me delete this and come over here
‫and change the extension to IPA.
‫And here you go, here is your edited IPA.
‫However, this is not what we are looking for in this lecture
‫because we should have a good understanding of assembly
‫in order to do that, okay?
‫And by the way, I didn't change anything.
‫I have just hit Command Z in order to undo what I have done.
‫Now, we are looking at the original file.
‫Rather than doing this, we are going to focus
‫on finding clues and hints
‫in order to manipulate our app in a way that we want.
‫So what do we do?
‫We just opened the Hopper Disassembler and disassembled
‫our IPA file.
‫And here you go.
‫One of the first things that I actually focus over here
‫is the second view controller.
‫Now, if I don't know anything about source code,
‫now I know that there is a second view controller.
‫And if it was a real CTF and if I was trying to get the flag
‫out of this app, if I click over here to Test,
‫it says that Jailbreak hacker,
‫then I should probably understand
‫that there is a second view controller.
‫And if it wasn't a jail broken device
‫then I should have seen the second view controller.
‫Now I have to focus on
‫how to get into the second view controller.
‫Of course, the Hex editing might be a idea for this,
‫it might be a solution for this as well.
‫But again, we are not gonna do that.
‫Rather, we are going to learn something called Cycript
‫or script, and it's very fantastic
‫because you get to edit or you get to manipulate the app
‫in a way that you want very easily using that tool.
‫That's what we are going to do.
‫But before we do that, we have to gather clues,
‫we have to gather hints from our IPA,
‫from our assembly code like this.
‫So we're going to stop here
‫and continue within the next lecture.