‫-: Hi, within this lecture
‫we are going to install apktool and jadx
‫on our MacBook.
‫So, if you don't have a Mac,
‫so, if you're on Windows or Linux,
‫you may just skip this lecture.
‫So, it's a little bit different than Linux,
‫because there is no repositories
‫that we can easily download these tools.
‫So, we're gonna have to manually install apktool,
‫and then jadx, as well.
‫And apktool is, kind of, tricky to install.
‫So, make sure that you follow along with me over here,
‫so that you can actually install this in a proper way.
‫So, as you can see we have two tools
‫to download in our MacBooks.
‫So, first of, which is our wrapper script.
‫and the second of which, is the apktool.
‫Now, we are going to build that tool.
‫We are going to move that tool into usr/local/bin folder.
‫So, in order to do that we are gonna have to
‫have a root privilege, like administrator privilege.
‫So, make sure you open this wrapper script, okay,
‫and make sure you download it on your desktop,
‫or your downloads, whatever.
‫Let me show you what a wrapper script is.
‫You don't have to do that, by the way,
‫you can just right click it,
‫and download to your downloads folder,
‫or your desktop like this.
‫And it's essential
‫that it doesn't have any kind of extension.
‫And as you can see,
‫even though I didn't specify an extension,
‫it's .txt over here.
‫So, if I double click on that,
‫I can just see the source code.
‫So, we're gonna have to get rid of
‫that extension in a minute.
‫Okay, so let me download the other tool
‫that is instructed over here.
‫Okay, as you can see, it says "find newest here."
‫And you can just see the versions on this downloads website,
‫and you can just go for the latest one,
‫which is 2.4.1.
‫In my case, you can see a newer tool as well.
‫It doesn't matter,
‫they didn't change anything
‫for years right now.
‫If they change anything,
‫of course, I will be
‫updating the course.
‫So, here you go.
‫Let me download this one as well.
‫I believe it is downloaded on my downloads folder,
‫so I'm gonna make sure that I take this folder.
‫Yeah, this one jar file
‫from here to my desktop
‫so you can actually follow it in a better way.
‫So, after that, after downloading all of these tools,
‫as you can see it says that you have to
‫just name it apktool.jar, okay,
‫apktool.jar.
‫So, it's done, great.
‫And over here we have to lose the extension
‫because it says that save link as apktool,
‫not apktool.txt.
‫So, it's kind of a tool, not text file.
‫So, we need to make sure
‫that it's apktool rather than apktool.txt.
‫So, you can just delete it from here as well,
‫but as you can see,
‫it's still recognized as txt file for some reason,
‫and we are going to make sure it isn't like that.
‫So, later on we are going to move
‫both of these files to usr/local/bin,
‫and again we're going to have to be root
‫in order to do that,
‫and I'm going to show you how to do all of this.
‫So, in order to do all of this,
‫I'm going to open my terminal.
‫You can hit command and space on your Mac,
‫and write terminal in order to open your terminal.
‫Okay, so this is where we write our commands
‫on our MacBooks.
‫So, this is it.
‫So, first of all, we are going to make sure
‫that this apktool is accessible from our terminal.
‫So, I'm going to go for CD desktop and run LS.
‫So, if you're on LS, you will see the files and folders.
‫They're on your desktop,
‫and, as you can see, apktool.jar,
‫and apktool.txt is still over here,
‫and txt is still over here
‫even though we got rid of that.
‫So, we are gonna have to make sure it's not over there.
‫So, there is a command that we can use
‫in order to change the extensions
‫or change the name as well.
‫So, I'm going to use MV
‫and I will say MV apktool.txt to apktool.
‫So MV is actually for moving.
‫We're going to move this to usr/local/bin like this,
‫but before we do that we have to just lose the extension,
‫and a move can be used for that reason as well.
‫Like this apktool.txt to apktool.
‫Now, if I run LS, as you can see,
‫it's apktool and apktool.jar.
‫So, you have to make sure
‫that your apktool doesn't have any extension like this.
‫And after that,
‫we are ready to move all of this into usr/local/bin folder.
‫But as instructed, we need to be root
‫in order to properly do this.
‫So in order to gain root advantages,
‫you can actually called 'sudo su'.
‫So, like super user do super user.
‫If you run that it will ask you for your password,
‫and this is the password of your MacBook.
‫So, make sure you just type your password.
‫It won't show up here,
‫but after you hit enter it will accept it and here you go.
‫Now, we are inside of our shell.
‫Now, when you go into that shell
‫you can run 'whoamI' to confirm that you are root.
‫As you can see, we are now root.
‫So, we are the most privileged user.
‫If our 'pwd', we are still in the
‫users/atilsamancioglu/desktop.
‫So, let me run LS, and as you can see,
‫we can see the apktool and apktool.jar, as well.
‫Now, I'm going to move apktool to usr/local/bin,
‫and make sure you use slashes like this,
‫slash user, slash local, slash bin.
‫And here you go, apktool is now out of the screen.
‫Now, I'm going to do the same thing
‫for apktool.jar as well.
‫And I will move that to usr/local/bin as well.
‫Here you go.
‫We got rid of apktools here, and now we are done actually.
‫I believe this was the last of the steps,
‫but I'm going to make sure anyway later on,
‫just let me go to usr/local/bin, okay?
‫And now make sure that you spell it
‫exactly like this,
‫/usr/local/bin.
‫If you run LS, you can see all the tools that are available
‫on your MacBook like this.
‫You can actually call these tools
‫by typing on your terminal.
‫Like, I have Python, I have apktool, I have my Sequel,
‫I have other tools here as well.
‫Now, we're good to go.
‫I'm still root over here.
‫Maybe, you may want to get out of this one.
‫So, you can just call user your name,
‫like SU username,
‫and it will go back into your username like this,
‫or you can just close the terminal down and open it again.
‫And if I run exit,
‫it will just go back to each other like this.
‫So, I'm going to close this down, and go back to here.
‫And as you can see we had to make sure
‫that these files are executable.
‫So, we have to make sure
‫that we run change mode on those files.
‫So, I wish I hadn't closed the terminal before.
‫So, I'm going to make this bigger so you can see it
‫in a better way like this, okay?
‫And then I will have to be root one more time,
‫and I will need to delete this screenshot.
‫So, let me open terminal, I run 'sudo su',
‫and here you go.
‫Let's go to cd/usr/local/bin.
‫And here we will see the apktools if I run LS.
‫But if we are run LS it will just give us so many options.
‫So, if you run like this,
‫LS, pipe, 'grep apk',
‫now it will display only the results
‫containing apk like this.
‫You don't have to do that, by the way,
‫but it's a good opportunity to use 'grep' command,
‫and it's a good opportunity to use this piping sign.
‫So, piping sign gives the input of LS
‫as an output to 'grep' command
‫and 'grep' command takes this input,
‫and searches for apk,
‫and it displays only the result containing apk.
‫Now, I can do something like this, as well,
‫LS, piping, 'grep python'
‫and it'll only display the results of python
‫for me inside of this folder.
‫Now, it wasn't, of course, necessary in our case,
‫but I just wanted to show you how to use
‫'grep' and piping, as well.
‫So, all we had to do is run this command actually,
‫'chmod + x' and then the file name.
‫So, this makes our apktool executable.
‫So, when we call this apktool from our terminal
‫it will get executed.
‫For example, if I opened this in files and folders,
‫if I just double clicked on it,
‫it wouldn't work because they are not executable right now.
‫So, all you have to do is just run this command,
‫'chmod + x', and then just name the file
‫like this apktool and apktool.jar.
‫But be aware that we are inside of usr/local/bin.
‫Okay, now we are done.
‫Now, we can actually call apktool from our terminal.
‫So, make sure you exit out of the root,
‫and run apktool,
‫and as you can see now
‫we can see all the commands,
‫all the terminology,
‫and all the documentation regarding the apktool,
‫which means that it's working.
‫And next to the jadx.
‫It's actually much more easier to install jadx in Mac OS.
‫All you have to do is just run brew, install jadx,
‫but brew is, kind of, a repository management tool.
‫Like this Homebrew, okay?
‫So you can go to,
‫brew.sh ,
‫in order to see how this works.
‫Maybe you don't have Brew on your Macs for some reason.
‫If you don't have brew, you have to install brew first.
‫And as you can see, if you go to that website,
‫there is a line over here to install brew on your MacBooks.
‫You have to copy this line, okay?
‫Copy this command,
‫and it actually installs homebrew
‫on your usr/bin/ Ruby folder.
‫And you have to open your terminal,
‫and you have to paste that in and run it.
‫But I'm going to make this bigger first,
‫so that you can see it in a better way, okay?
‫So, let me make this bigger and here you go.
‫Now we can paste the thing that we have copied
‫from this website like this,
‫and just run it.
‫And it will install the brew for you.
‫I'm not gonna do that.
‫I'm just going to run this command.
‫It will update my brew anyway eventually, okay?
‫Let me just copy this,
‫and as you can see, it will take some time.
‫It will try to update my brew,
‫it will try to download jadx, and install it on my computer.
‫After doing so, I can just call jadx
‫from anywhere in my MacBook,
‫from my terminal, again, like we did in apktool as well.
‫So it's very easy to install
‫when we compare it to the apktool,
‫since we have this repository thing in brew over here.
‫And after we are done with this,
‫we will have what we need, right?
‫We will have apktool, we will have jadx.
‫So these are essentials,
‫in order to master the Android reverse engineering process.
‫And here you go.
‫I believe we have jadx right now.
‫So, let me run jadx.
‫And as you can see,
‫it says that please specify input file.
‫If I run jadx help,
‫I can see the documentation of jadx, as well.
‫Now, let's stop here and continue within the next one.