Okay.
Now we are able to.
Send and receive some data like hello from Cali.
This is something we send and connection established is something we received from victim.
Okay.
In creating a backdoor, it is not what we want, okay?
It's not all things we want.
I want to execute system command or for example windows system command from here.
Okay.
From when?
From Linux I want to write some command on.
Windows.
So right now I'm listening.
And let's go back to windows.
Here I need to use another library which is called SAP process.
So this SAP process will allow me to execute system command.
So I use SAP process Okay, I have it now, here and now.
Instead of printing this on, um, on the terminal or as cmd, I can execute this.
Okay.
So let's come here, create a function I'm going to name it execute system command okay.
Execute.
System command.
And we need to give the command as argument here okay.
So let's go with command.
So how can we execute a system command.
Uh everything you need is to return this subprocess dot check but check output.
And here inside this you need to give the command.
And because your command is a string so we need to use shell is equal to true.
So now this is the execute system command function.
And now we can use it here.
Okay.
After we uh okay here we have connection received.
Now let's change this because right now we have the received data.
Now let's change it to something else like let's go with command.
Okay.
So we have the command here.
Now let's say I'm going to use the execute system command here.
So let's create another variable I'm going to name this command result.
It is equal to execute.
Execute system command okay.
And here I need to give the command that I received after I, I after I received the command result
here.
Now, if I want, I can send it back.
Okay, so how can I send it back?
I use connection connections dot send and then command result.
And then we can close that.
And that is all.
Okay.
So, uh, it looks beautiful, but maybe there is still a small problem.
Maybe.
Let's go and see here.
Okay.
We are listening still.
And let me.
Write here.
Try to read execute the program.
So right now it is listening.
Okay.
And I'm going to come back here.
You see connection is established.
Let's use a windows command like dir For Der Hit enter and you see that we sent the data, we receive
the data, we send the data.
And in windows we received an error.
And that is pipe error again okay.
Arc's not allowed okay.
Let's see where is that error.
Mm.
Execute system command.
This is it okay.
Line 13 and model command result okay.
We receive the error here.
And let's come back here.
Okay.
We have the command here.
We need to do one thing okay.
And that is to encode this use Input.
Okay.
This was, uh, not here.
Let's use it here.
Okay, let's see if now.
I think this may solve the result.
If not, again, we will check it.
Okay.
Let's come back here.
Use clear lesson on that port and back here.
Use CLS.
Okay.
Execute this and let's use dir.
Hit enter again.
We received an error.
Let's see what is the error.
Okay.
Input did not mean decode.
Hmm.
Oh yes I used input here.
Sorry for that.
Uh.
Let's see.
We are receiving the command.
Okay.
So here, instead of encoding, we need to decode this.
Okay.
Seven again.
Okay.
Lesson on that.
And okay.
Let's go back here.
It's going to be dir.
Hit enter.
Now you see that we are receiving the result through this one okay.
I use dir or dir command.
It is a command like Lzw in when in Linux.
You see it is showing me all the result.
Uh, everything I have here.
Okay.
Inside this folder and let's say directory of C, this is the directory okay.
Python project desktop which is my username.
And it is showing me that I have these two files here inside this folder.
Now, right now, you see that it only executes once.
Okay.
And then it closes the program.
So it is not what I want.
Okay.
The thing I want is to be executed a lot of time.
For example, this time I use dir.
It shows me the directory this time.
The second time, for example, I want to use cli command to go to another directory.
Again I need to.
I must be able to.
Uh, I got.
To I must be able to execute my commands.
So.
Come on again I'm listening okay.
So to solve that.
To handle that, you need to come here.
You see this three line here?
Okay.
These are responsible for.
Receiving the command.
Executing the command and also sending the commands okay.
So for that we need to put them into a into a loop.
And that is going to be a while loop.
Okay.
So let's use while it is true which is all the time true.
Okay.
We need to execute this thing.
So and.
Just a moment.
Okay.
It is unreachable.
No problem.
Let's go and execute.
Maybe this is not an error.
Uh, am I listening right now or not?
Okay.
I'm listening.
Let's come back here.
Execute the program.
Come back here.
Okay.
Connection established.
Let's use dir.
Okay, now I have the result, which is, uh, here.
Okay.
Let's use another command.
For example.
It's going to be ipconfig.
Okay.
Ipconfig.
Hit enter.
Now it is showing me the result for ipconfig.
And if I use city ups it is not going to be happened if I use dir.
Now still I am into the same location.
Okay.
And let's see I want to go to city desktop disk top.
Not happened.
Okay.
No problem.
So now we are able to execute system command more than one time.
Okay.
Let me come back here.
Mhm.
Okay.
We are able to do a lot of things here.
Mhm.
Okay.
We are able to execute our system command from Kali Linux on Windows machine.
So it is something that normal user can do okay.
And if I use who am I.
This is working or not okay.
It is showing me that I am this this user okay.
Exploit ship is my user.
Super user.
So okay.
That's it.
Let's go and see how we can improve this.
More beautiful and more and more.
Okay.