‫Instructor: Hi. Within this lecture,
‫we are going to see how we can adjust our emulator
‫so that we can send our request and get our responses
‫through this proxy.
‫So far this proxy is working and it's capturing our traffic
‫on our computer, but we don't want that.
‫We want it to capture our SSL traffic,
‫which is HTTPS traffic from within our emulator as well.
‫So we need to do some configuration.
‫If you go to this proxy tab, you can see,
‫there are couple of options, for example,
‫you can just say stop and it will stop capturing.
‫If you say start, it will just start capturing
‫one more time, okay?
‫And over here, you will see
‫that the SSL proxying is also in work,
‫and you can start and stop it as well,
‫anytime you want.
‫However, in order for SSL proxy to be working properly,
‫you need to do some further configurations
‫and that is exactly what we're going to do
‫within this lecture.
‫So if you come to this proxy menu over here,
‫you will see proxy settings
‫at the bottom of this menu.
‫Of course, it can be anywhere else, like over here
‫in your case as well, but I'm just going to click it
‫and you will see that it already has a port
‫over here. If it doesn't have a port like this
‫in your case, just put 8888 over here, okay?
‫And just say, support HTTP/2.
‫So this assigns a port to our SSL proxying purpose.
‫So we're going to be using 8888 as SSL proxy port
‫in this procedure.
‫And over here, you can see the macOS menu
‫so if you're on Windows, you will see a Windows menu.
‫You don't have to change anything over here,
‫just be sure, just be certain that
‫the port number, SS 8888 is over there.
‫And then, you can come over here
‫to SSL Proxying Settings, and now we're going
‫to do some further configuration.
‫For example, I have some configurations over here.
‫So, if you don't have anything over here,
‫don't worry, we're going to learn how
‫to add them in a minute.
‫So whatever you write here,
‫will be proxied, will be SSL proxied,
‫when this procedure runs.
‫So if you want to specify only one website,
‫then it's very good, but if you want to add everything,
‫so you can come over here to add, and for host,
‫you can just write, star dot star, and this will match
‫for every website. So whatever website
‫that you're visiting, it will be proxied.
‫It will be ESSL proxied actually.
‫You have to say enable SSL proxying and hit okay.
‫And that's it for the SSL configuration.
‫Now, Charles proxy is up to date, is now ready
‫to SSL proxy our request and responses.
‫But, we have to do some further configuration,
‫in the emulator as well, because we want
‫to use this proxy inside of our emulator as well.
‫Right now, we cannot actually capture the traffic
‫that is going on in our emulator, right?
‫So we have to come over here to settings
‫of this emulator and change some of the configurations.
‫And there couple of ways to do so,
‫I'm going to show you every of them,
‫and you will be able to capture the traffic
‫from your emulator.
‫So make you sure you open the options,
‫and as you can see there are couple of options here
‫like location but we're interested,
‫interested in the settings and in the proxy.
‫So, most probably you will see the
‫Use Android Studio HTTP proxy settings
‫just disable it and select Manual Proxy Configuration.
‫So we're here, I see my local IP.
‫In case you don't see your own,
‫then I'm going to show you how to find your local IP.
‫And as you can see, we're using the port 8888
‫over here as well, so this is the same port
‫that we have specified in the Charles.
‫So what I'm going to do, I'm going
‫to open my terminal in Mac, and if you're
‫on Windows, you should open your command prompt, okay?
‫And I'm going to make this bigger, so remember
‫how you can open your command prompt, you can run
‫just search for cmd in your search tab
‫on Windows, and run ipconfig.
‫And over here, we're going to run ifconfig, okay?
‫So this is basically the same thing,
‫it shows us the current IP configuration
‫and you can find your own IP address, local IP address.
‫In this case, mine is 192.168.1.21, okay?
‫So, make sure you find your own local IP address,
‫and copy it and paste it in the proxy settings.
‫So this will be different for you, okay?
‫Make sure you find your own, and write it over here.
‫When you do that, just make sure you,
‫save the settings, okay, and hit on apply,
‫and then close it down, so that you will be ready
‫to send this request through your proxy.
‫However, it doesn't end over here.
‫There are couple of other ways to achieve this result
‫as well, and we're going to do every of them,
‫each of them, so that we can be pretty certain
‫that this works.
‫So make sure you close the emulator for your app down,
‫and open the settings of your emulator, okay?
‫And I'm going to go for wifi settings,
‫and as you can see, there is the Android Wifi over here.
‫If I click on it, I can see the configurations
‫of the current connection.
‫So Android Wifi stands for the wifi of our emulator.
‫If you right click on it, you can see the modify network
‫and some of the versions you can see the modify tab
‫over here on the top of the right hand side, okay?
‫And all you have to do is just find the
‫modify network option.
‫When you do that, you can see the advanced options
‫where you can enable the proxy, okay?
‫So, this menu is different for every version,
‫so make sure you find the modify wifi settings
‫and just write the same configuration over here as well.
‫So this is my local IP address and this is the port
‫that I have chosen in Charles proxy.
‫And now, it will definitely work because we have configured
‫it to do so, from the settings,
‫from the emulator settings as well.
‫So, this is exactly what you should do
‫if you were working with a real device.
‫So, let me just open this and write unicorn items dot com
‫and see if it appears on the Charles proxy list
‫over here, let me see. Here you go!
‫Unicornitems.com is now over here.
‫So it actually captures the traffic
‫from the emulator in our Charles proxy.
‫I can see all the overview, I can see all the summary.
‫I can see all the (indistinct)
‫that have been captured over here.
‫Okay? But unicornitems.com is an HTTP website
‫like I have stated before, it's not an HTTPS.
‫And in order to test with the HTTPS
‫and in order to see the contents of the HTTPS,
‫we have to do some more digging as well.
‫First of all, we are going to install
‫an SSL certificate from Charles to our phone,
‫but even that will not resolve our issue.
‫Because even if I do that, I will be able
‫to browse the HTTPS website from our browser,
‫but not within apps.
‫So for example, I'm going to go to my own website,
‫which is atlsamancioglu.com, okay?
‫And this is an HTTPS website, and as you can see,
‫maybe we will get the result over here,
‫but we will not see the content
‫because it will have experienced some problems
‫with the SSL certificate.
‫So I have to install an SSL certificate
‫even if do that as I said before,
‫the apps actually won't accept it.
‫We will be able to browse it from the browser,
‫but it won't do much.
‫In our case, we want our apps
‫to work with the proxy as well.
‫Of course, there are some other ways
‫to overcome this problem.
‫And we're going to see all of those things
‫in the following lectures.