1 00:00:00,330 --> 00:00:02,700 Hello everybody and welcome back. 2 00:00:02,740 --> 00:00:07,950 And in the previous editorials we actually added some of the additional functions of Marshall such as 3 00:00:08,400 --> 00:00:10,830 using a screenshot on Target's monitor. 4 00:00:11,010 --> 00:00:17,190 Also uploading normally files downloading files from the Internet using a help command changing directory 5 00:00:17,220 --> 00:00:17,940 and so on. 6 00:00:18,840 --> 00:00:25,190 Now as we can see right here I just want to show you that in the shop options I also added the queue 7 00:00:25,200 --> 00:00:27,870 commands since we didn't specify in the previous video. 8 00:00:27,990 --> 00:00:31,970 So we have the queue command that will actually exit the reverse shell. 9 00:00:32,040 --> 00:00:37,590 So make sure to add it right there so the users once they use for example your program your server know 10 00:00:37,590 --> 00:00:43,850 what they need to specify in order to actually exit the shell. 11 00:00:43,860 --> 00:00:49,770 So right now what we want to do is want to add another big option to our reverse shell which is the 12 00:00:49,770 --> 00:00:50,670 key logger. 13 00:00:50,760 --> 00:00:55,010 But before we actually implement the kill agree no backdoor itself. 14 00:00:55,020 --> 00:01:02,820 Let's see how we can actually code one in a simple program using a library that in a python actually 15 00:01:02,820 --> 00:01:06,750 has now that library is not installed in the clinics. 16 00:01:06,780 --> 00:01:08,630 So we need to install it. 17 00:01:08,640 --> 00:01:11,180 I already did but I will show you what you need to do. 18 00:01:11,190 --> 00:01:18,450 So let us exit is what you need to do is type your pip install by input. 19 00:01:18,480 --> 00:01:23,820 Now this will actually download it for you as you can see right here for me it says require a requirement 20 00:01:23,820 --> 00:01:27,240 already satisfied by input library. 21 00:01:27,240 --> 00:01:36,360 So I will just open my Python to interpreter so python and in order for us to actually import what we 22 00:01:36,360 --> 00:01:41,670 need we just need to type your import by input not keyboard. 23 00:01:42,240 --> 00:01:47,160 While we're using defined that keyboard Well basically because we want to make a key logger which would 24 00:01:47,160 --> 00:01:49,740 capture all the keystrokes from the target machine. 25 00:01:49,980 --> 00:01:55,800 So we use the dot keyboard available option or function in the PI input library. 26 00:01:55,800 --> 00:02:01,380 Now we can write a simple but not really useful key logger in just a few functions so let me just show 27 00:02:01,380 --> 00:02:07,560 you how we can do that in order for us to actually make that key logger let the sexually open a new 28 00:02:07,560 --> 00:02:11,180 file we will use the same directory as this one. 29 00:02:11,190 --> 00:02:14,010 So we don't actually make a multiple directories for this. 30 00:02:14,010 --> 00:02:18,690 So let us nano key logger one dot pi since this is our prototype. 31 00:02:18,780 --> 00:02:21,350 We will add our standard path path. 32 00:02:21,360 --> 00:02:29,590 So user in Python and then we will import Python or by input not keyboard. 33 00:02:30,360 --> 00:02:33,140 See that's the that we will use now. 34 00:02:33,810 --> 00:02:41,100 Right here let the sexually set up a listener for our keyboard keystrokes so in order to do that you 35 00:02:41,100 --> 00:02:49,050 need to specify this function so keyboard and then after that dot listener which will listen or basically 36 00:02:49,080 --> 00:02:53,580 it will capture the keystrokes and it will process them in a certain function. 37 00:02:53,640 --> 00:02:59,820 So we just type your on underscore press equals and then you need to specify the name of the function 38 00:02:59,820 --> 00:03:01,130 that we will use. 39 00:03:01,140 --> 00:03:07,270 So we will use process underscore keys you can name this function anything you want. 40 00:03:07,270 --> 00:03:08,960 We didn't even code it yet. 41 00:03:09,190 --> 00:03:13,010 It would be a simple function for these first Coryell or key logger. 42 00:03:13,180 --> 00:03:16,420 But let us just for now on code the rest of this. 43 00:03:16,420 --> 00:03:22,570 So the next thing we need to code is with keyboard underscore listener. 44 00:03:23,020 --> 00:03:27,680 And then two dots then make sure to tap the next thing that could will use. 45 00:03:27,760 --> 00:03:29,560 Which will we not join. 46 00:03:29,560 --> 00:03:30,370 Now this. 47 00:03:30,670 --> 00:03:35,120 Let me just type here so keyboard underscore listener not join. 48 00:03:35,140 --> 00:03:42,610 And then two brackets this will basically perform a listening on our keyboard and now all we have to 49 00:03:42,610 --> 00:03:47,360 do is call the function that will actually do something with those recorded keystrokes. 50 00:03:47,410 --> 00:03:51,890 What we want to do in a key logger for known is just print those letters. 51 00:03:52,180 --> 00:03:57,970 So let's actually code our function that we specify right here which is the process keys so make sure 52 00:03:57,970 --> 00:04:05,860 to call it the same process keys and in that function what we want to actually input is the key itself. 53 00:04:06,640 --> 00:04:12,370 So what this will do the listener will call that function and it will pass all the keys that were input 54 00:04:12,580 --> 00:04:19,210 into that function and what we want to do with those keys is just print them print key. 55 00:04:19,210 --> 00:04:25,390 So basically when someone types in this will listen for the incoming input on the keyboard then it will 56 00:04:25,390 --> 00:04:27,210 send the key back to this function. 57 00:04:27,280 --> 00:04:31,160 And what this function will do is it'll printed the key itself. 58 00:04:31,300 --> 00:04:34,840 So let's see how this simple thing will work from now on. 59 00:04:34,840 --> 00:04:37,390 So let us actually control all this. 60 00:04:38,300 --> 00:04:40,020 LSC rage mode. 61 00:04:40,030 --> 00:04:47,070 Class X on the key logger let the section run the key logger. 62 00:04:48,400 --> 00:04:50,800 Keyboard listener not is not defined 63 00:04:56,850 --> 00:04:57,300 Oh. 64 00:04:57,390 --> 00:05:03,570 Make sure to actually call this the keyboard listener as well so keyboard underscore listener. 65 00:05:03,630 --> 00:05:07,990 That's because I specify here listener and here use keyboard listener. 66 00:05:08,130 --> 00:05:12,030 So in order for this to work you need to specify the same name for all of this. 67 00:05:12,030 --> 00:05:17,530 Since this is the class that we used and actually deliver to the keyboard listener we use to listening 68 00:05:18,030 --> 00:05:24,390 weekly by input library and right now all we want to do is control or save and then we want to actually 69 00:05:24,390 --> 00:05:29,970 run this so key logger that wandered by and you can see if you just press your enter. 70 00:05:29,980 --> 00:05:35,910 Nothing will really happen it will just run but if you start typing in your keyboard some random letters 71 00:05:35,910 --> 00:05:38,010 you will see it will start printing them out. 72 00:05:39,720 --> 00:05:47,280 What this means basically is that it actually records our keystrokes and just prints them at the same 73 00:05:47,280 --> 00:05:51,250 time at the screen so you can see a SD. 74 00:05:51,780 --> 00:05:53,520 Everything here is printed. 75 00:05:53,520 --> 00:05:55,700 Now this you write here stands for unicode. 76 00:05:55,710 --> 00:06:01,080 You will have to remove that as well and you can see right here if I just press here some some buttons 77 00:06:01,080 --> 00:06:09,990 on my keyboard that are not letters you can see key tab key enter key space key backspace and so on. 78 00:06:09,990 --> 00:06:17,650 So we will need to actually change this a little bit but for now on this is just the simple kg. 79 00:06:17,800 --> 00:06:20,530 Let us see what we can actually do with it. 80 00:06:20,550 --> 00:06:29,970 So just change it just a little bit so that so and our key logger one block by we have the process function. 81 00:06:30,060 --> 00:06:34,920 This part right here we will not even change at all since this is the standard path that we need to 82 00:06:34,920 --> 00:06:37,770 use in order to actually listen for keystrokes. 83 00:06:37,770 --> 00:06:40,050 What we want to change is the process. 84 00:06:40,050 --> 00:06:48,120 Case function so instead of actually printing the key let us not printed right here let us actually 85 00:06:48,120 --> 00:06:49,790 write the key to the file. 86 00:06:49,920 --> 00:06:57,510 Since if you for example think about it if you actually just use this function on our backdoor we do 87 00:06:57,510 --> 00:07:04,290 not have anything basically for printing would not have any use of the reverse shell printing the keys 88 00:07:04,320 --> 00:07:05,370 at the screen. 89 00:07:05,460 --> 00:07:12,360 We want to write those keys into a function or into our file and then we can read from the file or send 90 00:07:12,360 --> 00:07:17,740 the contents of the file to the server which can actually read the keystrokes. 91 00:07:17,820 --> 00:07:21,060 Then of course after that we would need to delete the file itself. 92 00:07:21,840 --> 00:07:28,470 So right now let us open a simple file so with the regular command with open and what we want to do 93 00:07:28,470 --> 00:07:30,300 right here is called the file anything we want. 94 00:07:30,300 --> 00:07:31,300 So let's call it. 95 00:07:31,600 --> 00:07:37,120 He's the 60 or it's just quite a logger so we know what it is. 96 00:07:37,120 --> 00:07:43,620 So kilogram up to 60 and we want to actually use right here not BW or not the. 97 00:07:43,630 --> 00:07:44,530 We want to use. 98 00:07:44,890 --> 00:07:51,220 We want to use a option which stands for append because if we use right option it will just rewrite 99 00:07:51,220 --> 00:07:54,840 every every keystrokes before the current one. 100 00:07:54,850 --> 00:07:59,710 So we want to actually add the key strong spot to another so we can actually get a full sentence in 101 00:07:59,710 --> 00:08:05,140 that file or basically whatever the target has typed in their keyboard. 102 00:08:05,140 --> 00:08:08,730 So let us call this as for example. 103 00:08:09,850 --> 00:08:15,460 And then we want to write the keys to that file so we can see this function process. 104 00:08:15,460 --> 00:08:18,560 We can get the key to we send the key to that function. 105 00:08:18,580 --> 00:08:24,080 And right now we want to write the string of this key to that function. 106 00:08:24,100 --> 00:08:27,190 Now let me just show you so thin dot right. 107 00:08:28,100 --> 00:08:37,030 And we want to write the string of this key so let us say this and let's see how this follow if we just 108 00:08:37,030 --> 00:08:41,840 go right here and we run our key logger wandered by. 109 00:08:41,930 --> 00:08:50,420 You can see now even if I type it pages type here Hello World and presenter nothing will actually be 110 00:08:50,420 --> 00:08:58,650 printed out as in the previous example of key logger as it has in the first example Kellogg or so let 111 00:08:58,660 --> 00:08:59,940 us call this right now. 112 00:09:00,050 --> 00:09:06,130 But if I just type your address here you can see we get a file called key logger not the extreme. 113 00:09:06,170 --> 00:09:14,300 So let us get that file to see what is in that file so key logger dot DST and you can see here we have 114 00:09:14,330 --> 00:09:15,960 hello world. 115 00:09:16,040 --> 00:09:22,330 Now it is a little bit ugly since it has this new option right here on a before every letter. 116 00:09:22,460 --> 00:09:27,980 So we will make sure to remove that in the next video from now on we actually saw how we can print out 117 00:09:28,100 --> 00:09:32,410 the keystrokes into a file which is very useful for us. 118 00:09:32,450 --> 00:09:37,870 So what would we want what we actually want to do at the end is actually have a file that will be a 119 00:09:37,880 --> 00:09:44,750 hidden file and by hidden I mean it will also be for example in the AP data environment while we use 120 00:09:44,750 --> 00:09:49,730 it we want to capture the keystrokes in that file of the target and then we want to send the keystrokes 121 00:09:49,730 --> 00:09:57,990 back to our server and then at the end of the using the reverse shall we want to delete that file. 122 00:09:58,170 --> 00:10:01,200 So basically months on specifies the queue option in our backdoor. 123 00:10:01,350 --> 00:10:04,730 It would lead the file out of that directory. 124 00:10:04,800 --> 00:10:09,280 So that would be about it for these introductory tutorial for the kilogram. 125 00:10:09,330 --> 00:10:15,260 This will be a much simpler program than our backdoor so don't forget this will not be that long. 126 00:10:15,450 --> 00:10:19,710 I hope this tutorial and I hope I see you in the next video by.