Skip to content

Commit

Permalink
Extract stager/adapter information
Browse files Browse the repository at this point in the history
  • Loading branch information
adfoster-r7 committed Oct 12, 2023
1 parent b135b81 commit 44713cc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/module-info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
fail-fast: true
matrix:
ruby:
- 2.7
- 3.2
info_cmd:
- >-
set -euxo pipefail;
Expand All @@ -56,7 +56,6 @@ jobs:
with:
path: metasploit-info


- name: ${{ matrix.test_cmd }}
run: |
echo "${CMD}"
Expand All @@ -70,9 +69,11 @@ jobs:
repository: rapid7/metasploit-framework
path: metasploit-framework

- uses: actions/setup-ruby@v1
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Setup bundler
run: |
Expand Down
21 changes: 17 additions & 4 deletions resources/extract_module_info.rc
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ end

# Mixins that can be filtered as they're not interesting
common_mixins = (
Msf::Exploit.ancestors +
Msf::Auxiliary.ancestors +
Msf::Exploit.ancestors &
Msf::Auxiliary.ancestors &
Msf::Post.ancestors
).map(&:to_s).uniq
).map(&:to_s)

_, total_time = record_time do
STDERR.puts 'Extracting module paths'
Expand Down Expand Up @@ -154,7 +154,20 @@ _, total_time = record_time do
}

if module_set_name == 'exploit'
data[:compatible_payloads] = mod.compatible_payloads.map { |payload_name, payload_class| payload_name }
data[:compatible_payloads] = mod.compatible_payloads.map { |payload_name, payload_class| payload_name }
end

if module_set_name == 'payload'
payload_data = {
payload_type: mod.payload_type,
adapter_refname: mod.adapter_refname,
adapted_refname: mod.adapted_refname,
# adapted: mod.adapted?,
staged: mod.staged?,
stage_refname: mod.stage_refname,
stager_refname: mod.stager_refname,
}.compact
data.merge!(payload_data)
end

data
Expand Down

0 comments on commit 44713cc

Please sign in to comment.