Commit Graph

124 Commits (7d8e1e5e8b3c54ca73327a36a2843ab3ba7a7d02)

Author SHA1 Message Date
James Lee b58a87b7a8 Skip ::1 as well as 127.0.0.1 for session_host
Thanks rsmudge for pointing this out.

[Fixes #6599]
2012-04-08 14:58:39 -06:00
James Lee 40e1cafd6e Remove extraneous debug print 2012-03-14 11:07:31 -06:00
James Lee 1d99330795 Accept multiple addresses and netmasks
[See #6476]
2012-03-13 02:08:34 -06:00
James Lee f5e2d1c19b Grevious typo causing load_session_info failure
That's the problem with rescue ::Exception, it catches crap like this
and it takes a while before anyone notices. =(
2012-02-29 08:14:02 -07:00
James Lee 624e19fd8b Merge session-host-rework branch back to master
Squashed commit of the following:

commit 2f4e8df33c5b4baa8d6fd67b400778a3f93482aa
Author: James Lee <egypt@metasploit.com>
Date:   Tue Feb 28 16:31:03 2012 -0700

    Clean up some rdoc comments

    This adds categories for the various interfaces that meterpreter and
    shell sessions implement so they are grouped logically in the docs.

commit 9d31bc1b35845f7279148412f49bda56a39c9d9d
Author: James Lee <egypt@metasploit.com>
Date:   Tue Feb 28 13:00:25 2012 -0700

    Combine the docs into one output dir

    There's really no need to separate the API sections into their own
    directory.  Combining them makes it much easier to read.

commit eadd7fc136a9e7e4d9652d55dfb86e6f318332e0
Author: James Lee <egypt@metasploit.com>
Date:   Tue Feb 28 08:27:22 2012 -0700

    Keep the order of iface attributes the same accross rubies

    1.8 doesn't maintain insertion order for Hash keys like 1.9 does so we
    end up with ~random order for the display with the previous technique.
    Switch to an Array instead of a Hash so it's always the same.

commit 6f66dd40f39959711f9bacbda99717253a375d21
Author: James Lee <egypt@metasploit.com>
Date:   Tue Feb 28 08:23:35 2012 -0700

    Fix a few more compiler warnings

commit f39cb536a80c5000a5b9ca1fec5902300ae4b440
Author: James Lee <egypt@metasploit.com>
Date:   Tue Feb 28 08:17:39 2012 -0700

    Fix a type-safety warning

commit 1e52785f38146515409da3724f858b9603d19454
Author: James Lee <egypt@metasploit.com>
Date:   Mon Feb 27 15:21:36 2012 -0700

    LHOST should be OptAddress, not OptAddressRange

commit acef978aa4233c7bd0b00ef63646eb4da5457f67
Author: James Lee <egypt@metasploit.com>
Date:   Sun Feb 26 17:45:59 2012 -0700

    Fix a couple of warnings and a typo

commit 29d87f88790aa1b3e5db6df650ecfb3fb93c675b
Author: HD Moore <hdm@digitaloffense.net>
Date:   Mon Feb 27 11:54:29 2012 -0600

    Fix ctype vs content_type typo

commit 83b5400356c47dd1973e6be3aa343084dfd09c73
Author: Gregory Man <man.gregory@gmail.com>
Date:   Sun Feb 26 15:38:33 2012 +0200

    Fixed scripts/meterpreter/enum_firefox to work with firefox > 3.6.x

commit 49c2c80b347820d02348d694cc71f1b3028b4365
Author: Steve Tornio <swtornio@gmail.com>
Date:   Sun Feb 26 07:13:13 2012 -0600

    add osvdb ref

commit e18e1fe97b89c3a2b8c22bc6c18726853d2c2bee
Author: Matt Andreko <mandreko@gmail.com>
Date:   Sat Feb 25 18:02:56 2012 -0500

    Added aspx target to msfvenom.  This in turn added it to msfencode as well.
    Ref: https://github.com/rapid7/metasploit-framework/pull/188
    Tested on winxp with IIS in .net 1.1 and 2.0 modes

commit e6aa5072112d79bbf8a4d2289cf8d301db3932f5
Author: Joshua J. Drake <github.jdrake@qoop.org>
Date:   Sat Feb 25 13:00:48 2012 -0600

    Fixes #6308: Fall back to 127.0.0.1 when SocketError is raised from the resolver

commit b3371e8bfeea4d84f9d0cba100352b57d7e9e78b
Author: James Lee <egypt@metasploit.com>
Date:   Tue Feb 28 17:07:42 2012 -0700

    Simplify logic for whether an inner iface has the same address

commit 5417419f35a40d1c08ca11ca40744722692d3b0d
Author: James Lee <egypt@metasploit.com>
Date:   Tue Feb 28 16:58:16 2012 -0700

    Whitespace

commit 9036875c2918439ae23e11ee7b958e30ccc29545
Author: James Lee <egypt@metasploit.com>
Date:   Tue Feb 28 16:53:45 2012 -0700

    Set session info before worrying about address

    get_interfaces can take a while on Linux, grab uid and hostname earlier
    so we can give the user an idea of what they popped as soon as possible.

commit f34b51c6291031ab25b5bfb1ac6307a516ab0ee9
Author: James Lee <egypt@metasploit.com>
Date:   Tue Feb 28 16:48:42 2012 -0700

    Clean up rdoc

commit e61a0663454400ec66f59a80d18b0baff4cb8cd9
Author: HD Moore <hd_moore@rapid7.com>
Date:   Tue Feb 28 04:54:45 2012 -0600

    Ensure the architecture is only the first word (not the full WOW64
    message in some cases)

commit 4c701610976a92298c1182eecc9291a1b301e43b
Author: HD Moore <hd_moore@rapid7.com>
Date:   Tue Feb 28 04:49:17 2012 -0600

    More paranoia code, just in case RHOST is set to whitespace

commit c5ff89fe3dc9061e0fa9f761e6530f6571989d28
Author: HD Moore <hd_moore@rapid7.com>
Date:   Tue Feb 28 04:47:01 2012 -0600

    A few more small bug fixes to handle cases with an empty string target
    host resulting in a bad address

commit 462d0188a1298f29ac83b10349aec6737efc5b19
Author: HD Moore <hd_moore@rapid7.com>
Date:   Tue Feb 28 03:55:10 2012 -0600

    Fix up the logic (reversed by accident)

commit 2b2b0adaec2448423dbd3ec54d90a5721965e2df
Author: HD Moore <hd_moore@rapid7.com>
Date:   Mon Feb 27 23:29:52 2012 -0600

    Automatically parse system information and populate the db, identify and
    report NAT when detected, show the real session_host in the sessions -l
    listing

commit 547a4ab4c62dc3248f847dd5d305ad3b74157348
Author: HD Moore <hd_moore@rapid7.com>
Date:   Mon Feb 27 22:16:03 2012 -0600

    Fix typo introduced

commit 27a7b7961e61894bdecd55310a8f45d0917c5a5c
Author: HD Moore <hd_moore@rapid7.com>
Date:   Mon Feb 27 22:11:38 2012 -0600

    More session.session_host tweaks

commit e447302a1a9915795e89b5e29c89ff2ab9b6209b
Author: HD Moore <hd_moore@rapid7.com>
Date:   Mon Feb 27 22:08:20 2012 -0600

    Additional tunnel_peer changes

commit 93369fcffaf8c6b00d992526b4083acfce036bb3
Author: HD Moore <hd_moore@rapid7.com>
Date:   Mon Feb 27 22:06:21 2012 -0600

    Additional changes to session.session_host

commit c3552f66d158685909e2c8b51dfead7c240c4f40
Author: HD Moore <hd_moore@rapid7.com>
Date:   Mon Feb 27 22:00:19 2012 -0600

    Merge changes into the new branch
2012-02-28 18:29:39 -07:00
James Lee 46fef357f4 Clean up some rdoc comments
This adds categories for the various interfaces that meterpreter and
shell sessions implement so they are grouped logically in the docs.
2012-02-28 16:31:03 -07:00
James Lee a81868b6b3 Fix a nil comparison bug
I swear there was a ticket for this but now I can't find it.
2012-02-23 16:30:29 -07:00
James Lee 9261d8ec25 spaces at EOL in base 2011-11-20 12:11:40 +11:00
HD Moore 3046896204 This commit makes the new unicode string encoding optional, it can be disabled by setting EnableUnicodeEncoding to false or through the 'disable_unicode_encoding' console command in the Meterpreter shell. Fixes #4986
git-svn-id: file:///home/svn/framework3/trunk@13278 4d416f70-5f16-0410-b530-b9f4589650da
2011-07-21 15:44:54 +00:00
James Lee 1f349ff542 Don't close the session for irrelevant exceptions. The shell might still be dead for some other reason, but this will prevent closing it unnecessarily
git-svn-id: file:///home/svn/framework3/trunk@13107 4d416f70-5f16-0410-b530-b9f4589650da
2011-07-06 20:34:52 +00:00
James Lee e321d01cd4 actually do what the comment says it does instead of trying to read a bunch of times with a tiny timeout. fixes some issues with shell commands on meterpreter sessions
git-svn-id: file:///home/svn/framework3/trunk@13070 4d416f70-5f16-0410-b530-b9f4589650da
2011-06-30 05:05:02 +00:00
HD Moore 846172fa1a Split options based on shellwords, pass as a hash, this prevents commas in option values from breaking things and allows quotes to be used
git-svn-id: file:///home/svn/framework3/trunk@12983 4d416f70-5f16-0410-b530-b9f4589650da
2011-06-20 20:54:46 +00:00
James Lee 1f72859874 set the session info when there is no database. fixes regression introduced by r12523
git-svn-id: file:///home/svn/framework3/trunk@12690 4d416f70-5f16-0410-b530-b9f4589650da
2011-05-23 16:01:24 +00:00
Carlos Perez 0441b0c68c Typo that broke scripts in users home folder
git-svn-id: file:///home/svn/framework3/trunk@12645 4d416f70-5f16-0410-b530-b9f4589650da
2011-05-17 17:03:06 +00:00
HD Moore 9ce47c01bd Reverting the autoload changes until we can upgrade to a new ActiveSupport library or find a workaround
git-svn-id: file:///home/svn/framework3/trunk@12600 4d416f70-5f16-0410-b530-b9f4589650da
2011-05-12 20:03:55 +00:00
James Lee 06779bc8c0 remove unnecessary requires for stuff in rex. autoload and a high-level require 'rex' in lib/msf/core.rb should take care of everything. see #4371, #4373, r12587, and r12554.
git-svn-id: file:///home/svn/framework3/trunk@12588 4d416f70-5f16-0410-b530-b9f4589650da
2011-05-12 00:53:33 +00:00
HD Moore 93b0c5beb3 Check for the database first
git-svn-id: file:///home/svn/framework3/trunk@12523 4d416f70-5f16-0410-b530-b9f4589650da
2011-05-03 04:49:18 +00:00
James Lee 259bf9695a don't kill a session when the user ctrl-C's during a command run by sessions -c or a script/postmod
git-svn-id: file:///home/svn/framework3/trunk@12513 4d416f70-5f16-0410-b530-b9f4589650da
2011-05-02 20:40:19 +00:00
HD Moore 2c3e85af05 Major cleanups to the session manager, serialized processing of incoming connections, concurrent processing (up to a max scheduler thread count) of meterpreter initialization/scripts. This is to avoid a potential deadlock in openssl and ensure consistent, reliable session staging. This commit also fixes a bug that would mark database sessions as closed too early.
git-svn-id: file:///home/svn/framework3/trunk@12485 4d416f70-5f16-0410-b530-b9f4589650da
2011-04-30 18:51:50 +00:00
HD Moore 743a401a47 Add the ability to reset the last read pointer from the ringer buffer
git-svn-id: file:///home/svn/framework3/trunk@12467 4d416f70-5f16-0410-b530-b9f4589650da
2011-04-29 16:02:24 +00:00
James Lee 859fd9216f report module_run and script_run session events
git-svn-id: file:///home/svn/framework3/trunk@12448 4d416f70-5f16-0410-b530-b9f4589650da
2011-04-26 21:57:01 +00:00
HD Moore d2d66f3285 This patch changes how VNC sessions are handled, making them a now-unique type that is not registered in the normal sense. This works around a corner case due to recent session work.
git-svn-id: file:///home/svn/framework3/trunk@12358 4d416f70-5f16-0410-b530-b9f4589650da
2011-04-18 20:07:53 +00:00
James Lee 9c1b4ddca5 add a load command. this will later deprecate the use command under meterpreter for 3.7 release
git-svn-id: file:///home/svn/framework3/trunk@12334 4d416f70-5f16-0410-b530-b9f4589650da
2011-04-16 13:59:57 +00:00
James Lee 96af5e2af6 store session info in the db
git-svn-id: file:///home/svn/framework3/trunk@12317 4d416f70-5f16-0410-b530-b9f4589650da
2011-04-14 18:28:44 +00:00
James Lee d6edeebcef actually log errors from reporting the session fingerprint. would have helped greatly in tracking down #4128
git-svn-id: file:///home/svn/framework3/trunk@12313 4d416f70-5f16-0410-b530-b9f4589650da
2011-04-13 23:03:00 +00:00
Mike Smith d5d9d56081 Create a dedicated db table to track sessions & session events.
* Add new db tables for session & session_events
* Migrate existing session data from events db table
* Modify session report methods to log to the new tables


git-svn-id: file:///home/svn/framework3/trunk@12273 4d416f70-5f16-0410-b530-b9f4589650da
2011-04-07 21:59:32 +00:00
James Lee ad5073d6b1 only close the session when we get socket-related exceptions, fixes #4005
git-svn-id: file:///home/svn/framework3/trunk@12118 4d416f70-5f16-0410-b530-b9f4589650da
2011-03-23 22:21:59 +00:00
Tod Beardsley 4a41e4e352 Fixes #3742 by sanitizing utf-8 characters for the username and system name in session.info.
Tested with German Win2k3EE and a session created with exploit/windows/mssql/mssql_payload.



git-svn-id: file:///home/svn/framework3/trunk@11848 4d416f70-5f16-0410-b530-b9f4589650da
2011-02-28 21:39:25 +00:00
Carlos Perez 7e2fb81cb5 Initial set of OSX Shell Post modules for general basic enumeration and for dumping hashes (SHA, LM and NTLM) for OSX 10.4 and above
git-svn-id: file:///home/svn/framework3/trunk@11792 4d416f70-5f16-0410-b530-b9f4589650da
2011-02-22 14:00:47 +00:00
James Lee 5e9fdc28e7 move shell token stuff up to a mixin so meterpreter can use it, too
git-svn-id: file:///home/svn/framework3/trunk@11682 4d416f70-5f16-0410-b530-b9f4589650da
2011-01-31 05:20:16 +00:00
James Lee bd2dcdb5c3 add the scriptable mixin. fixes #3550, see #3541. /me grumbles
git-svn-id: file:///home/svn/framework3/trunk@11600 4d416f70-5f16-0410-b530-b9f4589650da
2011-01-19 16:01:12 +00:00
James Lee d120892e7c post modules working for shell sessions, fixes #3541
git-svn-id: file:///home/svn/framework3/trunk@11599 4d416f70-5f16-0410-b530-b9f4589650da
2011-01-19 02:24:21 +00:00
James Lee 6210fea1f3 add post/ module support for meterpreter autorunscript, see #3541
git-svn-id: file:///home/svn/framework3/trunk@11595 4d416f70-5f16-0410-b530-b9f4589650da
2011-01-17 23:48:19 +00:00
James Lee f0cc6ff596 big commit for converting meterpreter scripts to modules, see #3377. also fixes payload tab-completion and 'show payloads' after TARGET has changed
git-svn-id: file:///home/svn/framework3/trunk@11421 4d416f70-5f16-0410-b530-b9f4589650da
2010-12-27 17:46:42 +00:00
HD Moore a8311fd71d Verify a host is actually a real string before using it
git-svn-id: file:///home/svn/framework3/trunk@11372 4d416f70-5f16-0410-b530-b9f4589650da
2010-12-18 03:37:27 +00:00
HD Moore c28ad8ea0c Minor improvements and corner case bug fixes to session handling. This fixes issues that can come up when a stream is shut down
git-svn-id: file:///home/svn/framework3/trunk@11371 4d416f70-5f16-0410-b530-b9f4589650da
2010-12-18 03:00:26 +00:00
HD Moore fa29afaece Handle character echoing sessions more gracefully
git-svn-id: file:///home/svn/framework3/trunk@11268 4d416f70-5f16-0410-b530-b9f4589650da
2010-12-09 22:44:17 +00:00
HD Moore a12d9f8dbf This patch adds detailed thread tracking across the metasploit framework, along with a new console command (threads) to manage these. This level of tracking is required to accurately monitor background tasks, assist with debugging, and kill orphaned threads.
git-svn-id: file:///home/svn/framework3/trunk@11003 4d416f70-5f16-0410-b530-b9f4589650da
2010-11-12 06:19:49 +00:00
HD Moore b143c8eac1 Only load priv on win32/win64 sessions
git-svn-id: file:///home/svn/framework3/trunk@10984 4d416f70-5f16-0410-b530-b9f4589650da
2010-11-11 16:15:26 +00:00
HD Moore 9432991951 Rescue if priv is not available
git-svn-id: file:///home/svn/framework3/trunk@10848 4d416f70-5f16-0410-b530-b9f4589650da
2010-10-30 19:37:01 +00:00
HD Moore 0f8a6b138b Remove the IsAdmin check for now, always load priv instead. This works around a performance issue with railgun demand loading, once thats fixed we can re-enable
git-svn-id: file:///home/svn/framework3/trunk@10844 4d416f70-5f16-0410-b530-b9f4589650da
2010-10-29 04:14:22 +00:00
James Lee 745f31b20f make the sessions command a little more useful, see #2097
git-svn-id: file:///home/svn/framework3/trunk@10791 4d416f70-5f16-0410-b530-b9f4589650da
2010-10-23 00:02:09 +00:00
Joshua Drake c27749db8e add default lookup_error function, fixes #2993
git-svn-id: file:///home/svn/framework3/trunk@10757 4d416f70-5f16-0410-b530-b9f4589650da
2010-10-19 22:53:15 +00:00
Joshua Drake e408d5a155 add windows error messages for windows meterpreter sessions, minor cleanups
git-svn-id: file:///home/svn/framework3/trunk@10605 4d416f70-5f16-0410-b530-b9f4589650da
2010-10-08 19:36:34 +00:00
HD Moore 504be7e7e2 Dont put the load_priv into the timeout block
git-svn-id: file:///home/svn/framework3/trunk@10603 4d416f70-5f16-0410-b530-b9f4589650da
2010-10-08 17:31:08 +00:00
HD Moore 2e9138ebbc This commit overhauls much of the meterpreter timeouts and staging processes. This fixes a bug with concurrent session handling, reduces CPU load by caching a single SSL certificate for all sessions, increases all of the critical timeouts, and generally makes mass ownage work better. We still need to limit the maximum number of concurrent on_session() threads to something sane to prevent sesssion spikes from dragging out the process even longer. The C-side meterpreter change is minimal and will only help with future compatibility if we move to non-blocking fd's for the SSL socket.
git-svn-id: file:///home/svn/framework3/trunk@10595 4d416f70-5f16-0410-b530-b9f4589650da
2010-10-08 04:11:47 +00:00
HD Moore 69ce7eed1b Wrap the admin check in case the OS doesn't support this API (WinNT, Win2000)
git-svn-id: file:///home/svn/framework3/trunk@10390 4d416f70-5f16-0410-b530-b9f4589650da
2010-09-20 04:58:25 +00:00
HD Moore 8f7743c999 Check for railgun first
git-svn-id: file:///home/svn/framework3/trunk@10342 4d416f70-5f16-0410-b530-b9f4589650da
2010-09-16 21:49:51 +00:00
HD Moore 21d734201a Closes #2520. Merges Rob's patch to check admin privs on start
git-svn-id: file:///home/svn/framework3/trunk@10341 4d416f70-5f16-0410-b530-b9f4589650da
2010-09-16 21:44:25 +00:00
Joshua Drake f8fcc80874 fix silly typos, thx scriptjunkie - fixes #2330
git-svn-id: file:///home/svn/framework3/trunk@9952 4d416f70-5f16-0410-b530-b9f4589650da
2010-08-03 16:07:48 +00:00