WEBVTT

00:00.960 --> 00:01.200
Okay.

00:01.240 --> 00:04.520
In the previous lecture, we covered the city command.

00:04.560 --> 00:04.880
Okay.

00:04.920 --> 00:10.640
Now it is time to download a sample txt file.

00:10.680 --> 00:11.120
Okay.

00:11.640 --> 00:14.000
So the sample txt file.

00:14.040 --> 00:17.600
Let me first explain how does it work.

00:17.640 --> 00:19.400
While we're trying to download something.

00:19.440 --> 00:19.880
Okay.

00:21.000 --> 00:30.880
Uh when it is a simple txt file, first we are trying to read the file from backdoor and then send it

00:31.000 --> 00:31.440
here.

00:31.840 --> 00:36.000
Here we will create a new file and write it okay.

00:36.040 --> 00:37.000
So very easy.

00:37.160 --> 00:40.640
So here we need to create a method for writing into a file.

00:42.640 --> 00:43.480
Let's do that.

00:43.720 --> 00:44.600
Give off.

00:44.920 --> 00:46.240
Write again.

00:46.840 --> 00:51.240
So here we need to provide um two thing.

00:51.280 --> 00:51.960
Okay.

00:52.000 --> 00:54.800
One of them is going to be the path.

00:54.840 --> 00:55.320
Okay.

00:55.880 --> 00:59.080
Where, uh, where do we want to save this?

00:59.400 --> 01:02.000
The other one is going to be the content.

01:02.040 --> 01:02.480
Okay.

01:05.160 --> 01:12.280
Content is the data that we read from a reverse vector and write it here.

01:12.320 --> 01:13.000
Okay.

01:13.080 --> 01:19.960
So while we're trying to open a file we use width keyword and then open method which is which come from

01:20.560 --> 01:22.720
with Python when you install the Python.

01:22.760 --> 01:23.520
Okay.

01:23.560 --> 01:29.360
And here let's first give the path where the file located.

01:29.360 --> 01:33.720
And then you need to provide the mode for the file.

01:34.040 --> 01:40.320
So I'm going to be giving a w b means writing as binary.

01:40.360 --> 01:41.360
Okay.

01:41.400 --> 01:45.760
And here we are going to alias this as something like file.

01:45.800 --> 01:46.400
Okay.

01:46.440 --> 01:55.360
So now we uh, we can do a lot of a lot of things with this file that we have.

01:55.360 --> 01:57.120
For example, I'm going to write this.

01:57.120 --> 02:01.130
So I use file dot Right.

02:01.810 --> 02:02.210
Okay.

02:02.530 --> 02:04.690
What do I want to write inside this file?

02:04.770 --> 02:09.770
I want to write the content inside this file.

02:09.770 --> 02:13.650
And at the end, I can return just the text.

02:13.650 --> 02:15.770
For example, let's.

02:17.890 --> 02:21.250
Give this that download successful.

02:28.290 --> 02:28.770
Okay.

02:29.690 --> 02:32.730
So this is the right method.

02:33.690 --> 02:38.010
Let's change this write method to something else like write file okay.

02:40.410 --> 02:41.410
And here.

02:45.570 --> 02:49.410
Uh, down here after we receive the result okay.

02:50.530 --> 02:52.450
We can check it here.

02:54.290 --> 03:05.690
If, if the command okay that we receive from user and the first one that user provide.

03:05.730 --> 03:08.130
For example, they write download something.

03:08.450 --> 03:18.210
If this is equal to this word like download, then let's do something.

03:18.370 --> 03:26.610
If it is equal to download then let's um we have the result here okay.

03:26.610 --> 03:27.930
Result variable.

03:27.930 --> 03:31.250
So I'm going to say result is equal to self.

03:34.770 --> 03:35.250
Dot.

03:37.490 --> 03:40.290
Write file which is a method that we just created.

03:40.450 --> 03:43.570
And here I'm going to give the second.

03:45.770 --> 03:51.010
Option from the thing user enter.

03:51.010 --> 03:56.370
And finally we give the result as content.

03:56.370 --> 03:59.050
So here we have the command okay.

03:59.090 --> 04:02.610
This command will create a list for me.

04:02.610 --> 04:07.930
The first one is going to be download and the second one is a name of a file.

04:07.970 --> 04:15.290
Okay, so we give the name of the file as a path here and the content is equal to result.

04:15.330 --> 04:16.970
What is this result?

04:17.010 --> 04:20.210
This result is something that come from backdoor.

04:21.370 --> 04:26.930
And at the end we can just print this result here.

04:26.930 --> 04:28.730
But if I use decode.

04:28.770 --> 04:33.490
So right here is not going to print that for me because it is a text.

04:33.490 --> 04:43.250
And we don't need to use decode with text but with other command it is going to show them as okay.

04:43.330 --> 04:44.210
Okay.

04:44.250 --> 04:45.850
So now it is completed.

04:45.850 --> 04:52.730
Let's go back to Backdoor in Windows Machine to handle this here too.

04:52.730 --> 05:01.100
So in here we are going to create a method named via read file Okay.

05:01.140 --> 05:03.500
Because here we're going to read file.

05:03.900 --> 05:06.340
So let's create that file here.

05:06.460 --> 05:07.460
That method here.

05:08.220 --> 05:13.260
And in here we're going to give only the path.

05:13.300 --> 05:13.740
Okay.

05:16.500 --> 05:20.540
So to read a file again we need to first open that file.

05:20.900 --> 05:26.380
I use open method and then give the path path.

05:27.700 --> 05:32.580
And the mode is going to be RB means read as binary.

05:33.100 --> 05:35.820
And let's alias this as a file.

05:36.300 --> 05:39.740
After we read it, we need to return.

05:40.580 --> 05:42.940
Okay so let's use return.

05:43.140 --> 05:47.060
We have the file dot read method that will.

05:47.100 --> 05:49.780
This will read the whole content.

05:49.940 --> 05:53.940
So now we have this method this function or method.

05:53.940 --> 05:57.380
Here we need to use it somewhere in here.

05:57.420 --> 05:58.420
Okay.

05:58.420 --> 06:04.260
So down here again I need to check this so I use live data.

06:04.580 --> 06:06.980
The first data okay we receive.

06:07.300 --> 06:11.820
If this is equal to to download.

06:15.020 --> 06:16.500
Okay download.

06:16.900 --> 06:21.020
Then then we can do something.

06:21.020 --> 06:29.500
For example we can read the second option that come from listener.

06:29.540 --> 06:30.420
Okay.

06:30.460 --> 06:35.460
So let's have this command result.

06:35.500 --> 06:38.140
It is equal to self dot.

06:38.180 --> 06:43.420
We have just created the read file method here.

06:43.820 --> 06:48.100
And then in here we are going to just give the data.

06:48.820 --> 06:51.460
And number one why data number one.

06:51.460 --> 06:57.660
Because then the first keyword or the first index from the list is download.

06:57.700 --> 07:04.660
So the user will enter for example download name of the file and the name of the file will be right

07:04.660 --> 07:05.260
in here.

07:05.580 --> 07:07.540
And then we will add it here.

07:07.900 --> 07:11.580
And then we will read that and then return it from here.

07:11.580 --> 07:15.780
And we give it to here it is, it will start to command result.

07:15.780 --> 07:20.620
And at the end we return the command result from here to listener.

07:20.660 --> 07:25.420
So let me save this and go back here.

07:26.540 --> 07:28.500
Try to run this program.

07:28.500 --> 07:30.500
It is waiting for incoming connection.

07:31.060 --> 07:35.340
And here again let's run this.

07:37.340 --> 07:41.500
So let's use dir method to see what is inside this okay.

07:42.140 --> 07:45.180
You may ask why it is showing this as binary.

07:45.180 --> 07:50.980
That is because I removed the dot decode from here from printing okay.

07:52.860 --> 07:57.500
And here you see we have a sample dot txt file okay.

07:57.540 --> 08:01.430
So I want to read this I want to download this file.

08:02.190 --> 08:02.990
Uh, here.

08:03.270 --> 08:03.670
Okay.

08:03.710 --> 08:06.310
For example, in here, inside this reverse factor.

08:06.350 --> 08:06.590
Okay.

08:06.590 --> 08:10.510
You see, right now here is the file I want to download that right here.

08:11.110 --> 08:13.830
So let's use download keyword.

08:15.870 --> 08:17.350
And then name of the file.

08:17.350 --> 08:18.310
What is the name of the file.

08:18.310 --> 08:20.110
It is sample dot txt.

08:20.470 --> 08:23.910
So sample dot txt hit enter.

08:24.310 --> 08:26.510
You see download is successful.

08:26.630 --> 08:27.910
And let's go back here.

08:27.910 --> 08:29.590
You see a new file is added.

08:29.750 --> 08:35.350
When I open that we have seen the data which is inside here.

08:35.350 --> 08:37.750
And let's go back to windows machine.

08:40.430 --> 08:41.950
And that is here.

08:42.070 --> 08:48.030
If I open this this is the same thing that is added on the Linux.

08:48.030 --> 08:58.870
So here now you have your backdoor program that is able to download files the files from victim computer.

08:58.910 --> 09:00.910
So thanks for watching.
