Hello, everyone, welcome to your new video of our Python lessons.
Today, we will be talking about how to send shall code and injected over socket in Python.
First of all, let's see how we create an interpreter payload in raw format.
OK, our show code is ready in order for us to open and read this show code binary file, we need to
use the open function in Python with the RB attributes for read binary.
Let's take a look at our server file now after I modified it to Central Code and we will explain each
line.
First, we ask the user to type IP and port to connect back to.
Next, we have our massive venom command to create our binary payload.
Then we execute the command using the subprocess module that we discussed before.
Next, we read the show code binary file using the open function with the R attributes for reading binary.
After we read it, we save it in a rebel called code,
then we list our clients again using the list of clients function that we created before, and we ask
the user which target he wants to send it to.
After that, we use our fulu to match the number he gave us with the one in the list, but before we
send our Sherko to the target, we need to tell the client that we are sending Shoket so the client
would call the right function to do that.
After that, we send our code.
Now, let's look at the client and see what's happening at the other side.
At the client line number four seven, if we see the word geocode in our data, we call a function called
inject shortcode.
Let's take a look at this function now.
In this function, we received the show code using the socket to receive function and then we prepare
and we prepare our memory for the show code, as you saw in our slides.
Keep in mind that we are injecting the code into a running process with the number four zero six nine.
So we need to know the process number you're injecting to beforehand.
We can know that using the task force command from the command prompt.
Let's try and inject our Chalco into our calculator application, we will first open our calc application
and get its process idea from our DOS command.
As you can see, the process ID is four zero five six.
Of course, you can make this more flexible by using by asking the client for the running processes
from the server side and then provide the client with the process idea to inject you.
But for the sake of testing, we will hardcoded our cost side here.
OK, now, after we hardcoded or post decided, let's try and get our Chalco, the first, we need to
open another emissive console window to receive the show code when it connects back to us.
Nice.
It's working, we just received an interpreter payload.
This method is very effective since we are not writing any files on disk at the client side.
We're basically receiving the show code in memory and also execute executing it without writing anything
on this.
We have reached the end of this lesson.
Thank you.
And see you in the next one.