1
00:00:00,360 --> 00:00:01,400
Welcome back.

2
00:00:01,410 --> 00:00:07,110
And by now we already got two options that we coded the third option that we should do right now is

3
00:00:07,110 --> 00:00:09,120
the changing of the directory.

4
00:00:09,480 --> 00:00:16,170
If you simply just run our server right here and you run the backdoor

5
00:00:20,630 --> 00:00:25,610
you can execute all of the commands of course such as in my class and all of the other comments you

6
00:00:25,610 --> 00:00:27,070
can execute in the terminal.

7
00:00:27,200 --> 00:00:33,260
If I type BW DB It will give me my current working directory or the directory in which I'm currently

8
00:00:33,260 --> 00:00:37,120
in inside of this program and it is inside of our back or project.

9
00:00:37,490 --> 00:00:44,180
But if we for example want to go one directory back inside of the pie chart projects inside of a terminal

10
00:00:44,270 --> 00:00:47,480
our regular commands will be C D and then two dots.

11
00:00:47,480 --> 00:00:54,200
But if you press here enter and you type BW D once again you will still be the back door directory.

12
00:00:54,200 --> 00:00:57,570
Therefore these C D command doesn't really work for now.

13
00:00:57,620 --> 00:01:00,140
So we need to code it inside of our program.

14
00:01:00,230 --> 00:01:04,490
Let's quit this and let's go to our server and backdoor.

15
00:01:05,390 --> 00:01:14,750
Let's add another option below clear else if command equals equals C D.

16
00:01:14,850 --> 00:01:16,350
And then space.

17
00:01:16,350 --> 00:01:21,900
Now make sure that you add this space because C D and C the Space Command are not the same especially

18
00:01:21,900 --> 00:01:22,640
in Windows.

19
00:01:22,740 --> 00:01:28,980
If in Windows you type C D it will print to the current working directory but if you type C D and then

20
00:01:29,010 --> 00:01:34,740
the directory name it will change the directory into the directory that you specified.

21
00:01:34,740 --> 00:01:41,440
So by telling our server that if the command equals C D and then empty space that means that after this

22
00:01:41,460 --> 00:01:48,000
will come the directory name and that we want to change the directory therefore inside of our server.

23
00:01:48,130 --> 00:01:50,580
All we want to do is we want to pass.

24
00:01:50,650 --> 00:01:56,110
We don't really want to get any result back such as here because there is nothing really to be printed

25
00:01:56,110 --> 00:01:58,240
out once you are switching the directories.

26
00:01:58,240 --> 00:02:04,590
There is nothing really as an output but inside of our backdoor we need to execute the directory switching.

27
00:02:04,720 --> 00:02:12,790
So right here if I type else if command equals equals to see these and then empty space then we want

28
00:02:12,790 --> 00:02:20,860
to use the OS library to change directory and luckily inside of the OS library we get a function which

29
00:02:20,860 --> 00:02:23,570
is called C H there.

30
00:02:23,590 --> 00:02:31,030
And before we actually continue with this function we need to import os inside of our backdoor so we

31
00:02:31,030 --> 00:02:32,460
can use that function.

32
00:02:32,740 --> 00:02:34,930
And let's go down here.

33
00:02:34,960 --> 00:02:40,180
The OS change directory function takes one argument and that is the directory that we want to change

34
00:02:40,280 --> 00:02:40,760
too.

35
00:02:41,470 --> 00:02:43,770
So how can we specify the directory.

36
00:02:43,780 --> 00:02:47,040
Well we know that the command will look something like this.

37
00:02:47,050 --> 00:02:48,490
So let's type it right here.

38
00:02:48,490 --> 00:02:55,660
The command will be something like this C deep desktop the first three characters are what we are specifying

39
00:02:55,660 --> 00:02:56,320
right here.

40
00:02:56,440 --> 00:02:58,840
So these are the first street characters.

41
00:02:58,900 --> 00:03:03,350
Therefore what we can do we can simply just compare LC command.

42
00:03:03,460 --> 00:03:09,760
And then first three characters which we specify by opening square brackets and then typing two dots

43
00:03:09,820 --> 00:03:10,860
up to three.

44
00:03:10,870 --> 00:03:16,320
That means we are comparing on the first three characters if they're equal to this then we can change

45
00:03:16,340 --> 00:03:23,950
the directory of the rest of the comment so we can change the directory of the command and then three

46
00:03:23,950 --> 00:03:26,100
characters and from there.

47
00:03:26,440 --> 00:03:32,920
What this means is we are going to compare this part and if it is equal to C D and then empty space

48
00:03:33,250 --> 00:03:39,760
then we are going to perform the OS not change directory onto this part which will change the directory

49
00:03:39,760 --> 00:03:41,370
to the desktop directory.

50
00:03:41,440 --> 00:03:46,060
Otherwise this will not work if we don't specify it like this.

51
00:03:46,150 --> 00:03:50,260
First of all let's delete this and we need to add the same thing inside of our server.

52
00:03:50,590 --> 00:03:57,130
So what we are comparing right here is we are comparing first three characters let's see whether this

53
00:03:57,130 --> 00:03:57,840
will work.

54
00:03:57,850 --> 00:04:02,010
This is all we need to specify in order to change the directory and now we can test it out.

55
00:04:02,010 --> 00:04:12,060
So Python 3 server and let's from the backdoor once again if I type P WD to check my current working

56
00:04:12,060 --> 00:04:17,760
directory we are in the backdoor directory let's go on the rectory back to C D and then two dots and

57
00:04:17,760 --> 00:04:24,750
then I type P.W. WD once again and now it seems to work we are in the slash root slash by and project

58
00:04:24,810 --> 00:04:31,540
directory if I type unless we should see all of our previous projects as we can see them right here.

59
00:04:31,800 --> 00:04:32,100
Good.

60
00:04:32,100 --> 00:04:38,700
Now we can change the directories we can go to the one scanner if we want to and we can check the contents

61
00:04:38,970 --> 00:04:45,990
of the bone scan or directory so we successfully coded the C D function or the changing of the directory

62
00:04:46,080 --> 00:04:52,290
option to our backdoor and now we are ready to proceed on to the next option which is going to be the

63
00:04:52,350 --> 00:04:55,210
uploading of the files to the target machine.

64
00:04:55,690 --> 00:04:56,100
Okay.

65
00:04:56,460 --> 00:05:00,810
So thank you for watching this tutorial and I will see you in the next lecture by.
