Commit Graph

89 Commits

Author SHA1 Message Date
h00die d64ed33cdf code spell for a bunch of modules 2023-09-24 17:42:00 -04:00
Hamilton Tobon Mosquera 6074d1a4d3 fix: parse COMMAND with nested '=' in meterpreter
Fixes bug #16578
2023-01-06 09:27:25 -05:00
adfoster-r7 3a281234df Add feature flagged datastore rewrite, with support for option fallback lookups 2022-09-16 12:59:02 +01:00
adfoster-r7 4b818000fc Fix regression issue with serializing reported events 2021-09-03 13:09:14 +01:00
adfoster-r7 736457dbd4 Cleanup comments 2021-09-02 13:00:05 +01:00
Alan Foster 112f43f798 Consolidate module argument parsing for ensuring consistency 2021-09-02 13:00:02 +01:00
Alan Foster 4899884a33 Add http support in rhosts option 2021-09-02 12:59:50 +01:00
sjanusz 83c27b2509 Fix external module encoding 2021-08-25 17:44:45 +01:00
Alan Foster c84b651ca6 Remoce initial rhost http url attempt 2021-05-24 00:31:09 +01:00
Alan Foster 6a349dad75 Extract module data store to its own file 2021-02-19 10:29:50 +00:00
dwelch-r7 1617b3ec9b Use zeitwerk for lib/msf/core folder 2020-12-07 10:31:45 +00:00
dwelch-r7 e7061439ef Adds rhost url support behind a feature flag
Tidy up test

Return a string instead of a URI object

Code review comments

Rubcocop
2020-08-18 12:25:27 +01:00
Brent Cook 069a3e3c4e use casecmp rather than allocate a string on every comparison 2019-12-02 09:03:58 -06:00
Brent Cook 16e800a7c4 Implement deregistering an option by alias
Rather than having to 'unregister' both 'RHOST' and 'RHOSTS' for modules using a network-connecting mixin, this allows just unregistering one option by exposing the alias key lookup to the module options library and allowing it to remove the datastore options for the module from validation.

Noted while testing #11108 that the module's unregister options were incomplete, and there were a few more like it. This allows modules operating in this style to work without modifications.
2019-02-13 05:07:20 -06:00
Brent Cook 0678d33760 Revert "ensure a value exists before returning the normalized key"
This reverts commit 063838fb17.
2018-11-26 10:10:07 -06:00
Brent Cook a98dbd1d61 Revert "Return the original key if it does not exist in the datastore"
This reverts commit 7312fa774f.
2018-11-26 10:10:07 -06:00
Brent Cook 7312fa774f Return the original key if it does not exist in the datastore 2018-11-21 06:03:50 -06:00
Brent Cook 063838fb17 ensure a value exists before returning the normalized key 2018-11-21 04:43:06 -06:00
Brent Cook da9e6edbf1 delete option aliases when an option is deleted
Otherwise the aliases will remain active and if the aliased value is redefined
2018-11-21 04:09:33 -06:00
Adam Cammack 524661617c Allow DataStore to nest Arrays arbitrarily deep 2018-05-07 09:51:40 -05:00
Brent Cook ee2ad8affe move super call in merge! so that it returns the proper value 2018-04-27 14:21:57 -05:00
Brent Cook 31563a977c use OO rather than duck typing for parameter copying 2018-04-25 18:41:14 -05:00
Brent Cook 9bdba7e234 s/clone/ds/g 2018-04-25 18:35:45 -05:00
Brent Cook 30abdfe2fd move copy up so it's clear what we call by default 2018-04-24 06:40:15 -05:00
Brent Cook 7afefe07a6 aliases was not being copied, dup it 2018-04-24 06:32:54 -05:00
Brent Cook 1d376c78e2 ensure copy exists on DataStore too 2018-04-24 06:32:38 -05:00
Brent Cook 505810ffd6 introspect the RHS since it it is not guaranteed to be a Datastore 2018-04-24 06:15:05 -05:00
Brent Cook d34119548d replace some @ with self. 2018-04-24 06:03:02 -05:00
Brent Cook 00d0beb188 use deep copy 2018-04-18 02:34:48 -10:00
Brent Cook 09e86bfbd0 define merge and merge! on datastore to also merge aliases 2018-04-18 02:27:57 -10:00
Adam Cammack 3363bcf629 Add DataStore serialization that preserves Arrays 2018-01-16 21:05:19 -06:00
Brent Cook bca8e77163 add alias support for datastore options 2017-08-08 19:26:59 -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
wchen-r7 c6b1955a5a Land #6729, Speed up the datastore 2016-06-15 17:55:42 -05:00
Brent Cook fe1b24e666 allow nil assignment to the datastore 2016-05-23 14:56:19 -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
Brent Cook e25525b4a7 avoid validating file-based datastore options on assignment
file:/ strings are special with some datastore options, causing them to read a
file rather than emitting the exact string. This causes a couple of problems.

1. the valid? check needs to be special on assignment, since normalization
   really means normalizing the path, not playing with the value as we would do
   for other types

2. there are races or simply out-of-order assignments when running commands
   like 'services -p 80 -R', where the datastore option is assigned before the
   file is actually written.

This is the 'easy' fix of disabling assignment validation (which we didn't have
before anyway) for types that can expect a file:/ prefix.
2016-03-28 23:03:17 -05:00
Adam Cammack 22df7c0071 Fix datastore to validate options w/o a default
Options without a default were not pulled into the `@options` hash and
therefore were not used to validate options on assignment.

I am not entirely sure how this fix works, since it would seem that
non-override options would not get pulled in if an option was first set
in the global datastore. However, a previous value does not get
overridden and new values are validated. Anything further is merely
speculation on my part.
2016-03-22 19:12:53 -05:00
Adam Cammack 5c163960ed Fix datastore to not freeze options on the default 2016-03-22 19:07:58 -05:00
Brent Cook 654590911b Enforce integrity of datastore options on assignment 2016-03-15 14:00:32 -05:00
Brent Cook 694f7f0a65 stop turning all default options into strings
we need to adjust vprint* functions, since they now fallthrough to the
'framework.datastore' checks because the false case actually triggers.
2016-03-05 23:09:14 -06:00
root 51dd88114b Fix grammer in comments 2015-04-13 13:21:41 +05:00
William Vu 0ad3473ebb Implement case-insensitive datastore.delete 2015-02-24 20:47:00 -06:00
Tab Assassin 7e5e0f7fc8 Retab lib 2013-08-30 16:28:33 -05:00
James Lee db676f1a88 Whitespace at EOL 2013-03-07 18:20:08 -06:00
HD Moore d656e3185f Mark all libraries as defaulting to 8-bit strings 2012-06-29 00:18:28 -05:00
HD Moore b89af3546d Revert the previous global fix in favor of a different method.
Fixes #6501
2012-03-07 07:37:36 -06:00
HD Moore de9b35d7b0 Fixes #6485 by allowing validation to write back normalized values to
global. This isn't perfect, but we have no better solution unless we
clone the module datastore and unset the default imported_by for the
module run (actively testing that too in a branch)
2012-02-29 01:49:26 -06:00
HD Moore 7b40d8d819 Allow updates to fallthrough to the global store just like reads 2012-02-29 01:40:54 -06:00
James Lee e7a545c483 spaces at EOL in core stuff 2011-11-20 12:10:08 +11:00