There's a little bit of prep work that's needed.
And for those wondering,
this is being recorded on the same day.
Had a little bit of a brush fire,
had to change my clothes here real quick
after I got it controlled.
So as we go through the prep work inside of our lab,
let's scoot on over there real quick.
And you can see that I have a couple of files opened up.
Now these files are in a folder
and I'm gonna show you here real quick on the desktop
is I zoom in for you down on the bottom right.
You see there next to the XP folder over there,
just to the left of it, there's a folder called scripts.
And inside of there are two scripts,
one called single and one called multi.
Now the code for this is listed below this video.
So that way, if you wanna play with this at home
on your own system,
and you can copy over with relative ease,
it's there for you.
Now we're taking a look at the actual first script
and what this does is,
and we're gonna walk through this,
is that, and I'll zoom in for you here real quick.
First things first,
we have to set up what exploit we're using.
And I see a typo on line two.
Let me correct that real quick
because it's just use not user.
And in this particular instance,
we are using the exploit of multi handler.
And that's the one that we've been using thus far,
one that we're more familiar with.
And it's good to use as an example
for something that we're familiar with.
Number two is setting the payload.
Now we know that whenever we create a MSF Venom file,
that we have a payload set to it.
In our Windows system,
which will be the target for this particular script usage,
we have Windows x64 meterpreter,
and then reverse TCP.
So inside of console,
we have to have the payload match or MSF Venom payload
for that fake file that we've created in previous skills.
And this is something we're familiar with so far.
Number three is set connection details.
And we have set L host and set L port.
And this is also kind of matching that file
that we've created that's going to the target system.
For instance, if in the Windows system,
we have created a file that's connecting
back to port 4445 as our second option for sessions,
then that won't match up to what's actually in here.
And it also has to be matching to the payload
that we have on the other system.
And number four,
we're going through automation and stability settings.
Now, I have it listed like that
because there are plenty of other things
that you could put in there.
But for instance, I have set exit on session false.
So this means that whenever the session is complete,
or we're done with it for whatever reason,
we exit out of MSF console,
and I don't want that to happen.
And then we're going to run it in the background.
And that is run, or we're more familiar with exploit
inside of MSF console and dash J.
That dash J is there to be able to have it run
as the background process for a listener.
And we're going to execute this by going over
to our actual terminal window for MSF console.
Now, the only difference here
is that whenever we run MSF console,
we're using a dash R to be able to tell it
to point to a script.
So normally we would just go in and say,
sudo MSF console, and then that's it.
Here, we want to identify a script that's being in use.
Now, if you notice inside of this terminal window,
I am already in the desktop scripts folder.
So if you're not there already,
you'll just have to path to it
whenever you execute this command.
And in this particular instance, I want to run single.
And I don't have any file extensions on there.
So just keep that in mind.
And whenever we run this,
you could see the MSF console is starting.
And then also it preloads all the stuff
that we've run in the background.
So you could see there using configured payload,
generic shell reverse TCP,
and then it goes with payload,
what we're using, the set for L host, set L port.
We exit on session is false and then run dash J,
which means it's going to run in the background.
And you could see that it's already started on 0534444.
And we're back to our basic prompt for MSF console
under the multi-handler.
So that means that it's actually running in the background
and we can verify this by going into sessions.
And we have no active sessions,
but if we go to our Windows 10 system here real quick
and update later, I'm going to run dummy real quick,
just so we can connect.
And you could see right there
that we have a connection coming in from 0.13
because that dummy file was made
with the exact same payload for our configuration settings
inside of our single use script.
Now it will take a minute, a second or two to connect.
You could see there, I just hit enter
and it goes to the next line.
And the reason it doesn't go automatically
into that B2B session
is because we have this running in the background.
Again, let's use sessions.
And you could see that we do have an active session here
with our Windows 10 workstation or BWAP inside of our lab.
And it is fully connected over port 4444.
Now, everything seems normal here.
What's the difference between this
and running it through a hand jam session
like we're used to?
Well, I'm glad you asked.
Because normally for me,
I'm just more familiar with multi-handler and meterpreter.
It's always a good go-to to see if people click
on fake files and run fake programs and things of the such.
And whenever we have these processes
running in the background,
we've already sent our files out.
We've already got our payloads configured.
Just running inside of MSF console,
being able to run a single use script or whatever script
prevents us from having to go through every single time
like we've been doing in previous skills,
going through and typing all of this stuff out.
So it's basically just a quick go-to
in case we are new to a site
and we've already got stuff out there
on the actual organization's network.
Now, I want you to keep in mind too
that this only works if the payload matches
the actual MSF Venom creation that we have.
So if there's any deviation whatsoever,
you'll have to adjust your script appropriately
so that way it connects and can run in the background
and you can go to it whenever you want.