Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Persistence module types #19806

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions lib/msf/base/serializer/json.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# -*- coding: binary -*-
# rubocop:disable Metrics/AbcSize
# rubocop:disable Metrics/ClassLength
# rubocop:disable Metrics/CyclomaticComplexity

module Msf
module Serializer
#
Expand All @@ -16,14 +14,16 @@ class Json
# @param mod [Msf::Module] the module to dump information for.
# @param _indent [String] the indentation to use.
# @return [String] formatted text output of the dump.
def self.dump_module(mod, _indent = "")
def self.dump_module(mod, _indent = '')
case mod.type
when Msf::MODULE_PAYLOAD
return dump_payload_module(mod)
when Msf::MODULE_NOP
return dump_basic_module(mod)
when Msf::MODULE_ENCODER
return dump_basic_module(mod)
when Msf::MODULE_PERSISTENCE
return dump_basic_module(mod)
when Msf::MODULE_EXPLOIT
return dump_exploit_module(mod)
when Msf::MODULE_AUX
Expand Down Expand Up @@ -56,8 +56,8 @@ def self.dump_module_actions(mod)
list = []

mod.actions.each do |target|
list.push('name' => (target.name || 'All'),
'description' => (target.description || ''))
list.push('name' => target.name || 'All',
'description' => target.description || '')
end

list
Expand All @@ -70,8 +70,8 @@ def self.dump_module_actions(mod)
def self.dump_module_action(mod)
list = []

list.push('name' => (mod.action.name || 'All'),
'description' => (mod.action.description || ''))
list.push('name' => mod.action.name || 'All',
'description' => mod.action.description || '')

list
end
Expand All @@ -96,7 +96,7 @@ def self.dump_exploit_module(mod)
# Return a json dump of exploit module data
{
'platform' => mod.platform_to_s,
'privileged' => (mod.privileged? ? "Yes" : "No"),
'privileged' => (mod.privileged? ? 'Yes' : 'No'),
'license' => mod.license,
'disclosure_date' => (mod.disclosure_date if mod.disclosure_date),
'payload' => {
Expand Down Expand Up @@ -145,7 +145,7 @@ def self.dump_payload_module(mod)
{
'platform' => mod.platform_to_s,
'arch' => mod.arch_to_s,
'privileged' => (mod.privileged? ? "true" : "false"),
'privileged' => (mod.privileged? ? 'true' : 'false'),
'size' => mod.size
}.merge(dump_common_module_info(mod)).to_json
end
Expand Down
Loading
Loading