WEBVTT

00:01.080 --> 00:05.360
Okay, now the program is working.

00:05.360 --> 00:05.760
Okay.

00:06.560 --> 00:08.600
I am listening on this port.

00:09.240 --> 00:12.520
Let's execute this again.

00:13.600 --> 00:16.200
I am coming back to my Kali machine.

00:16.200 --> 00:19.520
It is in connection established here.

00:19.520 --> 00:22.840
If I use dir, it is showing me.

00:23.040 --> 00:24.600
What if I use city?

00:25.240 --> 00:27.200
While I use city and hit enter.

00:28.400 --> 00:31.240
You see, it is showing me this now again.

00:31.240 --> 00:34.720
If I use dir still in this location.

00:34.720 --> 00:37.280
If I use city to this top.

00:39.640 --> 00:44.680
Okay, this pop, you see it is not working okay?

00:44.720 --> 00:47.920
And that is because we are using netcat right now.

00:48.080 --> 00:48.480
Okay.

00:48.960 --> 00:56.760
So we are using the netcat program here to establish the connection or to as a listener actually.

00:59.080 --> 00:59.640
And.

00:59.720 --> 01:00.160
It.

01:01.760 --> 01:05.800
Uh, when I come back here, you see, it gives me the city desk that is not working.

01:05.800 --> 01:07.880
Returned non-zero exit status one.

01:08.640 --> 01:10.520
The good way is to.

01:11.920 --> 01:18.440
Inside the column machine, you need to create your own listener by using socket.

01:18.440 --> 01:21.600
So let's go and create our own listener here.

01:25.840 --> 01:28.840
Okay I have the listener file here.

01:29.480 --> 01:34.080
And now let's use this file to create a listener okay.

01:34.120 --> 01:37.920
In Kali Linux machine instead of using netcat here.

01:38.640 --> 01:43.720
So here again we are going to use socket library.

01:43.720 --> 01:47.440
So you need to import socket okay.

01:47.440 --> 01:52.880
Here let's create a listener object I'm going to create listener.

01:56.080 --> 01:57.040
This is equal to.

01:57.280 --> 02:01.120
We have the socket dot Socket.

02:03.160 --> 02:05.880
Okay, here we have two things.

02:05.880 --> 02:06.160
Okay.

02:06.200 --> 02:08.520
One of them is socket.

02:11.280 --> 02:11.800
Dot.

02:13.880 --> 02:18.040
Uh, a f underscore.

02:22.760 --> 02:31.880
In it, and also we have another thing which is socket dot f underscore.

02:33.440 --> 02:34.120
Not really.

02:34.160 --> 02:45.920
If it was is for xk underscore uh string that is here okay.

02:45.960 --> 02:49.160
Now we have our object which is the listener object.

02:49.400 --> 02:54.240
Now I can use these um, to listen.

02:54.280 --> 02:54.680
Okay.

02:55.440 --> 02:56.520
So let's use it.

02:56.640 --> 03:07.910
We have And listener dot asset socket option.

03:08.510 --> 03:14.070
Here we need to give the socket dot.

03:16.390 --> 03:20.430
Esol underscore.

03:20.590 --> 03:22.110
It is not giving me suggestion.

03:22.110 --> 03:23.830
It is giving me very slowly.

03:24.710 --> 03:29.190
And this is going to be socket which is the last one here.

03:30.710 --> 03:31.710
This one okay.

03:32.350 --> 03:34.870
And the next one is we have another option.

03:34.870 --> 03:36.790
And that is socket.

03:39.550 --> 03:44.430
Uh socket dot is or.

03:46.590 --> 03:52.870
Underscore r e use adder or something like that.

03:55.310 --> 03:55.830
This one.

03:55.870 --> 03:56.270
Okay.

03:56.670 --> 03:59.430
So now we have the socket option.

03:59.750 --> 04:05.790
And we have one more thing here that is to set it to number one.

04:06.510 --> 04:07.110
Okay.

04:07.150 --> 04:16.030
If you go to um socket documentation you will find all this thing there.

04:16.030 --> 04:18.870
And also we need to build the connection.

04:19.190 --> 04:25.990
So let's use again listener dot bind okay.

04:26.030 --> 04:28.310
Which is going to be a connection.

04:28.590 --> 04:32.390
So here we need to give the IP address for the listener.

04:32.390 --> 04:34.310
So the listener is called Linux.

04:34.590 --> 04:38.190
We give it ten 0 to 4.

04:38.190 --> 04:42.190
And also the port which is going to be 444.

04:43.030 --> 04:45.390
And now this will build the connection.

04:45.430 --> 04:46.230
Okay.

04:46.230 --> 04:48.070
This will listen that.

04:48.070 --> 04:51.710
So here you need to give one more one extra parenthesis.

04:58.950 --> 04:59.230
Okay.

04:59.270 --> 05:04.670
The next thing is to accept this, okay?

05:04.710 --> 05:08.390
Accept the connection.

05:08.430 --> 05:11.430
And we are done here now.

05:11.430 --> 05:19.390
And before we accept and after we accept, we can print something, a text or a message or something.

05:19.790 --> 05:22.870
So here I need to print.

05:26.470 --> 05:27.390
For example.

05:27.550 --> 05:28.510
Waiting.

05:32.950 --> 05:38.110
Waiting for incoming connection.

05:38.150 --> 05:38.950
Okay.

05:38.950 --> 05:52.030
And also down here, after it is connected, we can have another text message like connection established

05:52.030 --> 05:52.990
or something like that.

05:52.990 --> 05:53.390
Okay.

05:54.150 --> 05:56.430
Connection established or got a connection.

05:58.110 --> 05:59.230
Got a connection.

06:02.510 --> 06:10.630
Okay, now, if I save this and go back here, let's use Python.

06:10.630 --> 06:13.190
We have listener.py.

06:14.070 --> 06:24.390
While I'm executing this it is giving me an error and that is uh waiting for incoming or waiting for

06:24.430 --> 06:25.630
incoming connection.

06:26.710 --> 06:29.870
And then it is giving me an error.

06:29.870 --> 06:30.710
What is that?

06:31.230 --> 06:33.110
Line seven okay.

06:33.150 --> 06:37.070
Listener dot accept is an error here.

06:42.950 --> 06:43.350
Okay.

06:45.430 --> 06:47.950
So the problem is with accept method.

06:47.990 --> 06:48.390
Okay.

06:49.030 --> 06:57.030
Let's go back here and see the accept method if zero here and go back here.

06:57.030 --> 07:03.340
Yea, but you re-execute this and still it gives me an error.

07:03.460 --> 07:10.420
It says that it actually takes one positional argument, but two were given before it wasn't like this.

07:10.460 --> 07:14.620
Okay, so invalid argument.

07:15.020 --> 07:16.420
Let's see what is the problem.

07:17.740 --> 07:21.740
Okay, the problem is with this.

07:21.780 --> 07:24.300
We don't need to give any argument here.

07:24.340 --> 07:24.780
Okay.

07:26.540 --> 07:31.820
And here after we try to build the connection we need to listen.

07:31.860 --> 07:35.980
Okay I forgot to give this here.

07:36.020 --> 07:38.180
Okay, listen.

07:39.780 --> 07:41.220
Now give zero here.

07:41.460 --> 07:43.860
Save it and go back to your terminal.

07:44.660 --> 07:46.420
Try to execute the program.

07:46.420 --> 07:48.460
Waiting for incoming connection.

07:48.500 --> 07:50.300
Go to your windows machine.

07:51.660 --> 07:53.900
Okay, let's execute this once again.

07:54.740 --> 07:57.820
It says that connection And receive,

07:59.020 --> 08:02.820
uh.

08:02.860 --> 08:03.100
Okay.

08:03.100 --> 08:07.100
We don't need to, uh, send anything from here.

08:07.420 --> 08:09.220
Let me remove this from here.

08:09.220 --> 08:09.500
Now.

08:13.780 --> 08:14.220
Okay.

08:19.100 --> 08:21.340
Got, uh, connection.

08:21.380 --> 08:25.300
Okay, so now you see that we got the connection here.

08:26.540 --> 08:28.540
This message, when this message is printed.

08:28.540 --> 08:37.460
So it is showing that, uh, this part, the listening listener dot accept part has been executed.

08:37.460 --> 08:48.260
So that means the connection is now between the Polly and Linux, and windows is established for a while,

08:48.260 --> 08:49.380
for a small time.

08:49.420 --> 08:50.300
Okay.

08:50.340 --> 08:52.580
And then we got this message.

08:52.980 --> 08:54.100
Got a connection.

08:54.260 --> 08:55.860
So perfect.

08:55.860 --> 08:57.500
Let's go and continue this.
