‫Instructor: Hi, within this lecture,
‫we are going to understand what is assembly
‫and how we can actually use it in iOS reverse engineering.
‫So over here I have my DetectJailSwift folder.
‫So I'm going to hide it for a while
‫because we are going to focus on Objective-C first.
‫And I have my DetectJail.ipa over here as well.
‫And I have installed it in my jailbroken device, right?
‫So you have done the same thing.
‫And let me open the launchpad
‫and you will see that I have something called
‫Hopper Disassembler over here.
‫We're going to use this software in a little bit
‫so that we can disassemble the IPA
‫and get its source code,
‫get its assembly code.
‫And before we do that,
‫we have to understand
‫what is assembly
‫and why do we get assembly code out of IPAs.
‫And in order to do that we have to understand
‫what is machine language,
‫what is assembly, and what is high-level language.
‫So maybe you have heard that our processors
‫have some kind of electrical circuits,
‫and they're called bits
‫and they actually perceive everything like ones and zeros.
‫So whether we write as a program
‫as a software in our computers
‫are actually compiled
‫or turned into machine language eventually
‫and they will be processed as machine language like
‫with ones and zeros in our processors.
‫And we don't have to know about that.
‫We don't write softwares in ones and zeros
‫because it would be so much complicated, okay?
‫No human being would be able to understand it
‫and write as software regarding to this.
‫And actually we can represent text and images
‫and sounds and everything,
‫every data in ones and zeros.
‫So I have Googled how to represent images with binary,
‫which is ones and zeros.
‫And as you can see there is a documentation over here
‫showing that how we can actually
‫represent some image with ones and zeros
‫and how processors perceive those numbers
‫and how they process it.
‫So there is actually a way
‫to represent your image, your photo with ones and zeros,
‫and processors do that for us.
‫So it's called machine language.
‫As I said before, you don't have to know about this.
‫However, there is a middle step in this section
‫and it's called assembly.
‫So when you write a software in, write a program,
‫it's converted into assembly first
‫and then into machine language.
‫And by high-level language,
‫I mean the modern programming languages
‫like Swift or Python or Java.
‫So this is easy to understand.
‫It's almost plain English.
‫However, in assembly,
‫it's actually closer to the machine language.
‫It's hard to understand.
‫It's hard to read, but it can be done.
‫You can write some programs.
‫You can write some tools using assembly if you want.
‫And there are a couple of versions,
‫there are a couple of types for assembly as well.
‫It depends on the processor type like Intel or ARM or AMD,
‫but most of the time the principles would be the same.
‫So for example, you see a code over here
‫which is assembly code
‫and this is high-level language code.
‫So this is very easy to understand.
‫A equals to B plus C.
‫And the assembly thing
‫is kind of easy to understand as well,
‫but machine language is not very easy to understand.
‫It consists ones and zeros,
‫and it's very hard to write in that language.
‫So what we can get out of IPAs
‫is the assembly code,
‫and we can make sense out of assembly codes as well.
‫Maybe in order to change it, in order to edit it,
‫then you should master the assembly language.
‫That's not what we are looking for, at least in this course.
‫Because this is a course it's on its own, okay?
‫You have to learn it from scratch
‫and you have to spend so much time learning
‫how to code in assembly.
‫However, there are a couple of ways
‫to leverage assembly code
‫and we are going to see how to do that during this section.
‫We are going to take hints.
‫We are going to make sense out
‫of some assembly code
‫and then we are going to manipulate our apps
‫using those information
‫that we gather from assembly code.
‫And we are not gonna deal with machine language.
‫However, we are going to see
‫how it's used and how binary,
‫or how hexadecimal works in real life as well.
‫And we are going to see a lot of assembly code.
‫Don't be surprised with it,
‫just don't be scared of it.
‫I'm going to explain everything you should know about this.
‫So in order to get the assembly code out of an IPA,
‫we're going to use this Hopper Disassembler.
‫And of course, there are some other tools as well,
‫but Hopper Disassembler actually works very well.
‫It's actually a paid tool.
‫It's a paid software,
‫but there is a trial version of this Hopper Disassembler.
‫So that's what we are going to use.
‫So if you go to hopperapp.com or you can just Google it,
‫okay, you can just Google Hopper Disassembler,
‫you will see that you can download it for free
‫and try it for free.
‫So this is macOS and Linux Disassembler.
‫You can try to just disassemble the IPAs in macOS
‫and make sense out of those.
‫You can try to disassemble EXE files or DMG files as well.
‫So what we're gonna do,
‫we're going to work
‫and focus on our IPAs, our iOS final products.
‫So you have to go over here to download.
‫And as you can see
‫there is a free version over here.
‫You can just download it.
‫Of course, it comes with kind of limits
‫like you can only use it for 30 minutes
‫and it will shut down,
‫and then you're gonna have to open it one more time,
‫but it's no biggie for us.
‫I'm going to talk about restrictions
‫and I'm going to talk about
‫overcoming those restrictions as well.
‫Just make sure you download it and open it like this.
‫And once you open it,
‫it'll be very easy to install
‫because all you have to do
‫is just take this and drag and drop
‫into Applications folder
‫and it'll be ready to use.
‫So once you do that,
‫you can come over here and click on it
‫and just open the Hopper Disassembler.
‫It will ask you if you wanna go for a license
‫or try the demo.
‫Just say try the demo,
‫and it will open the dashboard for you.
‫So this is our Hopper Disassembler,
‫and all you have to do is just drag the IPA
‫and drop it on the disassembler, okay?
‫So that's what I'm going to do actually.
‫And make sure you have your DetectJail.ipa,
‫and just drag and drop it.
‫And then we are going to see how it looks like.
‫So if I manage to drag and drop it,
‫we are going to see, yep, like this.
‫And once you do that,
‫it'll ask you if you wanna continue, just say yes.
‫And over here you can choose ARM v7
‫and you can choose FAT archive, and say Next.
‫And then it will ask you
‫for the options one more time.
‫Default options would be fine for you at the stage
‫so make sure you don't change anything over here
‫and say OK.
‫And here you go.
‫Now it disassembled it.
‫Now this is assembly code for our IPA file.
‫So as you can see,
‫it looks a little bit complicated
‫when you first see it,
‫but I'm going to take you over this one by one
‫so that you can understand it in a better way.
‫So make sure you get the screen
‫and then make sure you try to make sense out of it
‫by looking at the descriptions or something.
‫But most probably, you won't
‫because you will need some kind of guidance
‫in order to understand it
‫if you have never worked with assembly before.
‫And that's what we are going to do within the next lecture.