Commit Graph

65 Commits

Author SHA1 Message Date
Brent Cook 8ac5d2d377 tidy up a bit while we're in here 2017-05-14 21:27:38 -05:00
RageLtMan cf29a512d0 Upstream Msf namespace PSH decompressor & decoder
Present convenience interfaces in Msf::Exploit::Powershell ns for
decoding and decompressing PSH strings built with Rex::Powershell
or compatible implementations.
2017-05-10 22:44:56 -04:00
RageLtMan 47b1320d08 Add options to cmd_psh_payload
Fill in validated datastore options for generating custom PSH
payloads
2016-10-08 14:06:35 -05:00
RageLtMan fb8e025aa5 Force datastore validation by option set
cmd_psh_payload relies on datastore options to have a proper
data type down the call chain. When modules are created with string
values for all data store options, a conditional naively checking
what should be a boolean value for false/nil? would return true
for a string representation of "false."

Ensure that datastore options are validated prior to using them
to set variables passed into Rex methods.
2016-10-08 14:06:35 -05:00
RageLtMan f24bfe7d4e Import Powershell::exec_in_place
Allow passing exec_in_place parameter to cmd_psh_payload in order
to execute raw powershell without the commandline wrappers of
comspec or calling the powershell binary itself.
This is useful in contexts such as the web delivery mechanism or
recent powershell sessions as it does not require the creation of
a new PSH instance.
2016-10-08 14:06:35 -05:00
David Maloney af4f3e7a0d use templates from the gem for psh
use the templates now contained within the magical
gem of rex-powershell

7309
MS-2106
2016-10-04 14:14:25 -05:00
Louis Sato d5d0b9e9b8 Revert "Land #6729, Speed up the datastore"
This reverts commit c6b1955a5a, reversing
changes made to 4fb7472391.
2016-06-28 13:39:52 -05:00
Adam Cammack a808c9fe63 Bring some sanity to the datastore
Before, the datastore would store options case-sensitive, but would
access them case-insensitive, resulting is a number of string compares.
This commit stores options in their downcase form to reduce
update/lookup time. This adds up to reducing msfconsole boot time by
about 10% and rspec time by about 45 sec. (!) on my box.

One tricky part of this conversion is that there are several places (in
pro and framework) where we export or otherwise access the datastore as
a plain hash (case-sensitive). I believe I have caught all the ways we
access the datastore that are case-sensitive and substituted the
original key capitalization in those cases.
2016-03-30 15:17:55 -05:00
jvazquez-r7 953bfe1a81 Delete typo 2015-10-02 15:29:03 -05:00
jvazquez-r7 6468eb51b2 Do changes to have into account powershell sesions are not cmd sessions 2015-10-02 15:26:42 -05:00
RageLtMan 27e12754fe Import Powershell libraries and sample post module
Sync critical functionality from Rex and Msf namespaces dealing
with encoding and processing of powershell script for exploit
or post namespaces.

Import Post module. Primarily adds a psh_exec method which will be
replaced in the next PR with @benpturner's work integrated into
the Post module namespace.

Provide a sample metasploit windows post module to show the
execution pipeline - entire subs process can be removed and the
module reduced to a psh_exec(datastore['SCRIPT']).

This commit is designed to provide sync between the SVIT fork and
upstream. Pending commits to be based on this work will provide
access to .NET compiler in the Post namespace to be used for
dynamic persistent payload creation on target and the import of
@benpturner's work.
2015-05-20 18:18:51 -04:00
Meatballs 33560a2657 Refactor Msf::Exploit::Powershell to Rex::Powershell to allow for
msfvenom usage.
2015-02-10 20:53:46 +00:00
Spencer McIntyre 2a3855c5af Skip the psh prepend sleep time error when it is 0 2015-02-09 14:20:04 -05:00
Tom Sellers 693e744da4 Hide icon flash on taskbar during cmd_psh_payload
When 'cmd_psh_payload' is run via 'cmd_exec' on a windows shell that is running in the context of an interactive user an icon will flash very quickly on the user's task bar.  This can be avoided (verified) by adding the /b switch to the start section of the command launcher text.  I have verified that this switch exists from Windows 2000 through Windows 2012 R2.
2014-08-02 15:52:52 -05:00
Meatballs 5f0533677e Cheat/Rubycop all the things 2014-07-20 21:07:59 +01:00
Meatballs 19dd21abaf Remove duplicate methods 2014-04-25 15:40:03 +01:00
Meatballs 72a2849bf1 Better specs
90.6% line coverage in Exploit::Powershell
77.32% in Rex::Exploitation::Powershell and haven't even started
writing those specs...
2014-04-23 08:07:42 +01:00
Meatballs 0137fdb690 Prepend sleep should be an int 2014-04-23 07:29:51 +01:00
Meatballs 61b8fb7921 Remove puts 2014-04-23 06:15:28 +01:00
Meatballs 11526b59a6 Boolean datastore options should always be present
Dont evaluate true/false as 'true'/'false'!
2014-04-23 05:03:16 +01:00
Meatballs 1347649a47 Remove unused EOFs 2014-04-23 02:37:07 +01:00
Meatballs 01bfad3489 Correct datastore values 2014-04-23 02:08:57 +01:00
Meatballs 647936e291 Add more yarddoc to Rex::Exploitation::Powershell
encode_code doesn't use eof
no need to unicode encode in gzip as this is handled by encode_code
2014-04-23 01:07:54 +01:00
Meatballs 88fe619c48 Yarddoc exploit::powershell 2014-04-23 00:15:55 +01:00
Meatballs 4c66e86f73 Dont add extra space in args 2014-04-22 14:44:01 +01:00
Meatballs 0f942d8c3d Still :shorten command args 2014-04-19 18:58:26 +01:00
Meatballs 270b4b9728 Catch first arg with shorten 2014-04-19 18:54:42 +01:00
RageLtMan 9f05760c50 Merge with Meatballs' initial changes
Clean up arch detection code and dedup Msf/Rex
Reduce generated payload size
2014-04-18 00:28:48 -04:00
RageLtMan 5c3289bbc6 merge fix 2014-04-17 21:26:04 -04:00
Meatballs 0956ae5789 Fix payload selection 2014-03-02 20:56:55 +00:00
Meatballs 1ca690eccf Do some rspec 2014-03-02 20:37:08 +00:00
Meatballs c9a2135959 Merge in semperv 2014-03-02 19:07:13 +00:00
RageLtMan 0056c26047 import msf exploit 2014-02-12 22:06:18 -05:00
Meatballs c76341c82d Dont dsub Invoke-Command etc... 2014-02-09 17:45:30 +00:00
Meatballs 151e45d8d1 Better exception descriptions 2014-02-09 12:52:56 +00:00
Meatballs 77dda5dc67 Give option to remove badchars 2014-02-09 12:34:25 +00:00
Meatballs 0379dc128c Raise exception on known issues 2014-02-09 12:15:02 +00:00
Meatballs 02f1ff27ee Add option to encode inner payload 2014-02-09 00:55:26 +00:00
Meatballs f398c982e3 Include option to ensure payload is fully encoded 2014-02-08 23:51:13 +00:00
Meatballs ad308efc05 Really minimize commandline size 2014-02-08 22:53:47 +00:00
Meatballs c76862b391 Reduce payload size 2014-02-08 22:11:17 +00:00
Meatballs b10df54dbb Dont need to encode the compress payload 2014-02-08 21:34:51 +00:00
Meatballs 435cc9b93f Add single quote encapsulation
For WMI and psh_web_delivery
2013-12-16 15:13:13 +00:00
Meatballs 6c83109422 Really fix wmi 2013-11-23 16:44:44 +00:00
Meatballs 259d5a2dba Backout Set-Variable as it is 3.0 only 2013-11-23 01:15:13 +00:00
Meatballs 1c60373f68 Reinstate %COMSPEC% 2013-11-23 00:45:04 +00:00
Meatballs c194fdc67e Fixup WMI
-c doesn't like $var assignments
2013-11-23 00:31:11 +00:00
Meatballs 3cbf768d16 Small size reductions 2013-11-22 22:58:42 +00:00
Meatballs 4fc8bb2b4b Auto arch detection 2013-10-22 00:42:59 +01:00
Meatballs 971d0b7536 Generate args 2013-09-27 12:48:10 +01:00