Net Netsh
Net Netsh
Net Netsh
Table of Contents
net Commands ................................................................................................................................ 2
IPC$ ............................................................................................................................................... 15
netsh ............................................................................................................................................. 23
Notices .......................................................................................................................................... 32
Page 1 of 32
net Commands
net Commands
Used to update, fix and view basic computer and network settings
22
Page 2 of 32
net Syntax
net Syntax
23
Page 3 of 32
them, and they're very helpful.
They're meant to be for the
administrator to be able to see
things, to be able to adjust things,
change things. So very powerful in
taking the red/pentester side of me,
we can use these for many not so on
the up side things to do also, so...
net Commands -1
net Commands -1
24
Page 4 of 32
has those kind of privileges, so it kind
of defaults to that. So if you don't
have those, a lot of times if you go
back to your work computer back at
your office and you try some of these
commands, they'll say access denied
and you won't be able to get at
them, because your privileges aren't
high enough. So if you're going to
use these, especially in your
scripting, make sure that the user
account that you are running it from
has high enough privileges. Okay?
Page 5 of 32
net Commands -2
net Commands -2
25
Page 6 of 32
net Commands -3
net Commands -3
26
Page 7 of 32
Windows service as well, and of
course, continue is just resuming that
same service, so...
net config
net config
27
Page 8 of 32
information about both workstation
and server, whether you have a
server or not. On the server side it'll
say number of connections, and it'll
be 0, because obviously no one--or
should be 0. Obviously if you're not
a server, for the most part, people
aren't connecting to you. So that
sort of server information will still be
available, it'll just show up as 0 or
whatever the case is.
Page 9 of 32
net config workstation
28
Page 10 of 32
net share
net share
Without any options list information about all resources being
shared on the computer
29
Page 11 of 32
permissions. FULL, everyone, which
is interesting, or everyone, FULL,
rather. Which is interesting, because
that means they can do anything to
that backup.
Page 12 of 32
net view -1
net view -1
30
Page 13 of 32
net view -2
net view -2
net view \\computername /all – will show all the shares and other
resources (printers) that are available on computername
• Use this to find share on other computers that should or should not
be there!
31
Page 14 of 32
IPC$
IPC$
Disabling will break most Windows Server functions that use RPC
32
Page 15 of 32
Course, the $, as I mentioned,
denotes a hidden share. And
disabling it generally breaks most
server functions. And then
Anonymous Credentials is what I was
saying. You can connect with just
the user being blank and the
password being blank for the null
connection. And you can do
authenticated sessions. And this is a
key where it says authenticated
sessions are authorized for machines
outside of the domain. So a
pentester might use this because
they don't have to be a part of the
domain and they can go in and reach
out and connect to a machine, if they
have some credentials, so...
Page 16 of 32
net use -1
net use -1
33
Page 17 of 32
net use -2
net use -2
34
Page 18 of 32
password's supposed to be, it'll just
prompt you when it runs, and that
way you can just have it do the work
that way. Or you can actually place
the password right in there like we
did for the script that we ran earlier,
and then /user: and then the
username. And so you have the
option of making it a persistent
connection, so the next time you
reboot and come back up it'll try to
make that connection again. And as
long as the credentials and
everything else match, you'll all
automatically have that share.
Page 19 of 32
Instructor 2: Want to comment on that.
Administrator on your local laptop is
different from administrator on
everybody else's laptop, which is
different from the domain
administrator account. So even
though you're using the same name,
excuse me, if you're using the
integrated authentication by not
specifying the username, Windows
will know the difference between
administrator here, administrator
there and domain administrator as
well. So sometimes it's best to be
very explicit about which
administrator or which account you're
actually using.
Page 20 of 32
net use -3
net use -3
35
Page 21 of 32
net use Examples
36
Page 22 of 32
you're saving the credentials to make
it persistent.
netsh
netsh
Network shell
37
Page 23 of 32
functionality. It's good across the
network, gives you access to network
interfaces. Like it says, Windows
firewall routing and remote access
capability. So there's I guess,
essentially two modes. There's the
command-line mode, and then you
can actually run it with a Batch using
a script.
38
Page 24 of 32
way you would use, like, netuse or
some of the other ones. So netsh
has a slightly different format that
you have to follow.
Page 25 of 32
netsh – Command Mode -2
39
Page 26 of 32
netsh – Command Mode -3
40
Page 27 of 32
bit more research and make sure you
get the way these constructs work.
41
Page 28 of 32
file like the top line there. You're
redirecting that to a .dat file. So
that's something that's a little bit
different from just copying or finding
a string or whatever. This is more
administrative type of work you can
do with this tool.
Page 29 of 32
netsh – Batch Mode
42
Page 30 of 32
what netsh can do. Netsh really
exposes the entire network
subsystem within Windows to you.
So you can script with it, you can
change things with it. If you look at
the netsh trace command it actually
gives you the ability to do traffic
sniffing. So similar to what you can
do with wireshark or tcpdump or
something like that, you can actually
capture network packets and look at
them, capture them, with netsh. And
then you can export that file and
convert it, pull it into, you know, any
pcap-compliant packet program. So
you actually have a built-in network
sniffer in Windows through netsh,
which I find really, really cool.
Page 31 of 32
Notices
Notices
© 2015 Carnegie Mellon University
This material is distributed by the Software Engineering Institute (SEI) only to course attendees for their
own individual study.
Except for the U.S. government purposes described below, this material SHALL NOT be reproduced or
used in any other manner without requesting formal permission from the Software Engineering Institute at
[email protected].
This material was created in the performance of Federal Government Contract Number FA8721-05-C-
0003 with Carnegie Mellon University for the operation of the Software Engineering Institute, a federally
funded research and development center. The U.S. government's rights to use, modify, reproduce,
release, perform, display, or disclose this material are restricted by the Rights in Technical Data-
Noncommercial Items clauses (DFAR 252-227.7013 and DFAR 252-227.7013 Alternate I) contained in
the above identified contract. Any reproduction of this material or portions thereof marked with this
legend must also reproduce the disclaimers contained on this slide.
Although the rights granted by contract do not require course attendance to use this material for U.S.
government purposes, the SEI recommends attendance to ensure proper understanding.
THE MATERIAL IS PROVIDED ON AN “AS IS” BASIS, AND CARNEGIE MELLON DISCLAIMS ANY
AND ALL WARRANTIES, IMPLIED OR OTHERWISE (INCLUDING, BUT NOT LIMITED TO,
WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE, RESULTS OBTAINED FROM USE OF
THE MATERIAL, MERCHANTABILITY, AND/OR NON-INFRINGEMENT).
Page 32 of 32