1
00:00:00,480 --> 00:00:06,090
Hello everybody and welcome back to this tutorial where we are going to create a key logger upgraded

2
00:00:06,090 --> 00:00:10,560
a little bit and then implement it into our back door.

3
00:00:10,560 --> 00:00:15,310
Now of course we already have the base part of the key logger since we coded it in the previous project.

4
00:00:15,330 --> 00:00:17,120
So there is no need to do it again.

5
00:00:17,160 --> 00:00:22,420
Therefore the first thing that we're going to do is we're going to copy that key logger into our backdoor

6
00:00:22,440 --> 00:00:23,160
project.

7
00:00:23,160 --> 00:00:24,450
So let's do that right away.

8
00:00:24,720 --> 00:00:27,150
Open up your terminal.

9
00:00:27,150 --> 00:00:27,870
Let's go.

10
00:00:27,990 --> 00:00:29,190
One directory back.

11
00:00:29,220 --> 00:00:35,430
And Robert Key logger project directory and copy key logger not be y to the slash root slash by char

12
00:00:35,430 --> 00:00:44,110
on project slash backdoor once we do that we can exit the terminal and we will have the key logger inside

13
00:00:44,110 --> 00:00:46,090
of our project.

14
00:00:46,090 --> 00:00:46,450
Okay.

15
00:00:46,480 --> 00:00:46,810
Good.

16
00:00:47,560 --> 00:00:51,110
Now the first thing that we notice is that we're missing this library.

17
00:00:51,130 --> 00:00:55,210
So let's install it right away so we don't get those annoying red lines.

18
00:00:55,480 --> 00:00:56,010
Let's type.

19
00:00:56,020 --> 00:00:59,550
Page 3 install by input.

20
00:01:00,370 --> 00:01:07,240
And the first thing we're going to do is we're going to convert our key logger into a class.

21
00:01:07,240 --> 00:01:08,050
That's right.

22
00:01:08,050 --> 00:01:13,480
We're going to use our key logger as a class once we import it inside our back door and we're also going

23
00:01:13,480 --> 00:01:16,410
to add some cool features to these key logger.

24
00:01:16,440 --> 00:01:17,280
OK.

25
00:01:17,390 --> 00:01:23,680
Now straightaway since this is a key logger for Windows we can delete this line as we're only going

26
00:01:23,680 --> 00:01:29,950
to use the path to be the always thought environment of the AP data where we're going to hide our process

27
00:01:29,950 --> 00:01:33,190
manager dot the Steve file which will store the keystrokes.

28
00:01:33,300 --> 00:01:34,100
Okay.

29
00:01:34,240 --> 00:01:40,110
Now let me lower this and let us import two more libraries that we are going to need.

30
00:01:40,150 --> 00:01:42,690
The first one is the OS library.

31
00:01:42,730 --> 00:01:44,440
Part me.

32
00:01:44,740 --> 00:01:46,910
The first one is the time library.

33
00:01:46,960 --> 00:01:50,300
And the second one is threading library.

34
00:01:50,350 --> 00:01:50,830
That's right.

35
00:01:50,840 --> 00:01:54,910
We're going to use threats inside of our key logger.

36
00:01:54,960 --> 00:01:58,280
The next thing that we want to do is we want to create the class.

37
00:01:58,290 --> 00:02:00,800
Now we can call this class simply just a key logger.

38
00:02:00,810 --> 00:02:02,040
It doesn't really matter.

39
00:02:02,040 --> 00:02:08,280
Just make sure that you add the capital K indicating that this is a class we will paste these variables

40
00:02:08,280 --> 00:02:11,180
to be the part of the class.

41
00:02:11,950 --> 00:02:18,760
So let's step everything in as well as the functions you need to tab every line so it can belong to

42
00:02:18,760 --> 00:02:19,390
this class

43
00:02:23,370 --> 00:02:30,810
and then we're going to fix the errors because the class has different syntax than just regular functions

44
00:02:40,510 --> 00:02:47,690
I could have probably selected all and just typed it all immediately but since it started like this.

45
00:02:47,950 --> 00:02:49,480
Let me finish it like this.

46
00:02:49,660 --> 00:02:53,100
And this week listener we're also going to tap in.

47
00:02:53,770 --> 00:02:56,100
It will also belong to the class itself.

48
00:02:56,260 --> 00:03:03,370
But we are also going to add it straightaway into a function that function will be called start and

49
00:03:03,370 --> 00:03:05,170
this function will belong to the class.

50
00:03:05,170 --> 00:03:07,090
Therefore it will be a method.

51
00:03:07,300 --> 00:03:14,470
It will take the self parameter as an object and it will take the global listener as a variable which

52
00:03:14,470 --> 00:03:16,250
we will use right here.

53
00:03:16,600 --> 00:03:16,930
OK.

54
00:03:16,960 --> 00:03:18,910
So this is our start method.

55
00:03:19,210 --> 00:03:22,060
Now let's check all the errors that we have.

56
00:03:22,060 --> 00:03:25,690
So we defined these two variables at the beginning.

57
00:03:25,690 --> 00:03:28,560
Nothing wrong here in our first method.

58
00:03:28,570 --> 00:03:30,670
We need to add the self argument.

59
00:03:30,810 --> 00:03:33,820
Let's not forget the self argument inside of every function.

60
00:03:34,330 --> 00:03:40,060
So the right file should also have the self argument and also whenever we call a method we need to call

61
00:03:40,060 --> 00:03:44,140
it with the self argument specified before.

62
00:03:44,620 --> 00:03:44,980
OK.

63
00:03:45,640 --> 00:03:47,520
Let's see whether we have another error.

64
00:03:47,530 --> 00:03:49,180
Here it is the path.

65
00:03:49,300 --> 00:03:55,150
Well we need to specify self-doubt the path we cannot freely use just path since the path is the variable

66
00:03:55,150 --> 00:03:56,830
that belongs to the key logger class.

67
00:03:56,830 --> 00:04:02,570
So we use the prefix self and we also need to add the self argument to the start.

68
00:04:02,620 --> 00:04:02,850
OK.

69
00:04:02,860 --> 00:04:08,770
We already have it right here and we also need to add the self argument inside of our listener when

70
00:04:08,770 --> 00:04:11,250
we call the press function.

71
00:04:11,260 --> 00:04:12,270
OK.

72
00:04:12,490 --> 00:04:18,280
Now that we fixed all of the errors that we had let's also add the self arguments to all of the variables

73
00:04:19,060 --> 00:04:24,670
inside of our own press function we have global keys and global count.

74
00:04:24,730 --> 00:04:26,940
Now this is something that we can delete straightaway.

75
00:04:27,430 --> 00:04:35,950
So let's delete it right here and instead of appending right here we can append self-doubt keys and

76
00:04:35,940 --> 00:04:37,870
we are appending key.

77
00:04:37,870 --> 00:04:45,040
We also want to type here self-doubt count to be increased plus 1 and inside of this class we are not

78
00:04:45,040 --> 00:04:48,960
going to have the init function because we defined everything right here.

79
00:04:48,970 --> 00:04:55,640
Therefore there is no need for us to have the underscore underscore in its function right here instead

80
00:04:55,640 --> 00:05:02,360
of checking the count we want to check if self-doubt count is greater than one if it is then we will

81
00:05:02,360 --> 00:05:04,880
set the cell count to be equal to zero.

82
00:05:04,910 --> 00:05:12,550
We will call this self-taught flight file onto the self-doubt keys and then we will set the self of

83
00:05:12,560 --> 00:05:15,520
keys to be equal and empty a list.

84
00:05:15,540 --> 00:05:16,320
All right.

85
00:05:16,490 --> 00:05:21,260
If I'm not mistaken that should be everything that we need to change right now.

86
00:05:21,260 --> 00:05:26,180
Let the set a function that will read the keystrokes that are input to the inside of a file and you're

87
00:05:26,180 --> 00:05:29,000
going to see in just a second why we need that function.

88
00:05:29,000 --> 00:05:30,410
So let's first create it.

89
00:05:30,410 --> 00:05:32,920
We're going to call it read blogs.

90
00:05:33,110 --> 00:05:35,900
It will take the self arguments since it belongs to the class.

91
00:05:36,050 --> 00:05:42,550
And then we can open the file which is at the pass or at the self the path location.

92
00:05:42,590 --> 00:05:52,580
We can open it for reading of text and we can open it as F and we will return from this function have

93
00:05:52,640 --> 00:05:56,810
not read which will read all of the contents from this file.

94
00:05:59,330 --> 00:05:59,750
OK.

95
00:05:59,890 --> 00:06:03,970
So right now that does go all the way down check right here.

96
00:06:03,970 --> 00:06:10,050
And let's add another function which is going to be the self-destruct function.

97
00:06:10,240 --> 00:06:16,020
But before we actually code the contents of this function are first of all going to define it.

98
00:06:16,630 --> 00:06:21,820
And before we add anything to it right below we're going to create the main part of the program.

99
00:06:21,850 --> 00:06:25,540
So we want to make sure that this key logger can be read individually.

100
00:06:25,540 --> 00:06:28,840
You do not need to import it in backdoor in case we need it.

101
00:06:28,870 --> 00:06:32,650
We can import it inside of our backdoor and use it like that.

102
00:06:32,650 --> 00:06:39,430
So in order to make this a standalone program as well we can specify if underscore underscore name underscore

103
00:06:39,430 --> 00:06:43,890
underscore equals equals Main.

104
00:06:45,070 --> 00:06:50,890
Then we will run our key logger in any other case once we imported this part of the program below.

105
00:06:50,890 --> 00:06:52,780
This statement will not get threatened.

106
00:06:53,860 --> 00:07:02,070
OK so we're going to initiate a key logger object which we'll call Kellogg equals key logger and we

107
00:07:02,070 --> 00:07:05,120
will call a thread on that key logger.

108
00:07:05,200 --> 00:07:06,460
So how do we do that.

109
00:07:06,460 --> 00:07:14,020
Well we will specify the thread object to be equal to threading that thread and the target function

110
00:07:14,380 --> 00:07:21,850
will be key dot start and you will notice that this start function will start our listener and it will

111
00:07:21,850 --> 00:07:28,540
also process our keys which will call the press function and the on press function will call the right

112
00:07:28,540 --> 00:07:36,890
file function in case we want to read the logs then we need to call the feed logs function separately.

113
00:07:36,890 --> 00:07:42,260
But before that we need first of all start this thread and we started by specifying the start function

114
00:07:42,330 --> 00:07:44,160
on to our thread object.

115
00:07:44,180 --> 00:07:45,790
Now here comes the interesting part.

116
00:07:45,800 --> 00:07:48,050
How can we make all of this work.

117
00:07:48,080 --> 00:07:52,000
I know it might be a little bit confusing but stick with me right here.

118
00:07:52,000 --> 00:07:54,320
We're going to finish it up soon.

119
00:07:54,320 --> 00:07:58,160
First what we need to do is inside of our self-destruct function.

120
00:07:58,310 --> 00:08:05,350
We will add a variable called self-doubt flag to be equal to 1 after that flag is set.

121
00:08:05,350 --> 00:08:09,610
One will call listener dot stop which will stop the listener.

122
00:08:09,610 --> 00:08:17,230
And we also want to us that remove self the path which will remove the file containing all the captured

123
00:08:17,260 --> 00:08:22,360
keystrokes which will self-destruct all of the keystrokes that were saved on the target b c.

124
00:08:22,690 --> 00:08:24,640
OK.

125
00:08:24,850 --> 00:08:30,340
So now that we did that we need to make sure that we are running the key logger until this function

126
00:08:30,340 --> 00:08:31,620
is called.

127
00:08:31,660 --> 00:08:32,800
So how can we do that.

128
00:08:32,800 --> 00:08:38,710
Well we created the self that flag variable or we said the self that flag variable to be equal to 1

129
00:08:39,130 --> 00:08:43,770
but this has to be a global variable in order for us to exit right here as well.

130
00:08:43,810 --> 00:08:50,370
So let's go at the beginning of our class and define the flag to be equal to zero.

131
00:08:50,650 --> 00:08:57,490
And as long as the flag is equal to zero we will run our key logger so we'll specify that right here

132
00:08:58,510 --> 00:09:00,850
in order to access the flag outside of our class.

133
00:09:00,850 --> 00:09:12,270
We will specify while key log dot flag is not equal to 1 if we want to print the logs so the logs we

134
00:09:12,270 --> 00:09:16,640
will store inside of a log variable and the logs will be equal to key log.

135
00:09:16,640 --> 00:09:24,400
Dot read logs and remember read logs function simply returns all of the contents from our file where

136
00:09:24,400 --> 00:09:26,340
the keystrokes are captured OK.

137
00:09:28,150 --> 00:09:37,180
Then we can print the logs and then we can call key log that self destruct which will destroy and delete

138
00:09:37,270 --> 00:09:39,730
our file with all the keystrokes.

139
00:09:39,730 --> 00:09:44,780
And at the end we will join the thread and this will close our program.

140
00:09:45,280 --> 00:09:51,160
But before we actually test this we need to make sure that we are doing this at every 10 seconds to

141
00:09:51,160 --> 00:09:53,060
find that sleep.

142
00:09:53,110 --> 00:09:58,500
Then there is really no need to do this all the time we can just do it every 10 seconds.

143
00:09:58,630 --> 00:10:05,070
So once we capture enough keystrokes we can print it to the screen and then we can self-destruct.

144
00:10:05,320 --> 00:10:06,100
Just one second.

145
00:10:06,100 --> 00:10:09,020
This has to be actually out of the while loop.

146
00:10:09,340 --> 00:10:11,220
So now it should be good to go.

147
00:10:11,260 --> 00:10:13,970
We are simply checking whether the flag is not equal to one.

148
00:10:13,990 --> 00:10:16,600
If it is not equal to one we will read the logs.

149
00:10:16,600 --> 00:10:22,110
If it is equal to 1 well then we will self-destruct OK.

150
00:10:22,150 --> 00:10:23,750
So let's test our program.

151
00:10:24,040 --> 00:10:29,410
But this program should do is it should sleep for 10 seconds then it should print out all the keystrokes

152
00:10:29,410 --> 00:10:35,020
that we inputted in those 10 seconds it should print those keystrokes and then it should self-destruct

153
00:10:35,320 --> 00:10:40,960
or delete that file after it it will join the thread and it will close the key logger.

154
00:10:41,080 --> 00:10:45,120
So let's test it out in order to test it on Linux before we transfer it to Windows.

155
00:10:45,110 --> 00:10:50,690
We need to type this in hash so it is a comment and we will add a path to be equal.

156
00:10:50,920 --> 00:10:54,080
Simply just the process manager not the extreme.

157
00:10:54,730 --> 00:10:58,400
And we need to add this between single quotes OK.

158
00:10:58,810 --> 00:11:01,900
Here it is.

159
00:11:02,140 --> 00:11:03,660
Now let's test this program.

160
00:11:03,700 --> 00:11:10,480
If I go right here and Python 3 key logger the p why it started the program.

161
00:11:10,480 --> 00:11:13,570
Now let's type some random things right here.

162
00:11:13,660 --> 00:11:16,290
How is your day to day.

163
00:11:17,080 --> 00:11:19,140
Let's see whether this will get printed right here.

164
00:11:19,150 --> 00:11:20,990
It does get printed right here.

165
00:11:21,670 --> 00:11:24,070
If we type something else such as for example

166
00:11:26,560 --> 00:11:28,680
what is your name.

167
00:11:34,740 --> 00:11:39,930
You will notice that this will not get print or it should have for some reason it is still here so let's

168
00:11:39,930 --> 00:11:43,730
delete this let's control C..

169
00:11:45,010 --> 00:11:47,990
Let's see what is wrong with this part of the code.

170
00:11:48,090 --> 00:11:48,640
No that's right.

171
00:11:48,640 --> 00:11:53,360
We are using the self-destruct which we need to use as an import to the backdoor.

172
00:11:53,410 --> 00:11:54,630
It will not work like this.

173
00:11:54,640 --> 00:12:01,420
So let's just remove this or enter it in a Hash and then let's go right here.

174
00:12:01,420 --> 00:12:04,320
Python 3 key logger let's run it again.

175
00:12:04,330 --> 00:12:06,670
So if I type something randomly right here.

176
00:12:06,670 --> 00:12:08,710
How is your day

177
00:12:11,780 --> 00:12:13,660
if we get that printed to the screen.

178
00:12:13,780 --> 00:12:15,750
If I type next sentence.

179
00:12:15,970 --> 00:12:18,710
My day was good.

180
00:12:18,890 --> 00:12:22,390
How was yours.

181
00:12:22,390 --> 00:12:26,440
We get that printed as well as well as the first part.

182
00:12:26,500 --> 00:12:31,960
So if you don't want this printed again you can simply just clear the logs every time you've put something

183
00:12:32,020 --> 00:12:32,320
in.

184
00:12:33,250 --> 00:12:35,920
OK now let's delete this.

185
00:12:35,920 --> 00:12:42,340
Let's close up a key logger and now that we upgraded it a little bit in the next video we can input

186
00:12:42,400 --> 00:12:46,220
this inside of our backdoor and make it even better.

187
00:12:46,360 --> 00:12:52,600
So we want to make sure that from our backdoor we can call the key logger and we can capture the keystrokes

188
00:12:52,870 --> 00:12:56,480
and get them from Windows Phone Machine to our killer Linux machine.

189
00:12:56,710 --> 00:12:58,810
So we will do that in the next video.

190
00:12:58,810 --> 00:13:00,820
Hope I see you there and they care.

191
00:13:00,820 --> 00:13:01,120
Bye.
