Unofficial blog

Monday, January 4, 2010

Netcat-like Console Command: Connect

A few weeks ago I committed the initial version of a new console command used to communicate with a host: connect. Since then I've slowly added a few more features.

If you've ever used Netcat (all of you I'm sure), you'll feel right at home. If not, connect is quite simple to use and you should pick up on it quickly given the text below.


msf > connect -h
Usage: connect [options]

Communicate with a host, similar to interacting via netcat.

OPTIONS:

-C Try to use CRLF for EOL sequence.
-S Specify source address.
-c Specify which Comm to use.
-i Send the contents of a file.
-p List of proxies to use.
-s Connect with SSL.
-w Specify connect timeout.



As you can see, connect has many options to choose from. One very cool one is the -c option which allows you to, for example, route through a Meterpreter session. I show this below.


I've blocked HTTP access for this computer at the router:


msf > connect metasploit.com 80
[-] Unable to connect: The connection timed out (metasploit.com:80).



But let's see if we can re-route this through another computer and get it working anyway:


msf > sessions -l

Active sessions
===============

Id Description Tunnel
-- ----------- ------
1 Meterpreter 192.168.10.3:44692 -> 192.168.10.7:4444

msf > connect -c 1 metasploit.com 80
[*] Connected to metasploit.com:80
HEAD / HTTP/1.0

HTTP/1.1 200 OK
Date: Sun, 18 Jan 2009 15:01:22 GMT
[...]



Booyah.

Of course that was just one contrived example, but having a built-in netcat-like command should open up some doors for fun and profit.

Enjoy!
Kris Katterjohn

Metasploit Blog

0 comments:

Post a Comment