Commit Graph

56 Commits

Author SHA1 Message Date
Jeffrey Martin 5e495d72f5 avoid side effects on arguments
When passed arguments as `opts` prefer to avoid side-effects
from method execution.

This extends similar work from #12740
2021-04-13 16:11:09 -05:00
Jeffrey Martin 07cbe426e2 Rails 5, all models inherit from ApplicationRecord
ApplicationRecord is a new superclass for all app models, analogous to app controllers subclassing ApplicationController instead of ActionController::Base. This gives apps a single spot to configure app-wide model behavior.
https://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html#active-record-models-now-inherit-from-applicationrecord-by-default

Deprecated Relation#uniq use Relation#distinct instead.
https://edgeguides.rubyonrails.org/5_0_release_notes.html#active-record-deprecations
2020-07-31 11:56:49 -05:00
Jeffrey Martin aaddc9d8a5 don't rely on side-effects in db util function 2019-12-17 14:11:58 -06:00
Erin Bleiweiss 0435d7e1d6 Return the updated objects 2019-01-10 11:04:42 -06:00
Erin Bleiweiss 771469f4cd Update all Mdm::xx.update() instances 2019-01-07 16:24:13 -06:00
Matthew Kienow eec7a3dafc Remove debug code 2018-12-14 13:33:16 -05:00
Matthew Kienow b6cdf7aa9d Add update_session method 2018-12-14 12:04:55 -05:00
James Barnett 2ef639f99e opts[:id] could sometimes be an integer, so cast to string 2018-07-31 10:58:01 -05:00
James Barnett 4da27d2bff Enable GET for /endpoint/ID for each model 2018-07-18 15:18:22 -05:00
Brent Cook 835281c7cc Land #9979, Add inactive list option to sessions command 2018-05-25 03:28:22 -05:00
Matthew Kienow 262e791dcc Make find_or_create_host opts more consistent
Modify to use DBManager methods rather than DataProxy
2018-05-14 17:35:18 -04:00
Matthew Kienow 06e178cba2 Add functionality to retrieve sessions 2018-05-05 00:39:56 -04:00
James Barnett f4a949e649 Fix bug creating sessions when connected to remote data service 2018-04-19 16:19:39 -05:00
James Barnett aa40ef1789 Grab session_dto workspace from host 2018-04-18 17:38:42 -05:00
James Barnett def0e4d93b Merge branch 'goliath' into MS-3062_workspaces 2018-03-23 11:37:01 -05:00
James Barnett 466c97f114 WIP: move tracking active workspace to client side
* Move the @current_workspace tracking to workspace proxy
* Create helper for handling workspace value in opts
* Call framework.db.proxy across dbmanager files now that active ws is tracked in proxy

NOTE: This commit throws an exception when adding a remote data service.
2018-03-22 21:00:06 -05:00
Matthew Kienow ced6707ba6 Fix cmd vulns and DBManager Session spec 2018-03-20 15:25:09 -04:00
Matthew Kienow f365e6fc28 Remove stderr debug output 2018-03-16 17:50:49 -04:00
Matthew Kienow 636284d530 Update session inferred vuln handling
Add remote vuln attempt
2018-03-12 14:26:03 -04:00
Matthew Kienow c11bcc4ebc Move Mdm::Session usage to db_manager session 2017-12-11 17:47:28 -05:00
James Barnett ffcec527a7 Successfully storing creds remotely 2017-10-23 11:30:50 -05:00
James Barnett 0dbfc9d447 WIP: Drop session objects before JSON conversion
The session object is not intended to be store in the DB.
There are a ton of subobjects and unneeded data that causes the JSON conversion
to hang or fail with 'stack level too deep' errors.
2017-10-06 11:43:01 -05:00
James Barnett f88840e5b7 Move normaliize_host to a library method
This method was in Msf::DbManager class but doesn't actually use the DB.
This required you to have a DB connection just to do the check.
Moved it out to a helper library so we have access to it without forcing
a DB connection.
2017-09-28 16:59:44 -05:00
christopher lee 000f561d6f Added session data export 2017-09-08 11:09:15 -05:00
OJ 1d617ae389 Implement first pass of architecture/platform refactor 2016-10-28 07:16:05 +10:00
David Maloney a763863ff3 remove #truncate_session_desc
this method was absed around a char limit
for the desc column which no longer exists
trying to perform this operation generates an error
removing the method since it is not needed
2016-05-06 09:36:12 -05:00
thao doan 5e36a3128c Fix #5197, Fixed yard doc errors
Fix #5197 Fixed issues that caused errors during yard doc generation
2016-04-21 13:06:00 -05:00
Fernando Arias 5cf3ac23e2 Fix no method defined error when run_id is not passed down
* run_id is an optional param so we handle when it isn't set on user data

MSP-13119
2015-09-16 15:32:48 -05:00
Fernando Arias eb479318b1 Use existing run for match result or create a new one if it doesnt exist
MSP-13119
2015-09-15 14:34:44 -05:00
Fernando Arias c7f15ca940 Rework how match results get created
MSP-13119

* Create match result when we create vuln attempt
2015-09-14 12:18:47 -05:00
Fernando Arias ed1065b297 Create MatchResult with status Failure on session failure
MSP-13104
2015-08-24 12:56:32 -05:00
Greg Mikeska 790356bac8 add infer_vuln_from_session to other valid case
MSP-13065
2015-08-12 15:45:37 -05:00
Greg Mikeska 01b3ae2dd8 Revert "added infer_vuln_from_session to other valid case"
This reverts commit 53e747ce2e.
2015-08-12 15:43:16 -05:00
Greg Mikeska 53e747ce2e added infer_vuln_from_session to other valid case
MSP-13064
2015-08-12 15:35:03 -05:00
g0tmi1k 6dcc9b7dab More inconsistencies 2015-06-12 21:59:15 +01:00
Matt Buck e82fb5f836 Merge branch 'master' into staging/rails-4.0
Conflicts:
	Gemfile.lock
	lib/msf/ui/console/command_dispatcher/db.rb
	metasploit-framework-db.gemspec
	metasploit-framework.gemspec
2015-04-15 14:04:35 -05:00
root 51dd88114b Fix grammer in comments 2015-04-13 13:21:41 +05:00
Matt Buck 9f15824e2a Merge branch 'master' into staging/rails-4.0
Conflicts:
	Gemfile.lock
2015-04-10 15:35:27 -05:00
James Lee 83cf1ad8ce Instantiate to get name if we don't have cache yet
Fixes #5086
2015-04-06 18:59:38 -05:00
Christian Catalan 75343ef30c Remove unneccesary match_set in MatchResult.create
MSP-12516

* Fixes UknownAttribute error for match_set in Rails 4
2015-04-06 16:36:37 -05:00
James Lee 8c1a597a25 Make a Session record before using it
How about that.
2015-04-01 13:12:28 -05:00
James Lee 8b8ec5990a Ask the database how long the column should be
Instead of hardcoding a number
2015-03-31 14:12:22 -05:00
James Lee a8ef465b46 Use the variables we worked so hard to create 2015-03-31 13:34:27 -05:00
James Lee 176cdcb836 Use sym-to-proc instead of reimplementing it 2015-03-31 11:21:53 -05:00
James Lee 971120ce98 Use create! instead of new ... save! 2015-03-31 10:15:23 -05:00
James Lee 790a08a848 It's pronounced "exploit", not "assoc_exploit" 2015-03-30 16:21:17 -05:00
James Lee 310779d7bf Death to hashrockets 2015-03-30 13:13:58 -05:00
James Lee e65f4e92ea Separate the two ways to make Mdm::Sessions
Failing spec due to reuse of Mdm::Module::Detail instead of also
instantiating an Msf::Module
2015-03-30 13:05:20 -05:00
James Lee 466ef4349e Second verse, same as the first 2015-03-27 09:59:10 -05:00
James Lee a9e4961563 New hash syntax 2015-03-26 10:05:08 -05:00