1
00:00:00,540 --> 00:00:01,910
Welcome back.

2
00:00:01,920 --> 00:00:04,750
Let's continue with the coding of our backdoor.

3
00:00:04,830 --> 00:00:09,950
Now before we even get into coding all of the different functions that we want our backdoor to have.

4
00:00:09,950 --> 00:00:14,540
Let us first write them down how we're going to do that.

5
00:00:14,630 --> 00:00:23,570
Well we're going to add a help option as a command that when the user of our server types help the backdoor

6
00:00:23,660 --> 00:00:26,820
we'll send all of its available features that it can do.

7
00:00:27,560 --> 00:00:28,630
Let me show you what they mean.

8
00:00:29,090 --> 00:00:36,950
If we go to our server program and to our target communication you remember here we compared the command

9
00:00:37,060 --> 00:00:37,940
with the quit.

10
00:00:38,060 --> 00:00:43,290
And in case the command was indeed quit then we break out of this loop and exit the program.

11
00:00:44,090 --> 00:00:45,910
Let's do the same with the help comment.

12
00:00:46,430 --> 00:00:53,870
So we're going to add an else if statement and we're going to compare the command with the help string

13
00:00:55,420 --> 00:00:57,810
in case the user of the server inputs help.

14
00:00:57,820 --> 00:01:08,620
Then we want to print in colored all of the different features and options that the door can execute.

15
00:01:08,720 --> 00:01:14,300
We're going to use three single open quotes and three single closed quotes and in between we're going

16
00:01:14,300 --> 00:01:17,870
to write all of the options that we want our backdoor to have.

17
00:01:17,930 --> 00:01:19,870
So let's start with the new line character.

18
00:01:20,450 --> 00:01:23,090
So everything gets printed out correctly.

19
00:01:23,090 --> 00:01:28,430
The first option is the quit command of course the command that we already coded as we can see right

20
00:01:28,430 --> 00:01:29,090
here.

21
00:01:29,090 --> 00:01:30,030
Quit.

22
00:01:30,020 --> 00:01:33,760
We're going to add we're going to tab it couple of times.

23
00:01:35,750 --> 00:01:37,250
Let's add a small arrow.

24
00:01:37,250 --> 00:01:38,420
And here it will tell.

25
00:01:38,450 --> 00:01:42,500
But this command does in our case it will quit session

26
00:01:46,660 --> 00:01:48,140
with the target.

27
00:01:48,160 --> 00:01:51,130
Simple as that.

28
00:01:51,130 --> 00:01:56,370
The next command can be the clear command and let's tab it all the way to here.

29
00:01:56,470 --> 00:01:59,020
And this command can clear the screen.

30
00:02:01,960 --> 00:02:06,910
So we're going to do the same thing as for example typing clear inside of our terminal.

31
00:02:06,910 --> 00:02:09,550
It gets rid of all of the previous commands that ran.

32
00:02:09,670 --> 00:02:13,060
And it gives you a clear and better look of your terminal.

33
00:02:13,200 --> 00:02:13,570
OK.

34
00:02:13,660 --> 00:02:15,870
So we're going to code that as well.

35
00:02:16,000 --> 00:02:21,570
The next command that we want to add would be DCD and then direct rename.

36
00:02:21,580 --> 00:02:23,740
So we want to change the directories.

37
00:02:24,130 --> 00:02:30,720
Let's specify between these star signs directory name indicating that it can be any name you want.

38
00:02:30,790 --> 00:02:35,050
Let's set these two arrows and type what this command does.

39
00:02:35,110 --> 00:02:42,340
It changes the rectory on target system.

40
00:02:42,340 --> 00:02:46,330
Let's not forget to add the upload and download functions to our back door.

41
00:02:46,350 --> 00:02:53,550
So upload and then file name between these two star signs groups.

42
00:02:54,040 --> 00:02:56,600
We did not want to open this.

43
00:02:56,770 --> 00:02:57,930
So let's say what this does.

44
00:02:57,940 --> 00:03:06,320
We need to add this arrow and type upload file to the target machine.

45
00:03:07,460 --> 00:03:09,780
That's slower days so we can see this better.

46
00:03:10,040 --> 00:03:15,230
The next thing is to download the file for download file name

47
00:03:20,020 --> 00:03:24,640
and let's type right here download file from Target.

48
00:03:24,650 --> 00:03:25,010
Machine

49
00:03:27,850 --> 00:03:32,790
the next three commands will be something that we are going to steal from the Metropolitan.

50
00:03:33,160 --> 00:03:38,410
If you ever use an interpreter which you most likely did you know that there is an option to start the

51
00:03:38,410 --> 00:03:44,320
key logger to stop the key logger and to print all of the keystrokes that were inputted while the key

52
00:03:44,320 --> 00:03:45,190
logger was running.

53
00:03:45,790 --> 00:03:47,800
So let's steal those three options.

54
00:03:47,800 --> 00:03:53,060
And by steal I mean we are going to code them ourselves but we are going to base off of the maternity

55
00:03:53,090 --> 00:03:56,110
key logger so key log underscore start

56
00:03:59,110 --> 00:04:04,780
we'll start the key logger so start the key logger right here key log underscore dump

57
00:04:07,690 --> 00:04:18,600
print keystrokes that the target input it and keep log underscore stop

58
00:04:22,090 --> 00:04:28,060
stop and let's set a fun option stop and self-destruct.

59
00:04:28,510 --> 00:04:30,070
Key logger file.

60
00:04:30,130 --> 00:04:33,850
That sounds interesting and you will see how we're going to code that later on.

61
00:04:33,970 --> 00:04:38,530
As you remember I said that the key logger that we created was not its final form.

62
00:04:38,530 --> 00:04:41,800
So we're going to upgrade it and use it inside of our backdoor.

63
00:04:42,670 --> 00:04:48,080
And there is one last option that we want to add which is persistence.

64
00:04:48,820 --> 00:04:50,410
We want to add the program

65
00:04:52,960 --> 00:05:12,620
and the file name and now we need to tap all of this a little bit further so everything can fit.

66
00:05:13,870 --> 00:05:26,390
Okay so let's add the last description of our command create persistence in registry which simply means

67
00:05:26,390 --> 00:05:32,530
the tower program or our backdoor will automatically get started once the target restarts their machine.

68
00:05:32,750 --> 00:05:37,490
So they do not have to double click on our program and execute it multiple times.

69
00:05:37,490 --> 00:05:43,040
They can only do it first time and then we can run the persistence and then the program will hide itself

70
00:05:43,040 --> 00:05:48,170
inside of their machine and it will automatically start every time they restart their machine.

71
00:05:48,460 --> 00:05:48,800
Okay.

72
00:05:48,830 --> 00:05:55,640
So these are all the functions that we want to code inside of our backdoor for now and we only added

73
00:05:55,640 --> 00:06:00,780
the help option which will print what will be available to do with our backdoor.

74
00:06:01,010 --> 00:06:02,500
So let's see whether this will work.

75
00:06:02,750 --> 00:06:07,550
But before we actually test this to see whether this health option works we need to go to our backdoor

76
00:06:07,670 --> 00:06:09,650
and add it here as well.

77
00:06:09,650 --> 00:06:15,770
We need to type the line else if command equals equals to help.

78
00:06:15,770 --> 00:06:20,110
We simply just want to pass because we're not executing anything.

79
00:06:20,120 --> 00:06:25,910
We cannot leave it to do this as we can freely let the help comment execute because we are not.

80
00:06:26,150 --> 00:06:31,850
As we don't care about any output of the health command since it will get printed out by our server

81
00:06:32,540 --> 00:06:38,540
therefore we're simply just going to pass in case the backdoor receives the help command and then it

82
00:06:38,540 --> 00:06:44,000
will return to the beginning of the while True loop and it will try to receive the second command.

83
00:06:44,000 --> 00:06:52,820
So let's see whether all of this works of course here we need to add the term color dot colored and

84
00:06:52,820 --> 00:06:58,630
now all should be good for some reason this is still red underlined.

85
00:06:58,690 --> 00:07:02,860
So let's see what's wrong with this.

86
00:07:02,870 --> 00:07:07,820
Well let's just run it and see what the error is because I cannot really seem to find it at the moment

87
00:07:07,820 --> 00:07:11,960
so let's just run it by country server that be why.

88
00:07:12,200 --> 00:07:15,420
And it says invalid syntax in this line.

89
00:07:15,560 --> 00:07:21,860
Else if comment oh yeah we're missing one equal so else if equals equals to help.

90
00:07:21,860 --> 00:07:23,420
And now let's run the program.

91
00:07:23,420 --> 00:07:32,150
Everything should work fine now listening for the incoming connections and if we run the back door let's

92
00:07:32,150 --> 00:07:35,540
first of all test the regular commands that we can run as such.

93
00:07:35,540 --> 00:07:36,350
Who am I.

94
00:07:37,160 --> 00:07:38,310
And it seems to Hank.

95
00:07:38,360 --> 00:07:40,110
Let's check out the back door.

96
00:07:40,460 --> 00:07:41,910
Command is not defined.

97
00:07:41,990 --> 00:07:48,820
And if we go to our backdoor command is indeed not defined because we did misspell once again.

98
00:07:49,520 --> 00:07:50,690
So now it should work.

99
00:07:53,210 --> 00:07:57,760
Finally let's give it one less try Python 3 server the UI.

100
00:07:57,820 --> 00:08:02,760
Now let's go right here with Python 3 back door where my command works.

101
00:08:02,780 --> 00:08:11,320
Alice works nets that bash and R for example what would give us an output so everything works.

102
00:08:11,420 --> 00:08:13,610
What happens once we specify help

103
00:08:16,310 --> 00:08:21,180
been a sage help not found that that is because we still let it go through these lines of code and we're

104
00:08:21,190 --> 00:08:23,270
going to fix this in just a second.

105
00:08:23,410 --> 00:08:28,960
We get everything else printed out so let's go with the quick command and quick command works as well.

106
00:08:29,290 --> 00:08:31,400
Now let's fix this.

107
00:08:31,960 --> 00:08:35,570
And in order to fix this we need to add this to the else statement.

108
00:08:35,590 --> 00:08:43,780
So in any other case we're going to try to execute this if it is not quit and if it is not help we will

109
00:08:43,870 --> 00:08:44,640
executed.

110
00:08:45,450 --> 00:08:51,780
Let's test it once again just so we can make sure that this time it will not try to execute the help

111
00:08:51,780 --> 00:08:52,900
command.

112
00:08:53,250 --> 00:09:02,250
Let's run the backdoor run to help command and everything seems to work correctly but this time we get

113
00:09:02,250 --> 00:09:06,270
another letter which doesn't really allow us to continue executing the commands.

114
00:09:06,270 --> 00:09:09,560
You can see it simply just hangs after it prints this.

115
00:09:09,990 --> 00:09:15,720
Well let's see why we get that error so it should be a problem with our server I believe and that is

116
00:09:15,720 --> 00:09:22,800
also the same problem that we had before is as soon as it prints this it will go to the line where we

117
00:09:22,800 --> 00:09:24,780
try to receive the result.

118
00:09:24,780 --> 00:09:30,360
But remember in our back door we are not really executing anything and we are not really sending anything

119
00:09:30,360 --> 00:09:32,820
because this is now in the else statement.

120
00:09:32,850 --> 00:09:40,650
Therefore this is also trying to receive and this is also trying to receive resulting in our two programs

121
00:09:40,650 --> 00:09:41,290
hanging.

122
00:09:41,730 --> 00:09:44,000
So we need to add an L statement right here.

123
00:09:44,030 --> 00:09:49,790
So else tab this in tab this in as well.

124
00:09:49,790 --> 00:09:56,910
And let's give it one less try start our server then go to this terminal navigate to the back door project

125
00:09:57,990 --> 00:10:07,100
start our backdoor if I type held command we get the output of the help command everything gets printed

126
00:10:07,100 --> 00:10:11,120
out and we also get to execute the next command if we want.

127
00:10:11,750 --> 00:10:15,670
Let's try to quit command and everything works correctly.

128
00:10:15,680 --> 00:10:20,650
We do not get any error and all of these three options for now work.

129
00:10:20,990 --> 00:10:26,330
The only thing is we don't really print this in green and that is because we forgot to add right here

130
00:10:26,900 --> 00:10:31,580
green and now everything will work correctly.

131
00:10:31,710 --> 00:10:36,860
Okay so now that we added the help option the quit option.

132
00:10:36,860 --> 00:10:41,100
The next thing that we're going to do is we're going to add the clear option in the next video.

133
00:10:41,660 --> 00:10:46,030
So thank you for watching this tutorial and I will see you in the next lecture by.
