1 00:00:00,360 --> 00:00:01,230 ‫Instructor: Hi. 2 00:00:01,230 --> 00:00:02,580 ‫Within this lecture, 3 00:00:02,580 --> 00:00:04,290 ‫we're going to install the server 4 00:00:04,290 --> 00:00:06,300 ‫that I have told you about. 5 00:00:06,300 --> 00:00:09,870 ‫So, this challenge is actually very realistic, 6 00:00:09,870 --> 00:00:12,840 ‫because it involves a server, 7 00:00:12,840 --> 00:00:17,840 ‫and the server runs in our local server, in our local host, 8 00:00:18,900 --> 00:00:22,740 ‫which means that it's being run on our own computer 9 00:00:22,740 --> 00:00:25,470 ‫rather than a cloud's machine. 10 00:00:25,470 --> 00:00:26,850 ‫However, it's the same thing, 11 00:00:26,850 --> 00:00:28,620 ‫because we are using the connection 12 00:00:28,620 --> 00:00:33,510 ‫to get the data and display the data to the user on our app. 13 00:00:33,510 --> 00:00:36,870 ‫And in order to install the server, 14 00:00:36,870 --> 00:00:39,300 ‫we are going to have two separate lectures, 15 00:00:39,300 --> 00:00:41,550 ‫one for Windows and one for Mac, 16 00:00:41,550 --> 00:00:45,570 ‫because it's kind of different for each other, 17 00:00:45,570 --> 00:00:48,540 ‫and we are going to start with Windows. 18 00:00:48,540 --> 00:00:51,930 ‫So make sure you open this link that I have shared with you, 19 00:00:51,930 --> 00:00:54,510 ‫and download the whole challenge. 20 00:00:54,510 --> 00:00:55,440 ‫Okay? 21 00:00:55,440 --> 00:00:58,440 ‫So, this is the first thing that we are going to do. 22 00:00:58,440 --> 00:01:02,010 ‫It involves the Python code, the server code, 23 00:01:02,010 --> 00:01:06,600 ‫and it also involves the APK that we are going to work on. 24 00:01:06,600 --> 00:01:10,290 ‫So, the next thing to do is to install Python 25 00:01:10,290 --> 00:01:12,540 ‫in our Windows machine. 26 00:01:12,540 --> 00:01:15,660 ‫Windows doesn't come pre-installed, 27 00:01:15,660 --> 00:01:18,870 ‫actually, Python doesn't come pre-installed in Windows. 28 00:01:18,870 --> 00:01:19,710 ‫Okay? 29 00:01:19,710 --> 00:01:21,960 ‫So we're going to have to install it, 30 00:01:21,960 --> 00:01:25,860 ‫and then we're going to be able to run this server. 31 00:01:25,860 --> 00:01:29,640 ‫So, let's come here to download section, 32 00:01:29,640 --> 00:01:31,650 ‫and it will direct us 33 00:01:31,650 --> 00:01:34,623 ‫to download the latest version for Windows. 34 00:01:35,670 --> 00:01:39,900 ‫And however, that's not the thing that we are looking for, 35 00:01:39,900 --> 00:01:42,210 ‫maybe you will see something different over here, 36 00:01:42,210 --> 00:01:46,290 ‫like download Python option 3.9, 4.0, 37 00:01:46,290 --> 00:01:47,820 ‫it really doesn't matter, 38 00:01:47,820 --> 00:01:51,930 ‫because our server doesn't use Python 3, 39 00:01:51,930 --> 00:01:53,640 ‫it uses Python 2. 40 00:01:53,640 --> 00:01:54,480 ‫Okay? 41 00:01:54,480 --> 00:01:58,320 ‫So in order to find the latest version of Python 2, 42 00:01:58,320 --> 00:02:00,270 ‫you're gonna have to scroll down a little bit 43 00:02:00,270 --> 00:02:03,270 ‫and see Python 2.7 over here. 44 00:02:03,270 --> 00:02:06,180 ‫So, this is the thing that we are looking for. 45 00:02:06,180 --> 00:02:07,950 ‫We're going to download this Python, 46 00:02:07,950 --> 00:02:10,440 ‫and we're going to install it on our Windows machine 47 00:02:10,440 --> 00:02:13,650 ‫so that we will be able to run the server. 48 00:02:13,650 --> 00:02:16,950 ‫And just click on this link, okay? 49 00:02:16,950 --> 00:02:20,970 ‫Just click on the Python 2.7.17. 50 00:02:20,970 --> 00:02:24,900 ‫So, this is the latest version of Python 2. 51 00:02:24,900 --> 00:02:28,410 ‫And if you come over here, you will see the Windows links, 52 00:02:28,410 --> 00:02:30,840 ‫and as well as MacOS links. 53 00:02:30,840 --> 00:02:31,770 ‫Here you go. 54 00:02:31,770 --> 00:02:34,740 ‫Now, we have different options, 55 00:02:34,740 --> 00:02:39,330 ‫and we are actually looking for this MSI option. 56 00:02:39,330 --> 00:02:42,840 ‫And as you can see, this is for 64-bit. 57 00:02:42,840 --> 00:02:43,740 ‫Okay? 58 00:02:43,740 --> 00:02:46,230 ‫And this is for 32-bit. 59 00:02:46,230 --> 00:02:50,940 ‫So, depending on your operating system, go for your choice. 60 00:02:50,940 --> 00:02:52,410 ‫I'm using 64-bit, 61 00:02:52,410 --> 00:02:54,540 ‫so I'm going to download this one. 62 00:02:54,540 --> 00:02:58,050 ‫And this is fairly a small file, 63 00:02:58,050 --> 00:03:01,530 ‫so it will not take so much time to download. 64 00:03:01,530 --> 00:03:03,600 ‫After download is completed, 65 00:03:03,600 --> 00:03:05,850 ‫you will be ready to install it. 66 00:03:05,850 --> 00:03:08,790 ‫And installing is very easy as well, 67 00:03:08,790 --> 00:03:13,260 ‫using it maybe can be a little different for you 68 00:03:13,260 --> 00:03:16,290 ‫if you're using Python for the first time, 69 00:03:16,290 --> 00:03:19,650 ‫and I'm going to show you how to do that, don't worry. 70 00:03:19,650 --> 00:03:21,690 ‫So wait until this is finished, 71 00:03:21,690 --> 00:03:23,160 ‫and I believe this is finished, 72 00:03:23,160 --> 00:03:25,680 ‫but it's getting refreshed or something, 73 00:03:25,680 --> 00:03:27,540 ‫just click on the downloaded file, 74 00:03:27,540 --> 00:03:29,730 ‫and it'll pop open for you. 75 00:03:29,730 --> 00:03:32,460 ‫As you can see, I have Python installed, 76 00:03:32,460 --> 00:03:35,160 ‫so it says that either you can change it, 77 00:03:35,160 --> 00:03:37,560 ‫or remove it, or repair it, 78 00:03:37,560 --> 00:03:42,180 ‫so most probably you will see install it over here, 79 00:03:42,180 --> 00:03:45,330 ‫and all you have to do is just click Next, Next, and Finish. 80 00:03:45,330 --> 00:03:46,320 ‫Okay? 81 00:03:46,320 --> 00:03:49,290 ‫Just allow the computer to install it 82 00:03:49,290 --> 00:03:52,500 ‫if it asks for any permission, okay, 83 00:03:52,500 --> 00:03:55,770 ‫and it will do the installation for you. 84 00:03:55,770 --> 00:03:58,920 ‫So, that's it for installing Python, actually. 85 00:03:58,920 --> 00:04:01,080 ‫Even though it's stuck right now, 86 00:04:01,080 --> 00:04:03,780 ‫it will actually repair the Python, 87 00:04:03,780 --> 00:04:08,610 ‫or just try to update it once it gets out of this. 88 00:04:08,610 --> 00:04:09,660 ‫Yep, like this. 89 00:04:09,660 --> 00:04:12,540 ‫So, you will see exactly something like this, 90 00:04:12,540 --> 00:04:14,340 ‫it will install the Python, 91 00:04:14,340 --> 00:04:16,233 ‫and then you will be done. 92 00:04:17,280 --> 00:04:20,370 ‫So, it didn't ask me where to install it, 93 00:04:20,370 --> 00:04:24,450 ‫but make sure you take note of where you are installing it. 94 00:04:24,450 --> 00:04:27,117 ‫Of course, you can find it eventually. 95 00:04:27,117 --> 00:04:29,188 ‫Okay so, mine is under C:, 96 00:04:29,188 --> 00:04:34,105 ‫okay so, most probably it'll install it under C: over here, 97 00:04:35,063 --> 00:04:39,132 ‫and we are going to have to find this python.exe 98 00:04:39,132 --> 00:04:42,012 ‫in order to run our server, 99 00:04:42,012 --> 00:04:45,210 ‫so make sure you take a note of where you are installing it. 100 00:04:45,210 --> 00:04:46,140 ‫Okay? 101 00:04:46,140 --> 00:04:48,450 ‫And then when the installation completes, 102 00:04:48,450 --> 00:04:52,650 ‫come over here and find the python.exe. 103 00:04:52,650 --> 00:04:57,150 ‫So as you can see, mine is under C:\Python27. 104 00:04:57,150 --> 00:05:00,930 ‫So if yours is a different location, it doesn't matter, 105 00:05:00,930 --> 00:05:03,540 ‫just open your file browser 106 00:05:03,540 --> 00:05:07,830 ‫and try to find the Python27 folder, 107 00:05:07,830 --> 00:05:12,830 ‫and that's where the python exe is actually located. 108 00:05:13,110 --> 00:05:18,090 ‫So, let me see if the installation is completed or not. 109 00:05:18,090 --> 00:05:19,560 ‫No, it's still going on. 110 00:05:19,560 --> 00:05:21,360 ‫Yeah, it's now completed, 111 00:05:21,360 --> 00:05:22,950 ‫so I'm gonna say Finish. 112 00:05:22,950 --> 00:05:24,240 ‫Here we go. 113 00:05:24,240 --> 00:05:27,810 ‫Now what I'm going to do, I'm going to open this up, 114 00:05:27,810 --> 00:05:31,680 ‫and I believe we are done for here, 115 00:05:31,680 --> 00:05:35,100 ‫and we have downloaded this as well, right? 116 00:05:35,100 --> 00:05:39,260 ‫So, we have downloaded the CTF challenge 117 00:05:39,260 --> 00:05:41,580 ‫in in our computers as well, 118 00:05:41,580 --> 00:05:43,110 ‫so find it. 119 00:05:43,110 --> 00:05:46,500 ‫And if it's a zip file, you can extract it like this. 120 00:05:46,500 --> 00:05:49,980 ‫Okay? Or you can use WinRAR, or WinZip, 121 00:05:49,980 --> 00:05:53,490 ‫or any other extraction software 122 00:05:53,490 --> 00:05:55,680 ‫that you have on your computer. 123 00:05:55,680 --> 00:05:57,540 ‫So make sure you extract it 124 00:05:57,540 --> 00:06:00,753 ‫so that you will have all the files and folders ready, 125 00:06:01,590 --> 00:06:06,060 ‫and we are going to use Python in order to run our server. 126 00:06:06,060 --> 00:06:08,910 ‫And I'm going to show you exactly 127 00:06:08,910 --> 00:06:13,910 ‫how to find the server file on your CTF challenge folder, 128 00:06:15,000 --> 00:06:16,320 ‫and then run it. 129 00:06:16,320 --> 00:06:17,790 ‫So, when you double-click on it, 130 00:06:17,790 --> 00:06:20,310 ‫you will see the AndroidLabServer, 131 00:06:20,310 --> 00:06:24,750 ‫and under AndroidLabServer, you will see these files. 132 00:06:24,750 --> 00:06:27,000 ‫So, let me open the Command Prompt 133 00:06:27,000 --> 00:06:29,880 ‫by running cmd on my search. 134 00:06:29,880 --> 00:06:32,790 ‫And what I want to do over here 135 00:06:32,790 --> 00:06:37,470 ‫is to find this folder using cd commands. 136 00:06:37,470 --> 00:06:39,630 ‫So, I'm gonna go for cd Downloads, 137 00:06:39,630 --> 00:06:41,100 ‫and when I run there, 138 00:06:41,100 --> 00:06:44,046 ‫I will see the Android-InsecureBank, 139 00:06:44,046 --> 00:06:47,370 ‫and I will just run cd Android-InsecureBank, 140 00:06:47,370 --> 00:06:49,800 ‫and then it will take me inside of it. 141 00:06:49,800 --> 00:06:52,680 ‫And then one more time, if I run there, 142 00:06:52,680 --> 00:06:56,940 ‫I will cd in AndroidLabServer folder over here, 143 00:06:56,940 --> 00:06:59,520 ‫so I'm gonna go for cd AndroidLabServer, 144 00:06:59,520 --> 00:07:00,690 ‫and if I run there, 145 00:07:00,690 --> 00:07:03,180 ‫I will see the exact files 146 00:07:03,180 --> 00:07:06,330 ‫that I have seen in my file browser, right? 147 00:07:06,330 --> 00:07:08,610 ‫So make sure you come to this point, 148 00:07:08,610 --> 00:07:10,230 ‫when you run there, 149 00:07:10,230 --> 00:07:13,860 ‫you will see all these files and folders. 150 00:07:13,860 --> 00:07:16,200 ‫Then we are gonna run something like this, 151 00:07:16,200 --> 00:07:19,680 ‫pip install -r requirements.txt. 152 00:07:19,680 --> 00:07:21,120 ‫But it won't work, 153 00:07:21,120 --> 00:07:24,900 ‫because it actually requires Python 154 00:07:24,900 --> 00:07:27,840 ‫in order to run this command, okay? 155 00:07:27,840 --> 00:07:29,460 ‫So what we are going to do, 156 00:07:29,460 --> 00:07:33,360 ‫we are going to paste the thing that we have copied. 157 00:07:33,360 --> 00:07:36,540 ‫So, let me go over here and show you one more time. 158 00:07:36,540 --> 00:07:39,690 ‫If you go to your computer, okay, 159 00:07:39,690 --> 00:07:42,420 ‫if you go to your Python folder, 160 00:07:42,420 --> 00:07:44,550 ‫not this one, but C:, 161 00:07:44,550 --> 00:07:49,550 ‫then come over here, make sure you find python.exe, 162 00:07:49,560 --> 00:07:51,660 ‫it doesn't matter where it's located, 163 00:07:51,660 --> 00:07:55,440 ‫but once you find it, you have to run it like this. 164 00:07:55,440 --> 00:08:00,440 ‫So, C:\Python27\python.exe -m pip install requirements.txt. 165 00:08:03,690 --> 00:08:07,320 ‫And actually we have a -r over here as well. 166 00:08:07,320 --> 00:08:11,820 ‫So, once we do that, it will run the pip command, 167 00:08:11,820 --> 00:08:16,820 ‫so it will install the library's required packages for you 168 00:08:17,280 --> 00:08:18,990 ‫in order to run it. 169 00:08:18,990 --> 00:08:22,020 ‫As you can see, it's downloading something, 170 00:08:22,020 --> 00:08:24,030 ‫and it will download and install 171 00:08:24,030 --> 00:08:27,660 ‫all the required libraries for us. 172 00:08:27,660 --> 00:08:31,590 ‫So, we have used Python in order to run this command. 173 00:08:31,590 --> 00:08:35,310 ‫And again, if you actually install Python 174 00:08:35,310 --> 00:08:37,110 ‫any folder other than mine, 175 00:08:37,110 --> 00:08:40,440 ‫like under C:, then it really doesn't matter, 176 00:08:40,440 --> 00:08:44,130 ‫all you have to do is just write it like I have written, 177 00:08:44,130 --> 00:08:45,930 ‫python, okay? 178 00:08:45,930 --> 00:08:49,140 ‫So, make sure you use backward slashes, 179 00:08:49,140 --> 00:08:51,300 ‫like in a Windows style. 180 00:08:51,300 --> 00:08:52,133 ‫Okay? 181 00:08:52,133 --> 00:08:54,420 ‫And after that, make sure you wait 182 00:08:54,420 --> 00:08:56,700 ‫until this installation is finished, 183 00:08:56,700 --> 00:09:01,590 ‫because without having these requirements it won't work. 184 00:09:01,590 --> 00:09:03,930 ‫So, I believe it's still going on over here, 185 00:09:03,930 --> 00:09:07,620 ‫as you can see, we are using a lot of different libraries 186 00:09:07,620 --> 00:09:09,420 ‫just to run the server. 187 00:09:09,420 --> 00:09:11,010 ‫And now this is done, 188 00:09:11,010 --> 00:09:13,050 ‫so I'm gonna run cls. 189 00:09:13,050 --> 00:09:14,790 ‫And when I run dir, 190 00:09:14,790 --> 00:09:18,390 ‫I will see this app.py. 191 00:09:18,390 --> 00:09:23,390 ‫So, in order to run this py, which is a Python file, 192 00:09:23,430 --> 00:09:26,070 ‫I'm going to use Python one more time 193 00:09:26,070 --> 00:09:30,280 ‫and just write app.py, like this. 194 00:09:30,280 --> 00:09:32,970 ‫When I run it, it will ask for a permission, 195 00:09:32,970 --> 00:09:35,220 ‫I'm going to give it, of course, 196 00:09:35,220 --> 00:09:37,020 ‫and it will start running. 197 00:09:37,020 --> 00:09:39,630 ‫Okay, make sure you check all of these things, 198 00:09:39,630 --> 00:09:41,850 ‫and Allow access. 199 00:09:41,850 --> 00:09:43,775 ‫And when you do that, 200 00:09:43,775 --> 00:09:48,660 ‫it starts to work on your local host like that. 201 00:09:48,660 --> 00:09:50,820 ‫So, this is all you have to do 202 00:09:50,820 --> 00:09:55,200 ‫in order to run your Python server on your computer. 203 00:09:55,200 --> 00:09:58,290 ‫If you're done, just go into the next lecture, 204 00:09:58,290 --> 00:09:59,343 ‫and meet me there.