WEBVTT

00:01.200 --> 00:03.480
Okay, now the program is working.

00:03.920 --> 00:06.000
But still, there is a problem.

00:06.120 --> 00:11.160
Let me show you that I am executing or running the listener here.

00:11.160 --> 00:16.520
And then on Windows Machine I am running the backdoor.

00:18.480 --> 00:20.840
Coming back here, having the connection.

00:21.040 --> 00:24.000
Now I am running a simple command.

00:24.000 --> 00:26.480
You see that we have this here.

00:26.760 --> 00:31.600
Now, for example, my, uh, my job is finished and I want to exit.

00:31.600 --> 00:33.360
So I use ctrl c.

00:33.360 --> 00:37.080
You see, we have an error here, which is not very good.

00:37.320 --> 00:42.640
And also on windows machine, you see that still it is running.

00:42.640 --> 00:49.800
So I need to do something that when I exit from Kali Linux this must be exited to that.

00:50.240 --> 00:54.520
If I use ctrl C here again you see it gives me a very big error here.

00:55.840 --> 00:56.880
That is not very good.

00:56.880 --> 00:57.200
Okay.

00:57.240 --> 01:00.580
So let's go and handle this in both sides.

01:00.980 --> 01:03.300
So in color Linux.

01:04.140 --> 01:08.620
Here you see we are receiving the input from user.

01:08.660 --> 01:09.100
Okay.

01:09.740 --> 01:13.540
Right here I'm going to use a function called split.

01:13.540 --> 01:20.340
So that with split we are going to change this string to kind of list or something like that.

01:20.340 --> 01:22.420
So we have the command.

01:22.420 --> 01:30.740
This command is going to be equal to command dot split okay.

01:33.420 --> 01:36.460
And here I'm going to split this with a space.

01:37.020 --> 01:37.740
Very good.

01:37.940 --> 01:42.540
Now let me print this so you could see what is going on here okay.

01:43.300 --> 01:50.300
So let's comment this I don't want to see I don't want to be this to be executed.

01:50.300 --> 01:50.540
So.

01:53.460 --> 01:59.890
Here let's run this and let's come back to Windows 10.

02:01.610 --> 02:04.250
Run the program from here as well.

02:05.610 --> 02:06.610
Come back here.

02:06.810 --> 02:10.570
For example, I am going to provide dir, which is a very simple command.

02:10.570 --> 02:12.210
You see, it gives me a dictionary.

02:12.250 --> 02:20.850
For example, I use City Desktop and you see it is giving me two elements within a list.

02:20.890 --> 02:23.290
First one is city, the second one is a desktop.

02:23.610 --> 02:27.490
So here we can access this by using its index.

02:27.530 --> 02:28.050
Okay.

02:28.090 --> 02:29.050
Very easy.

02:29.050 --> 02:38.370
Now let's go back here or let me use Ctrl C here and come back here and comment this.

02:40.090 --> 02:40.650
Sorry.

02:42.130 --> 02:45.370
And also remove this print statement from here.

02:45.890 --> 02:54.850
Now here into in the execute remotely function okay.

02:54.850 --> 03:04.430
Here we can do a check with an if statement, and we can check if the first if the first element that

03:04.430 --> 03:07.510
we receive okay, which has an index zero.

03:07.990 --> 03:13.470
If you receive that and that is equal to a keyword for example exit, then we can close the connection.

03:13.510 --> 03:14.070
Okay.

03:14.110 --> 03:22.630
So let's use that if uh if so we have that into command uh variable.

03:22.630 --> 03:25.030
And also we have the command variable here.

03:25.030 --> 03:27.150
So we use command here.

03:27.550 --> 03:32.950
And we use index zero because I want to access the first one.

03:32.950 --> 03:38.910
So if it is equal to anything like exit or close you can name it anything you want.

03:38.910 --> 03:41.710
So you can use it in your program.

03:41.710 --> 03:45.030
If it is equal to this then we can close the connection.

03:45.030 --> 03:48.150
So use self dot connection dot close.

03:48.190 --> 03:49.550
This will close your connection.

03:49.550 --> 03:53.150
And also let's use exit function here.

03:53.150 --> 03:55.190
This will exit the Python program.

03:55.350 --> 03:57.140
And also one more thing Here.

03:57.300 --> 03:59.860
You see, we are sending something here.

04:00.220 --> 04:06.100
And while we are sending, we need to use, uh, this one.

04:06.100 --> 04:08.900
That means we are sending the first element.

04:08.900 --> 04:11.140
Okay, so this is it.

04:11.140 --> 04:13.700
And also let's go back to windows.

04:15.700 --> 04:19.780
Uh, here in windows again we need to handle this okay.

04:20.820 --> 04:22.580
On run function.

04:24.660 --> 04:26.060
Right here okay.

04:26.620 --> 04:34.380
So again here we need to check if the command is equal to the same thing we provide there okay.

04:34.420 --> 04:52.140
If command is equal to exit and lets you solve that connection dot close and also exit the python.

04:52.700 --> 04:53.420
That is it.

04:53.780 --> 04:56.020
But still there is an error.

04:56.440 --> 04:59.120
Let me show you that as well.

05:00.360 --> 05:00.960
And.

05:04.800 --> 05:05.600
I will show you that.

05:05.600 --> 05:06.160
Okay?

05:06.200 --> 05:06.920
Practically.

05:08.040 --> 05:09.280
Now let me use.

05:09.280 --> 05:10.000
Clear.

05:12.120 --> 05:12.440
Okay.

05:12.480 --> 05:13.840
Waiting for connection.

05:16.920 --> 05:18.880
Let's use Ctrl C here.

05:22.400 --> 05:24.200
Right now it is running.

05:24.360 --> 05:26.400
Let's go back to Kali machine.

05:26.400 --> 05:26.800
Okay.

05:27.120 --> 05:28.080
We have a connection.

05:28.160 --> 05:30.720
Now let's use dir and hit enter.

05:31.240 --> 05:32.400
It is working okay.

05:33.320 --> 05:35.960
The simple command is working.

05:35.960 --> 05:38.720
But I'm trying to use exit here.

05:38.760 --> 05:39.360
Okay.

05:39.400 --> 05:42.080
Now when I use exit, it did exit it.

05:42.120 --> 05:42.760
Okay.

05:42.800 --> 05:47.840
But in Windows machine, when I come back here, you see that it's still running.

05:48.880 --> 05:50.160
Let me use Ctrl C here.

05:50.160 --> 05:51.600
Now I'm going to exit that.

05:52.000 --> 05:56.270
That is because while we are sending the Sending the exit from there.

05:56.310 --> 05:58.750
Okay, that comes as a byte.

05:58.790 --> 05:59.110
Okay.

05:59.150 --> 06:01.310
And here we are checking it as a string.

06:01.670 --> 06:04.590
So we need to add a B at the beginning.

06:04.790 --> 06:05.230
Okay.

06:06.670 --> 06:09.430
Let's use single code here.

06:09.430 --> 06:10.030
It's better.

06:10.510 --> 06:16.590
Now I'm saving this and I am going back to Cali machine.

06:19.070 --> 06:21.950
And let's run this again.

06:24.910 --> 06:26.110
Now let's go back to.

06:28.190 --> 06:28.870
Cali mission.

06:28.910 --> 06:29.590
Okay.

06:29.670 --> 06:32.230
I use simple command like dir.

06:32.270 --> 06:35.430
It's working and I use exit.

06:35.630 --> 06:36.470
It is working.

06:36.990 --> 06:42.830
Let's go back to Windows Machine and see that it's also exited.

06:43.390 --> 06:44.350
So perfect.

06:44.510 --> 06:47.150
Now you created a very simple.

06:47.190 --> 06:51.830
I did a very simple command here that is exiting the program.

06:51.870 --> 06:52.750
Okay.

06:52.790 --> 06:53.990
So thanks for watching.
