[ELECTRONIC NOISES]
Creating and managing workspaces with MSF console--
so what are workspaces, and why are they
so important in relation to the Metasploit framework
and furthermore in relation to penetration testing as a whole?
Well, workspaces allow you to keep track of all your hosts,
scans, and activities and are extremely useful when
conducting penetration tests as they
allow you to sort and organize your data based on the target
or organization.
So with every framework or with every tool
that you'll be utilizing to perform penetration
testing in the context of the Metasploit framework,
you will be performing a lot of actions,
or you'll be performing a lot of activity.
And when I speak of activity, what I mean
is you will be running various modules.
You'll be scanning various targets.
You will be exploiting multiple targets.
And all of this data is, again, going
to be stored by the Metasploit framework.
But it will be stored by default within the default workspace.
And, again, this is really not a good thing
because if you perform more than one assessment for a company
or for a client, all that data if you
use the default workspace will be stored together.
And it's really not sorted out.
So for each engagement or for every engagement,
I would recommend that you create a new workspace
so that that data is separated from your previous engagements
or assessments.
That's very, very important even in penetration testing.
You never want to mix results or you never
want to mix data with from one company with another.
So, again, that's very, very important,
and that's where workspaces come into play.
Now, the Metasploit framework console, or MSF console,
provides you with the ability to create, manage,
and switch between multiple workspaces
depending on your requirements.
And we are going to take a look at how to, again,
do what I've just said.
So we'll take a look at how to create a new workspace,
how to switch between workspaces,
and how to delete workspaces.
Now, the second question that you may be asking yourself
is, where is all of this data stored?
And as I've mentioned within the previous videos,
all the data pertinent to the Metasploit framework
and the MSF console is going to be
stored within the MSF DB, the Metasploit framework database.
So, again, in order for you to create workspaces and store
data within each of these workspaces
and have that data persistent across restarts,
you need to make sure that the Metasploit framework
console is connected to the Metasploit framework database.
And we've already covered that particular section
within the Metasploit framework installation video.
So make sure to check that out if you haven't connected
your Metasploit framework database to the Metasploit
framework console.
So we will be utilizing workspaces
to organize our assessments as we
progress through this course.
So for every exploitation or for every new target
that we are going to be taking a look at,
we will be sorting them or performing
all of the operations within its own workspace.
So without further ado, let's actually
take a look at how this is done practically.
I'll see you back on my Kali VM.
So I'm back on my VM, and let me just switch to a full screen.
There we are.
So I have already initiated the Metasploit framework console,
and we can begin.
So the first thing, as I said, that you want to do
is to check the status of the database.
And that can be done by typing in db_status.
And it should tell us, "Connected to msf.
Connection type, postgresql."
So everything's good there.
So let's talk about workspaces.
Now, in order for us to interact with workspaces,
we can simply type the workspace command, so workspace.
And we can use Tab+Alt completion.
And if you want to open up the Help menu,
you can use the -h option, and that will tell you
how to go about switching between a workspace,
listing workspaces, et cetera.
So in this case, if we type in workspace and we hit Enter,
you can see that we have the default workspace.
And it's currently selected and highlighted
by the little asterisk option right over here.
So that's how you tell what workspace
you're currently working in.
So that is the default workspace that we're currently
working in.
And as an example, we already have data within this workspace
as we essentially took a look at a few modules
in the previous video.
If I say hosts and hit Enter, you
can see that my router IP address
has been added as a host.
And that's really the fantastic thing about the Metasploit
framework is it tracks all of your data
so that if you ever want to go back in time
or actually check out your history in regards to the hosts
that you did scan or that you did exploit,
you can always do that.
So this is the data that's being stored in my current workspace,
which is the default workspace.
If I want to create a new workspace,
I can essentially say workspace a, so workspace
and then I say -a and then provide it with a name.
So let's say I provide a name like--
let's see.
We are testing for--
we can just call it test for the time being.
So I create a new workspace.
There we are.
We added a workspace, test, and the workspace we're currently
in is test.
So if we say workspace and hit Enter,
you can see we are currently within the test workspace.
It's going to be highlighted red,
and the asterisk should be right beside the currently active
workspace.
So now if we say hosts and hit Enter,
you can see we don't have any data.
This is a fresh workspace with no data.
And we can, again, go ahead and start
working within this workspace.
What if we want to switch back to the default workspace?
So we can do that really simply by saying workspace and then
providing the name of the workspace, which in this case
is default. Hit Enter.
If we now say hosts, you can see that I have the IP address
that I scanned right over here within the default workspace.
So you can see how useful this is.
Now, in the context of a penetration test, what
would make sense is if we said workspace and then
create a new workspace and then maybe provide the company name.
So for example, we can provide a simple company name maybe
like INE.
We hit Enter.
That's going to create the workspace called INE.
And then of course, we can simply say workspace.
And we're currently within the INE workspace.
And we can switch between all the other workspaces
by simply providing their name.
So we say workspace test.
There we are.
We can then change again to workspace default.
There we are, back to default. So it really is very simple.
If we want to delete a workspace which
is, again, very, very useful--
let's say we want to delete the test workspace because, again,
we just created it for a test.
We can go ahead and say workspace -d and then
provide the name, which in this case is test, and hit Enter.
There we are, deleted workspace.
And if we, again, list out our workspaces,
you can see that the test workspace has been deleted.
So, again, creating and managing workspaces
is fairly simple, but really, really important.
As I said, we are going to be creating workspaces
for every assessment that we do so that the results are
differentiated and are kept aside or apart from each other.
So, again, this is very, very useful and very,
very important.
So, again, as I said, it's very, very simple to do all of this.
And, again, if you want to learn more,
you can always check the documentation
for the workspace command.
And you can see we've pretty much done, again,
what we were supposed to do apart from a fact--
apart from the option to rename the workspace, which
we can actually do now.
So for example, if we want to rename a workspace,
we can say rename INE to maybe something like INE.
Or rather, we can say PTA, for example.
So rename that to PTA.
And then if we say workspaces, you
can see it's renamed to PTA.
So that's very, very useful.
So that is going to be it in regards
to this practical demonstration.
I'm just going to switch back to the slides.
So that was essentially how to create and manage workspaces.
As I said, they're are very, very important.
They help you sort and organize your data and your assessments.
And in the next video, we'll begin the process
of essentially performing information gathering
and enumeration with the Metasploit framework.
And we'll also be exploring the various modules
that are utilized for information gathering
and how we can import data from third-party tools
into the Metasploit framework.
So I'll be seeing you in the next video.