1 00:00:00,300 --> 00:00:02,550 Hello everybody and welcome back. 2 00:00:02,550 --> 00:00:09,480 And in the previous video we saw that we successfully created a simple python server that was able to 3 00:00:09,540 --> 00:00:14,400 actually receive and accept the connection from our different terminal. 4 00:00:14,400 --> 00:00:20,250 We were able to net cat on our local host on the specified port in the program and it actually printed 5 00:00:20,250 --> 00:00:22,080 out that the target was connected. 6 00:00:22,080 --> 00:00:27,330 So what we want to do right now is actually do something like this. 7 00:00:27,360 --> 00:00:29,580 So let us see this. 8 00:00:30,460 --> 00:00:32,430 So how guess it pops. 9 00:00:32,450 --> 00:00:33,530 I didn't not want to. 10 00:00:33,540 --> 00:00:43,400 I wanted to open till X so let's open till X so we can split screen like this and run two programs Yeah 11 00:00:43,490 --> 00:00:50,060 I can post a terminal once I run 10x so let me just open it once again I can lower this and large this 12 00:00:50,060 --> 00:00:51,660 and put it like this. 13 00:00:52,090 --> 00:00:53,150 Well let me just see 14 00:00:57,500 --> 00:01:07,330 let me just see if I can change a color since the you are white one is actually a little bit too bright 15 00:01:07,810 --> 00:01:09,120 but it seems that we can. 16 00:01:09,130 --> 00:01:13,880 So we will actually close this oil just run two terminals instead. 17 00:01:14,140 --> 00:01:20,750 So let us enlarge this like this and let's use another terminal. 18 00:01:20,750 --> 00:01:24,900 So in your window we want to enlarge this one as well. 19 00:01:25,040 --> 00:01:31,480 So zoom in so many and let us get right to work. 20 00:01:31,580 --> 00:01:38,620 So this one as well a little bit. 21 00:01:38,770 --> 00:01:39,070 OK. 22 00:01:39,100 --> 00:01:45,000 So right here I will open up our silver loops. 23 00:01:45,010 --> 00:01:46,750 Let me just find out where it is. 24 00:01:46,750 --> 00:01:49,350 So see the python program. 25 00:01:49,360 --> 00:01:55,650 See the reverse eclipse reverse nano server. 26 00:01:55,700 --> 00:01:57,170 Don't be white. 27 00:01:57,220 --> 00:01:59,170 Here we have our server. 28 00:01:59,170 --> 00:02:02,540 And here we have the another terminal. 29 00:02:02,540 --> 00:02:06,410 We will code our client or our reverse shell. 30 00:02:06,850 --> 00:02:12,090 So we need to open up our server so we can see the different functions in the correspondent function. 31 00:02:12,120 --> 00:02:15,010 We will write in our client for these functions in server. 32 00:02:15,040 --> 00:02:19,840 So let this actually go through these same directories so reverse. 33 00:02:19,840 --> 00:02:21,030 Here we have the server. 34 00:02:21,040 --> 00:02:29,300 And right now we want to make the reverse P Y or we can call it the reverse shall be white. 35 00:02:29,320 --> 00:02:36,400 So we start off with the same hashtag exclamation mark an end user in Python. 36 00:02:36,400 --> 00:02:38,970 So this is something that you always need to include. 37 00:02:39,250 --> 00:02:42,160 And we also have to import Sorkin as well right here. 38 00:02:42,250 --> 00:02:49,360 So this is the standard beginning part right now what we want to do is we actually want to connect to 39 00:02:49,420 --> 00:02:51,810 our server that be white. 40 00:02:51,880 --> 00:02:53,710 Let's see how we can do that. 41 00:02:53,710 --> 00:02:59,440 So with this picture right here we can see that in the previous video we coded some of these functions. 42 00:02:59,440 --> 00:03:04,720 We still didn't get the send receive function but we will code that one as well. 43 00:03:04,720 --> 00:03:09,100 So for now on what we want to do is actually create the client. 44 00:03:09,130 --> 00:03:15,070 So what we have to specify is the same as in the server so we have to create a socket and then all we 45 00:03:15,070 --> 00:03:20,670 have to do is perform a connect function in order for our client to connect to our server. 46 00:03:20,680 --> 00:03:27,000 So this is a rather shorter example of code than in the previous video. 47 00:03:27,100 --> 00:03:31,060 So it will be rather simple we can write it in two or three lines. 48 00:03:31,060 --> 00:03:33,170 So let us do that. 49 00:03:33,490 --> 00:03:36,130 What we want to specify right now is the same as here. 50 00:03:36,130 --> 00:03:44,140 So we want to specify the socket in my case let's call it right here SOC so we can actually differentiated. 51 00:03:44,170 --> 00:03:48,220 So we don't call it in both programs s but it doesn't really matter. 52 00:03:48,220 --> 00:03:49,620 I would call it SOC right here. 53 00:03:49,890 --> 00:03:50,920 So OK. 54 00:03:51,250 --> 00:04:00,190 Equals socket dot socket socket dot f underscore on it and then comma socket dot socket stream. 55 00:04:00,400 --> 00:04:07,270 As you said in the previous video this just basically usage for IP before address and also the DCP connection 56 00:04:07,270 --> 00:04:08,550 for our server. 57 00:04:08,860 --> 00:04:13,970 Right now all we have to do is reform the Connect function to our server. 58 00:04:14,080 --> 00:04:24,280 So let us do that with the function SOC not connect and win the Connect function we have to specify 59 00:04:24,280 --> 00:04:31,450 where we want to connect right now as we can see that we bind in the port 120 bind the IP before address 60 00:04:31,450 --> 00:04:32,680 of local host port. 61 00:04:32,680 --> 00:04:38,230 Five four three two one we will have to specify the same IP before I address and same local port in 62 00:04:38,230 --> 00:04:41,350 order to connect to our program or to our server. 63 00:04:41,350 --> 00:04:47,740 So let us go that's open double parentheses same as in the bind command in our server and here specify 64 00:04:47,800 --> 00:04:48,430 same thing. 65 00:04:48,430 --> 00:04:57,070 So 127 of 0 0 1 close the double quotes comma and then five four three two one then close the double 66 00:04:57,070 --> 00:05:04,120 parentheses as we can see right here the local port is not a string and the IP before address is put 67 00:05:04,120 --> 00:05:09,230 in double quotes so make sure to not switch those up otherwise it won't work. 68 00:05:09,280 --> 00:05:15,040 And what we want to do right then we want to actually print that we successfully connect it so print 69 00:05:17,560 --> 00:05:23,680 connection established to server. 70 00:05:23,680 --> 00:05:24,520 This is just for us. 71 00:05:24,520 --> 00:05:26,920 So we know that everything went good. 72 00:05:27,010 --> 00:05:33,010 And after that we want to close the socket so soccer up close and we want to close the connection. 73 00:05:33,280 --> 00:05:35,050 So this is how this should go. 74 00:05:35,050 --> 00:05:37,070 Basically we're on the server first. 75 00:05:37,150 --> 00:05:39,690 It starts listening for incoming connections. 76 00:05:39,790 --> 00:05:46,810 It prints out this line right here and then we run the reverse Sheldon P Y which will perform our connect 77 00:05:46,810 --> 00:05:49,180 function on our server. 78 00:05:49,180 --> 00:05:51,330 And basically what it will do after that. 79 00:05:51,370 --> 00:05:57,820 This target or D server will actually print Target connected and the reverse Shell will print connection 80 00:05:57,820 --> 00:06:01,210 establish the server and both will close the connection. 81 00:06:01,270 --> 00:06:02,860 So that is how it should go. 82 00:06:02,860 --> 00:06:03,940 So let us say this. 83 00:06:03,970 --> 00:06:05,990 So control over to save enter. 84 00:06:06,000 --> 00:06:14,440 Control X plugs it let's make it an executable CCH note plus X reverse the underscore shall be y and 85 00:06:14,470 --> 00:06:16,150 let's run the server first. 86 00:06:16,150 --> 00:06:23,210 So we run it with server P why we get the string listening for income and connections. 87 00:06:23,410 --> 00:06:30,810 And here we run the reverse shall that be like as we can see everything went perfect listening for incoming 88 00:06:30,850 --> 00:06:36,160 connections then we ran the remote shell connection established to the server target connected and we 89 00:06:36,160 --> 00:06:38,800 close the connection on both programs. 90 00:06:38,830 --> 00:06:41,810 So this simple two programs work. 91 00:06:41,920 --> 00:06:47,800 Now what we want to do in the next video is actually establish a longer connection where we can actually 92 00:06:47,800 --> 00:06:50,830 send some stuff to the other target. 93 00:06:51,160 --> 00:06:55,160 So we will see how we can actually do that in the next video. 94 00:06:55,360 --> 00:07:00,730 So now we successfully created a simple reverse shell and the simple server that only performs the connection 95 00:07:00,730 --> 00:07:05,370 function and that will be about it for this video or pursuing the next one. 96 00:07:05,410 --> 00:07:06,820 And take care by.