1 00:00:00,240 --> 00:00:02,250 Hello everybody and welcome back. 2 00:00:02,340 --> 00:00:08,950 Right now let's see how we can write our keystrokes to file every 20 seconds for example or not really 3 00:00:08,950 --> 00:00:09,300 write. 4 00:00:09,300 --> 00:00:13,000 We actually want to upend the keystrokes to that file. 5 00:00:13,230 --> 00:00:16,670 So let us see how we can actually do that. 6 00:00:16,950 --> 00:00:20,690 Let us make our final project which will be here longer apply. 7 00:00:20,690 --> 00:00:26,130 So let us first copy everything from the key logger to the PI select everything 8 00:00:29,210 --> 00:00:34,070 we actually can select everything so or I'm not really sure if this will work. 9 00:00:34,070 --> 00:00:41,900 Control it doesn't work basically will have to copy from two times or you know what we can actually 10 00:00:41,900 --> 00:00:49,960 just simply rename key logger to the PI into a key logger Pi which is a much simpler solution. 11 00:00:49,970 --> 00:00:58,790 So let's first delete the key logger that you see and delete the key logger wondered by now. 12 00:00:58,820 --> 00:01:06,490 Let us now know our key logger want a PI and right here what we want to do is basically just add it 13 00:01:06,490 --> 00:01:13,690 to the report function since that is the function that actually sends us back the actual keystrokes 14 00:01:13,690 --> 00:01:14,880 to our terminals. 15 00:01:14,880 --> 00:01:18,390 So let's first of all see what we need to do. 16 00:01:18,400 --> 00:01:20,890 So basically let us think about it. 17 00:01:20,920 --> 00:01:27,520 We want to write this to a file so we do not want to print the keys. 18 00:01:27,740 --> 00:01:38,370 We want to type here with open but not right here since that would be something that we actually don't 19 00:01:38,370 --> 00:01:39,440 want to do. 20 00:01:39,630 --> 00:01:43,830 We don't want to open our file every 20 seconds. 21 00:01:43,920 --> 00:01:49,740 What we want to do to our file is actually write to it every 20 seconds. 22 00:01:49,830 --> 00:01:57,540 So let us see how we can do that we need to open the file. 23 00:01:57,540 --> 00:02:02,840 Let's see where actually we can open it so we can open it in the process keys. 24 00:02:03,450 --> 00:02:07,250 I believe so with open. 25 00:02:07,650 --> 00:02:09,330 Well let's not open a thread here. 26 00:02:09,330 --> 00:02:13,530 Let the sexually open it out of the entire program right here. 27 00:02:13,530 --> 00:02:20,970 So before we actually run any of this we want to open the file so with open and we want to call it the 28 00:02:23,370 --> 00:02:32,780 for example test or key logger that the extent being before we want to open it as the append. 29 00:02:33,230 --> 00:02:37,220 And the operators for example. 30 00:02:38,100 --> 00:02:44,290 And then what we want to do after that is actually run run. 31 00:02:44,290 --> 00:02:45,400 This function right here 32 00:02:49,580 --> 00:02:50,930 both of these functions. 33 00:02:50,930 --> 00:02:57,110 So let me see let me think about this this should actually work if we run the report function it will 34 00:02:57,110 --> 00:03:03,410 run it every five seconds and in our report function we will actually try to for example 35 00:03:06,050 --> 00:03:07,730 keys equal nothing 36 00:03:11,570 --> 00:03:14,160 or we actually want to do it before so faint. 37 00:03:15,080 --> 00:03:16,840 Right. 38 00:03:17,070 --> 00:03:19,470 I want to do is write the keys. 39 00:03:19,600 --> 00:03:26,630 Then we set keys to be nothing that we call the function every five seconds which we will change to 40 00:03:27,280 --> 00:03:28,130 10 seconds 41 00:03:31,140 --> 00:03:37,430 and we also listen for the for the listener of our keyboard. 42 00:03:37,440 --> 00:03:40,410 So let us see if this will actually work. 43 00:03:44,180 --> 00:03:45,320 So control. 44 00:03:45,320 --> 00:03:48,820 Oh let me just check this out. 45 00:03:49,030 --> 00:03:51,230 KG The pi hello world. 46 00:03:51,230 --> 00:04:02,890 What is happening enter we wait for example for 10 seconds we can see nothing get printed out right 47 00:04:02,890 --> 00:04:03,390 here. 48 00:04:03,520 --> 00:04:10,400 But if we close this program we have key logger that the 16th that doesn't have anything which isn't 49 00:04:10,540 --> 00:04:11,110 really good. 50 00:04:11,110 --> 00:04:15,140 So let's see what we need to fix right here. 51 00:04:15,280 --> 00:04:16,610 Process keys. 52 00:04:16,750 --> 00:04:18,950 We set the report to be good. 53 00:04:18,940 --> 00:04:20,320 Timer right here. 54 00:04:20,320 --> 00:04:21,510 Keyboard listener. 55 00:04:23,020 --> 00:04:27,240 So maybe we actually have to wait a little bit longer. 56 00:04:27,240 --> 00:04:32,190 I'm not really sure let us actually run this once again. 57 00:04:33,330 --> 00:04:34,540 Hello. 58 00:04:34,710 --> 00:04:36,700 Now let's wait for 10 seconds to pass. 59 00:04:36,700 --> 00:04:38,170 Maybe we didn't wait long enough. 60 00:04:45,280 --> 00:04:47,980 This basically doesn't work we'll take another approach with. 61 00:04:48,840 --> 00:04:53,510 So we 10 seconds pass for sure so let us close this gap. 62 00:04:53,520 --> 00:04:55,410 The key logger 2016. 63 00:04:55,610 --> 00:04:56,970 Nothing there so something is wrong. 64 00:04:56,970 --> 00:04:58,560 Let's see how we can fix it. 65 00:04:58,560 --> 00:05:00,300 So now know Kyogle by 66 00:05:03,580 --> 00:05:05,480 right here. 67 00:05:06,130 --> 00:05:14,860 What we want to actually do is for example instead of opening the file right here let us open it in 68 00:05:14,860 --> 00:05:17,030 our process keys function. 69 00:05:17,530 --> 00:05:20,050 So we got this one back one back 70 00:05:22,990 --> 00:05:28,470 and instead of actually doing this let's actually write something like this. 71 00:05:28,480 --> 00:05:29,560 So right here 72 00:05:33,010 --> 00:05:35,070 we do not want this. 73 00:05:35,140 --> 00:05:36,340 We do not want to print. 74 00:05:36,340 --> 00:05:39,620 So let us remove that and right here. 75 00:05:40,330 --> 00:05:53,080 Before the global keys we want to use the with open and then let's open for example key logger dock. 76 00:05:53,310 --> 00:05:57,790 He exclaimed open it for the append as always. 77 00:05:57,790 --> 00:06:04,120 As Finn let's call it like that then what we want to do is basically write the string of that key. 78 00:06:04,600 --> 00:06:13,960 So what we actually want to do right here is tab this all of this to our file to see if this will work 79 00:06:14,170 --> 00:06:20,270 if we tap every line by one so it belongs to our top statement right here. 80 00:06:25,770 --> 00:06:27,750 Let's see if this will work. 81 00:06:27,900 --> 00:06:30,620 So keys and this as well. 82 00:06:30,630 --> 00:06:36,080 And then down here we specify Phil right keys. 83 00:06:37,980 --> 00:06:40,800 Let's see if this will actually work. 84 00:06:40,800 --> 00:06:45,840 Set this to be five seconds so we don't have to wait 10 say this. 85 00:06:45,870 --> 00:06:48,930 Now this I have no idea this will work. 86 00:06:48,930 --> 00:06:51,400 We will have to try it out. 87 00:06:52,020 --> 00:06:58,500 Attribute error in right keys. 88 00:06:59,270 --> 00:07:00,820 Let us see what is wrong. 89 00:07:00,840 --> 00:07:01,260 OK. 90 00:07:01,260 --> 00:07:03,660 We probably can't really do this right here. 91 00:07:04,890 --> 00:07:11,460 But what we can do is actually perform the print statement or the right statement right here. 92 00:07:11,460 --> 00:07:15,620 So let us see if only one of these will work. 93 00:07:15,630 --> 00:07:22,990 So print or not print find that right keys. 94 00:07:24,370 --> 00:07:27,070 Now I'm pretty sure what the error was but let's type here. 95 00:07:27,070 --> 00:07:33,260 Hello world once again presenter wait for five seconds. 96 00:07:33,330 --> 00:07:38,070 We will close this program in order to see if anything has been written to our key logger that the extreme. 97 00:07:38,610 --> 00:07:41,210 So Cat kill over 60. 98 00:07:41,310 --> 00:07:43,340 And here we have hello world. 99 00:07:43,740 --> 00:07:50,400 But something right here doesn't really work since we got hello world printed out here five times or 100 00:07:50,400 --> 00:07:54,050 something like that. 101 00:07:54,640 --> 00:08:04,390 That means that we actually get the key logger to be specified wrongly so it opens this file every time 102 00:08:05,670 --> 00:08:08,240 and then it writes Our keys every time 103 00:08:11,530 --> 00:08:13,570 but what if we do it like this. 104 00:08:13,570 --> 00:08:17,890 So let us get everything back as before. 105 00:08:17,890 --> 00:08:24,070 Now sometimes it's good to experiment with things like this and this is all you actually learn to code. 106 00:08:24,910 --> 00:08:26,680 This part right here we can delete 107 00:08:29,650 --> 00:08:37,720 this is how you will actually learn to make your own programs by experimenting with some of this stuff. 108 00:08:37,720 --> 00:08:41,250 So sometimes some function will not work. 109 00:08:41,440 --> 00:08:46,810 Sometimes something will not be specified correctly so you have to experiment in order to get it right 110 00:08:46,810 --> 00:08:48,030 next time. 111 00:08:48,040 --> 00:08:54,680 So right here we want to actually open the file right here after the keys. 112 00:08:56,090 --> 00:09:01,180 Let the sexually open it normally so free equals open key logger 113 00:09:03,850 --> 00:09:13,660 not the 60 we open it for the appending man then we actually write here where we actually can usually 114 00:09:13,660 --> 00:09:17,610 the global keys as a first line so we don't get confused. 115 00:09:17,610 --> 00:09:26,860 So copy it right here and then fill open for the appending and then in that right case we write the 116 00:09:26,860 --> 00:09:31,480 keys and then at the end we want to actually close 117 00:09:34,180 --> 00:09:36,190 the program or the file. 118 00:09:36,190 --> 00:09:37,210 Pardon me. 119 00:09:37,390 --> 00:09:43,750 So find that closes what we use to close the file and let us see if this will actually work right now 120 00:09:44,680 --> 00:09:51,700 we run this Hello World Center we wait for five seconds in order to see what we get printed out in our 121 00:09:51,700 --> 00:09:52,180 file. 122 00:09:52,690 --> 00:09:55,290 So I believe five seconds has passed. 123 00:09:55,300 --> 00:09:58,330 So we control access. 124 00:09:58,330 --> 00:10:05,800 So right here then we check out the DST and we can see we finally got this to work we only got printed 125 00:10:05,840 --> 00:10:07,990 this yellow world in our file. 126 00:10:07,990 --> 00:10:09,850 We had two arrows. 127 00:10:09,850 --> 00:10:11,980 First time we didn't get printed anything. 128 00:10:12,100 --> 00:10:13,920 Then we copied to another function. 129 00:10:13,960 --> 00:10:16,310 Then we got printed out Hallowell like five times. 130 00:10:16,310 --> 00:10:19,540 And right now it's not Rochelle. 131 00:10:21,070 --> 00:10:22,830 Everything works well. 132 00:10:22,930 --> 00:10:26,910 So what we did this function should stay the same so as before. 133 00:10:26,940 --> 00:10:33,640 All we have to do is actually at the opening in the report function which will open every five seconds 134 00:10:33,670 --> 00:10:35,960 this file then it provide the keys. 135 00:10:36,040 --> 00:10:41,590 It will set the variable keys to be nothing and then it will close the file then it will call this function 136 00:10:41,590 --> 00:10:43,870 once again in the next five seconds. 137 00:10:43,870 --> 00:10:47,980 So let us see if now we run this for a few more seconds. 138 00:10:48,040 --> 00:10:55,030 So first we write Hello world in first five seconds and in the next five seconds we will write something 139 00:10:55,030 --> 00:10:57,880 else so we can see if it adds twice or not. 140 00:10:57,880 --> 00:10:59,560 So after five seconds 141 00:11:02,160 --> 00:11:06,120 what are you doing right now. 142 00:11:06,120 --> 00:11:13,170 Question mark that a presenter for example type your not much. 143 00:11:13,710 --> 00:11:21,960 What about you presenter and then we can close this can see what we got printed out in our key logger 144 00:11:21,990 --> 00:11:24,000 that the axes so hello world. 145 00:11:24,000 --> 00:11:25,800 What are you doing right now. 146 00:11:25,800 --> 00:11:27,210 Not much. 147 00:11:27,480 --> 00:11:30,690 Now what I am confused about is this part right here. 148 00:11:31,170 --> 00:11:33,510 So it did print out hello world. 149 00:11:33,630 --> 00:11:38,070 What are you doing twice or basically just a hello world. 150 00:11:38,130 --> 00:11:38,940 So let me see. 151 00:11:39,030 --> 00:11:40,380 Why did it do that 152 00:11:44,440 --> 00:11:45,790 so let's run this once again. 153 00:11:45,970 --> 00:11:47,710 Hello. 154 00:11:47,980 --> 00:11:53,290 Which will be the first five seconds and then in the next five seconds will type world and it next five 155 00:11:53,290 --> 00:11:54,520 seconds we will type. 156 00:11:54,520 --> 00:11:56,440 For example what. 157 00:11:56,560 --> 00:11:58,000 So world 158 00:12:01,280 --> 00:12:05,180 then we wait for a few seconds and we will type here. 159 00:12:05,210 --> 00:12:10,520 What so we can see how many times it printed out each word. 160 00:12:11,310 --> 00:12:14,800 And let's wait another five seconds before we actually close this. 161 00:12:14,810 --> 00:12:16,010 So hello. 162 00:12:16,220 --> 00:12:18,960 What now. 163 00:12:18,970 --> 00:12:19,360 That's right. 164 00:12:19,370 --> 00:12:23,990 Now close this and get our key logger done. 165 00:12:24,790 --> 00:12:25,570 Hello world. 166 00:12:25,580 --> 00:12:27,100 What are you doing right now. 167 00:12:27,140 --> 00:12:28,060 OK. 168 00:12:28,560 --> 00:12:29,000 Oh yes. 169 00:12:29,000 --> 00:12:36,620 So we actually opened this file every time so we actually appends to it what we want to do now as we 170 00:12:36,620 --> 00:12:39,830 could see it printed out everything correctly so hello world what. 171 00:12:40,070 --> 00:12:42,140 Now what I. 172 00:12:42,260 --> 00:12:47,000 This part right here of which I was confused about is because we actually need to delete the file every 173 00:12:47,000 --> 00:12:50,120 time we close our key logger so right now 174 00:12:53,250 --> 00:12:59,180 it opens this key logger to 60 every time and it appends every time we use this key logger. 175 00:12:59,280 --> 00:13:01,490 We will also get in our key logger. 176 00:13:01,500 --> 00:13:03,360 This part right here. 177 00:13:03,360 --> 00:13:10,910 So this is good once you actually want to for example write everything to a file and then get back everything 178 00:13:10,910 --> 00:13:16,160 that the user has typed which we actually want to do but we may need to make sure that right after the 179 00:13:16,220 --> 00:13:21,350 we close the reverse shell we actually delete the key logger dot the file. 180 00:13:21,350 --> 00:13:27,720 So what we need to do is basically nothing at the moment but once we code this in the next we do and 181 00:13:27,740 --> 00:13:35,600 in our reverse shell we need to delete this file every time we actually close our reverse shell. 182 00:13:36,020 --> 00:13:41,830 So what we will do that basically at the end of the program we will just import the OS and that always 183 00:13:41,830 --> 00:13:48,440 start remove key logger dusty axes so that'll be about it. 184 00:13:48,440 --> 00:13:54,470 In this video we will have to specify a few other options in the next video and then we will be good 185 00:13:54,470 --> 00:13:55,100 to go. 186 00:13:55,100 --> 00:13:58,820 So I hope you enjoyed it and I hope I see you in the next video by.