1 00:00:00,360 --> 00:00:01,193 -: Welcome back. 2 00:00:02,100 --> 00:00:03,390 Have you managed to figure out 3 00:00:03,390 --> 00:00:05,193 the command from previous video? 4 00:00:06,240 --> 00:00:09,720 Don't worry if you haven't, since it was a tricky one. 5 00:00:09,720 --> 00:00:12,510 Let us see what the solution is. 6 00:00:12,510 --> 00:00:15,210 So if I navigate to my folder, which we created 7 00:00:15,210 --> 00:00:18,571 in the previous video, we wanted to copy our 8 00:00:18,571 --> 00:00:21,870 'file3.PY' which is our pilot program, 9 00:00:21,870 --> 00:00:25,290 from folder directory, to the desktop directory. 10 00:00:25,290 --> 00:00:28,440 And if you try to solve it but didn't manage to, 11 00:00:28,440 --> 00:00:33,440 you probably went with command CP 'file3.PY' Desktop. 12 00:00:36,360 --> 00:00:41,250 And if I press enter, this command probably surprised you 13 00:00:41,250 --> 00:00:45,240 since it created another folder, or pardon me, 14 00:00:45,240 --> 00:00:49,233 another file in the folder directory called desktop. 15 00:00:50,070 --> 00:00:52,530 This is because it read our command 16 00:00:52,530 --> 00:00:54,960 as if we wanted to copy our file 17 00:00:54,960 --> 00:00:58,200 into another file in the same directory. 18 00:00:58,200 --> 00:01:01,239 And we call that file 'desktop'. 19 00:01:01,239 --> 00:01:03,630 And this is just how the command works. 20 00:01:03,630 --> 00:01:06,630 In order to successfully copy the file 21 00:01:06,630 --> 00:01:09,360 to desktop directory, we must run the command 22 00:01:09,360 --> 00:01:13,020 and specify the full path to the desktop, as well 23 00:01:13,020 --> 00:01:15,570 as the name of the copy that we want. 24 00:01:15,570 --> 00:01:17,880 So it would look something like this. 25 00:01:17,880 --> 00:01:20,520 First we're going to delete this desktop file 26 00:01:20,520 --> 00:01:21,693 since we don't need it. 27 00:01:23,280 --> 00:01:27,870 And then you specify CP 'file3.PY' 28 00:01:27,870 --> 00:01:30,840 and we specify the full path to the desktop 29 00:01:30,840 --> 00:01:35,340 which is slash 'home', slash 'Mr. Hacker', 30 00:01:35,340 --> 00:01:37,860 and then slash 'desktop'. 31 00:01:37,860 --> 00:01:40,650 After it, we also want to specify slash 32 00:01:40,650 --> 00:01:44,640 and type here the name that we want our copy to have. 33 00:01:44,640 --> 00:01:48,210 So let's just call it our 'copy.PY'. 34 00:01:48,210 --> 00:01:51,660 We added '.PY' since it is a Python program. 35 00:01:51,660 --> 00:01:54,480 Press enter, and you will see right away 36 00:01:54,480 --> 00:01:57,987 on the desktop we got our 'copy.PY'. 37 00:01:59,130 --> 00:02:01,710 Now that we got that figured out, let us talk 38 00:02:01,710 --> 00:02:02,556 about the few network commands that we will 39 00:02:02,556 --> 00:02:05,943 use a lot throughout this course. 40 00:02:06,990 --> 00:02:11,610 The most important command we already know is 'IF config' 41 00:02:11,610 --> 00:02:15,030 we use, 'IF config' command to get our IP address. 42 00:02:15,030 --> 00:02:18,073 And what the output of this command is, 43 00:02:18,073 --> 00:02:21,240 is all the network interfaces, as well as 44 00:02:21,240 --> 00:02:24,933 IP addresses corresponding to those interfaces. 45 00:02:26,130 --> 00:02:29,520 If I run 'IF config', oops, 46 00:02:29,520 --> 00:02:33,747 we get command not found, so we must run 'sudo', 47 00:02:33,747 --> 00:02:36,720 'IF config', press enter. 48 00:02:36,720 --> 00:02:39,690 Then we enter our password, 49 00:02:39,690 --> 00:02:44,690 and here I have a few interfaces. 50 00:02:45,660 --> 00:02:47,160 So let me enlarge the terminal 51 00:02:47,160 --> 00:02:49,350 so we can see entire command. 52 00:02:49,350 --> 00:02:51,240 Let's just fully enlarge it, 53 00:02:51,240 --> 00:02:54,210 and run the command once again. 54 00:02:54,210 --> 00:02:56,610 And by the way, you can navigate to the previous 55 00:02:56,610 --> 00:03:00,690 commands using upper and lower arrow, so I can 56 00:03:00,690 --> 00:03:03,930 navigate between all the commands that I ran previously. 57 00:03:03,930 --> 00:03:07,050 And here is 'sudo IF config', 58 00:03:07,050 --> 00:03:08,577 and this is the output of my 59 00:03:08,577 --> 00:03:11,130 'IF config' command. For you, 60 00:03:11,130 --> 00:03:13,143 this will probably be different. 61 00:03:14,220 --> 00:03:17,430 Here I have 'ETH0' interface, 62 00:03:17,430 --> 00:03:19,170 which is my cable connection 63 00:03:19,170 --> 00:03:22,870 and it has an IP address of 192.168.1.12 64 00:03:25,950 --> 00:03:28,500 And I can also see the loop back interface 65 00:03:28,500 --> 00:03:31,680 which is this 'LO', which all of us should have 66 00:03:31,680 --> 00:03:36,680 and it'll be an IP address or 127.0.0.1 67 00:03:36,750 --> 00:03:39,930 which is also a local host IP. 68 00:03:39,930 --> 00:03:42,480 For this course, we will usually be interested 69 00:03:42,480 --> 00:03:45,600 in this 'ETH0' IP address. 70 00:03:45,600 --> 00:03:48,480 If you have another interface called differently 71 00:03:48,480 --> 00:03:50,070 that is also fine. 72 00:03:50,070 --> 00:03:52,560 You could have a different named interface if you 73 00:03:52,560 --> 00:03:56,655 for example, are connecting over wifi, this IP address 74 00:03:56,655 --> 00:04:01,655 that we get right here, it's called local IP address 75 00:04:02,370 --> 00:04:04,350 which means it only works inside 76 00:04:04,350 --> 00:04:06,420 of our network to communicate 77 00:04:06,420 --> 00:04:10,800 with other devices that are also inside of our network. 78 00:04:10,800 --> 00:04:13,350 There is also something called public IP address 79 00:04:13,350 --> 00:04:16,110 which we are going to talk about later in the course. 80 00:04:16,110 --> 00:04:17,820 For now, just remember that 81 00:04:17,820 --> 00:04:21,089 'IF config' outputs local IP address as well 82 00:04:21,089 --> 00:04:23,463 as our network interfaces. 83 00:04:24,510 --> 00:04:27,270 Another thing we can get from 'IF config' 84 00:04:27,270 --> 00:04:30,963 is our MAC address for a specific interface. 85 00:04:32,520 --> 00:04:37,520 So for the 'ETH0' interface, here is my Mac address. 86 00:04:38,610 --> 00:04:40,380 And what Mac address is, 87 00:04:40,380 --> 00:04:44,490 is a unique identifier for every device. 88 00:04:44,490 --> 00:04:47,070 Unlike local IP addresses that could be the same 89 00:04:47,070 --> 00:04:50,790 in different networks for example, it is a great possibility 90 00:04:50,790 --> 00:04:53,850 that you also have the IP address starting 91 00:04:53,850 --> 00:04:56,403 with one 192.168.1. 92 00:04:57,360 --> 00:04:59,220 While the Mac address is unique 93 00:04:59,220 --> 00:05:01,050 for every device in the world. 94 00:05:01,050 --> 00:05:03,090 And in case you're new to all of this 95 00:05:03,090 --> 00:05:05,220 and don't have much previous experience 96 00:05:05,220 --> 00:05:07,710 with Mac addresses and IP addresses, 97 00:05:07,710 --> 00:05:10,980 you might be asking why do we need both of them? 98 00:05:10,980 --> 00:05:13,260 Well let me explain like this. 99 00:05:13,260 --> 00:05:15,600 Mac addresses are unique and usable 100 00:05:15,600 --> 00:05:18,120 in communications with your neighbor machines, 101 00:05:18,120 --> 00:05:21,750 or simply with machines that are on your network. 102 00:05:21,750 --> 00:05:24,110 While IP addresses are used to communicate 103 00:05:24,110 --> 00:05:27,560 over internet and they can also change. 104 00:05:27,560 --> 00:05:29,880 Remember it like this, 105 00:05:29,880 --> 00:05:33,030 Mac address tells you who you are. 106 00:05:33,030 --> 00:05:35,583 IP address tells you where you are. 107 00:05:36,540 --> 00:05:39,600 So that is the 'IF config' command. 108 00:05:39,600 --> 00:05:42,630 And now that they think of this 'IF config' command, 109 00:05:42,630 --> 00:05:45,870 there is one more important command that I didn't show you 110 00:05:45,870 --> 00:05:49,530 and that you will use a lot, which is 'sudo'. 111 00:05:49,530 --> 00:05:52,410 Remember we used it with 'IF config'. 112 00:05:52,410 --> 00:05:55,530 Now 'sudo' is not the part of the 'IF config' command. 113 00:05:55,530 --> 00:05:58,050 It is just a command that we use 114 00:05:58,050 --> 00:06:01,890 once we want to execute something as a route user. 115 00:06:01,890 --> 00:06:04,020 And just to remind you, our route user 116 00:06:04,020 --> 00:06:05,850 is something like an administrator. 117 00:06:05,850 --> 00:06:09,543 It has highest privileges above all other users. 118 00:06:10,380 --> 00:06:14,185 With route user, you can execute any commands that you want. 119 00:06:14,185 --> 00:06:17,760 For example, once we ran this, 'IF config' command 120 00:06:17,760 --> 00:06:20,280 it told us command doesn't exist. 121 00:06:20,280 --> 00:06:22,950 If I just type, once again 'IF config' 122 00:06:22,950 --> 00:06:25,490 it'll say command not found. 123 00:06:25,490 --> 00:06:28,657 But after using 'sudo' 'IF config', 124 00:06:30,750 --> 00:06:32,733 we managed to execute it. 125 00:06:33,570 --> 00:06:36,630 That is because 'IF config' command must be ran 126 00:06:36,630 --> 00:06:39,303 with route privileges in order for it to execute. 127 00:06:40,590 --> 00:06:41,880 Throughout this course we will 128 00:06:41,880 --> 00:06:44,550 encounter many programs and many commands 129 00:06:44,550 --> 00:06:47,910 that will require 'sudo' in order to run. 130 00:06:47,910 --> 00:06:50,700 And sometimes there could be multiple commands 131 00:06:50,700 --> 00:06:54,150 at once that we must execute as a route user. 132 00:06:54,150 --> 00:06:55,080 There is one called tricks 133 00:06:55,080 --> 00:06:56,490 so you don't have to type 'sudo' 134 00:06:56,490 --> 00:06:58,590 before every command is to run 135 00:06:58,590 --> 00:07:00,480 at the beginning 'sudo' and 136 00:07:00,480 --> 00:07:03,990 then 'sudo' you press enter. 137 00:07:03,990 --> 00:07:06,810 And if you're running 'sudo' for the first time inside 138 00:07:06,810 --> 00:07:10,290 of one terminal session, it'll ask you for your password 139 00:07:10,290 --> 00:07:13,953 and then it'll log in into the route terminal. 140 00:07:15,030 --> 00:07:17,100 So everything you run from now on 141 00:07:17,100 --> 00:07:19,650 you will run as a route account. 142 00:07:19,650 --> 00:07:23,400 Right now I no longer need to specify 'sudo' 'IF config'. 143 00:07:23,400 --> 00:07:26,910 I can just specify 'IF config' and it'll not tell 144 00:07:26,910 --> 00:07:29,820 me command not found, it'll execute it since I am 145 00:07:29,820 --> 00:07:32,130 a route user as it says right here, 146 00:07:32,130 --> 00:07:35,313 it is no longer 'Mr. Hacker', it is now route. 147 00:07:36,330 --> 00:07:39,000 If you want to exit out of this route terminal 148 00:07:39,000 --> 00:07:40,500 you simply just type 'exit' 149 00:07:40,500 --> 00:07:44,640 and it'll go back to your 'Mr. Hacker' terminal. 150 00:07:44,640 --> 00:07:47,850 Now this can also be applied to files. 151 00:07:47,850 --> 00:07:51,450 Some files might be created only for you're account to edit. 152 00:07:51,450 --> 00:07:53,730 For example, if we run the command 153 00:07:53,730 --> 00:07:58,730 'sudo touch file 1', we press enter. 154 00:07:59,880 --> 00:08:04,407 And if we, for example, type 'sudo nano file 1'. 155 00:08:05,430 --> 00:08:07,467 Type here, 'hello there'. 156 00:08:08,760 --> 00:08:13,080 We control O to save and then control X to exit. 157 00:08:13,080 --> 00:08:15,330 We won't be able to edit this file 158 00:08:15,330 --> 00:08:17,250 as a normal user without the 'sudo' 159 00:08:17,250 --> 00:08:19,773 command or without the route account. 160 00:08:20,700 --> 00:08:24,660 If I lower this terminal, here is our 'file 1'. 161 00:08:24,660 --> 00:08:27,360 And the reason why we can't edit it is because 162 00:08:27,360 --> 00:08:31,350 this actual file right now has been opened and edited 163 00:08:31,350 --> 00:08:33,869 with route privileges and once we saved it, 164 00:08:33,869 --> 00:08:36,299 we saved it as a route, so right now, 165 00:08:36,299 --> 00:08:40,465 if we try to nano it, it'll tell me file is 166 00:08:40,465 --> 00:08:44,220 unwritable, which means I cannot write anything. 167 00:08:44,220 --> 00:08:46,930 Well, I mean I can, but if we try to save it 168 00:08:47,809 --> 00:08:51,753 it'll tell me right here, permission denied. 169 00:08:52,920 --> 00:08:57,210 So let's close this and open terminal once again. 170 00:08:57,210 --> 00:08:59,400 However, if you go as a route account, 171 00:08:59,400 --> 00:09:03,813 'sudo nano file 1' and we type our password. 172 00:09:04,650 --> 00:09:07,203 Now we can type anything we want. 173 00:09:08,790 --> 00:09:11,520 Just one second, It seems that we opened the wrong file. 174 00:09:11,520 --> 00:09:14,430 This is the file one that we created from the previous 175 00:09:14,430 --> 00:09:16,680 video that says today's a really good day. 176 00:09:16,680 --> 00:09:20,250 And to go to the file one, that route account 177 00:09:20,250 --> 00:09:23,013 created, I believe it is one directory back. 178 00:09:25,770 --> 00:09:30,060 Or let's just go to the 'sudo' user type enter 179 00:09:30,060 --> 00:09:35,060 'CD Mr. Hacker CD desktop cat file 1' 180 00:09:37,290 --> 00:09:39,180 Nevermind, since we can't really find it, 181 00:09:39,180 --> 00:09:41,130 let us just create another file. 182 00:09:41,130 --> 00:09:44,850 Just make sure you go to the route account of the terminal 183 00:09:44,850 --> 00:09:48,387 and then type 'nano test file'. 184 00:09:49,830 --> 00:09:51,810 And once you type 'nano test file' here, 185 00:09:51,810 --> 00:09:54,783 type hello there, save this, 186 00:09:56,190 --> 00:09:59,670 exit the route account and if I lower terminal 187 00:09:59,670 --> 00:10:03,000 right now, we will see this test file right here 188 00:10:03,000 --> 00:10:07,170 on our desktop, that it also has this lock right here. 189 00:10:07,170 --> 00:10:11,883 This means we as a normal user cannot edit this file. 190 00:10:13,020 --> 00:10:14,940 We first need to go to desktop directories. 191 00:10:14,940 --> 00:10:18,120 So let's go to the 'Mr. Hacker' and then desktop. 192 00:10:18,120 --> 00:10:21,420 And we 'nano test file'. 193 00:10:21,420 --> 00:10:24,730 It'll tell us once again, file is unwritable 194 00:10:26,490 --> 00:10:28,890 Only route account can edit it. 195 00:10:28,890 --> 00:10:31,050 And this is something you will encounter a lot. 196 00:10:31,050 --> 00:10:34,020 So it is really important, next time you see 197 00:10:34,020 --> 00:10:36,150 either something like command not found, 198 00:10:36,150 --> 00:10:40,890 or right protected file, or this requires route privileges 199 00:10:40,890 --> 00:10:43,737 just know that it needs to be ran with 'sudo'. 200 00:10:44,610 --> 00:10:48,300 Alrighty, so with this we finished our small crash course 201 00:10:48,300 --> 00:10:51,240 for Linux and I would advise you to practice 202 00:10:51,240 --> 00:10:53,610 a little bit with the commands we learned, 203 00:10:53,610 --> 00:10:57,780 and also explore Kali Linux Operating system a little bit. 204 00:10:57,780 --> 00:11:00,990 Go to different directories, see what it all has. 205 00:11:00,990 --> 00:11:04,563 But be careful not to delete some important files. 206 00:11:05,580 --> 00:11:08,730 Okay, now we are ready to finally go 207 00:11:08,730 --> 00:11:11,064 into the process of penetration testing. 208 00:11:11,064 --> 00:11:12,660 Hopefully you are excited, 209 00:11:12,660 --> 00:11:15,390 since this is where the fun starts. 210 00:11:15,390 --> 00:11:18,120 Let us see how to perform the first phase 211 00:11:18,120 --> 00:11:20,610 which is information gathering. 212 00:11:20,610 --> 00:11:21,443 See you there.