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

move external module template to an ERB, allowing for more templates to be added #8346

Merged
merged 6 commits into from May 10, 2017

Conversation

busterb
Copy link
Member

@busterb busterb commented May 5, 2017

This moves the inline external module template into an .erb file, separating the metadata parsing into common and exploit-specific chunks, which allows one to compose the specific functionality needed for a particular module type. When we add a 2nd template, this will likely shift around.

Verification steps

  • start msfconsole
  • ensure that the info hash, metadata, and functionality of the haraka module are the same as before

Copy link
Contributor

@acammack-r7 acammack-r7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just one small concern.

execute_cmdstager({:flavor => :wget})
end

def wait_status(mod)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method should be pulled out into a mixin, ERB helper, or something else where it won't be copy-pasta'd among all the templates.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, that makes sense

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should be inserted as

<%= extras %>

execute_cmdstager({:flavor => :wget})
end

def wait_status(mod)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should be inserted as

<%= extras %>


register_options([
<%= meta[:options] %>
], self.class)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get rid of self.class

end
end
end
end
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ded

@@ -34,12 +34,16 @@
{'type': 'edb', 'ref': '41162'},
{'type': 'url', 'ref': 'https://github.com/haraka/Haraka/pull/1606'},
],
'type': 'remote_exploit.cmd_stager.wget',
'type': 'remote_exploit_cmd_stager',
'wfsdelay': 5,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be changed in the template.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated, thx

@wvu wvu assigned wvu and acammack-r7 and unassigned wvu and acammack-r7 May 9, 2017
meta = mod_meta_exploit(mod, meta)
meta[:command_stager_flavor] = mod.meta['payload']['command_stager_flavor'].dump
out = render_template('remote_exploit_cmd_stager.erb', meta)
File.write("/tmp/blah.rb", out)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra debugging.

@wvu wvu removed their assignment May 9, 2017
@acammack-r7 acammack-r7 merged commit 42fd287 into rapid7:master May 10, 2017
@acammack-r7
Copy link
Contributor

acammack-r7 commented May 10, 2017

Release Notes

Shims for external modules are now generated from a set of templates to allow easier management of additional module types.

@wvu
Copy link
Contributor

wvu commented May 11, 2017

Thanks, @acammack-r7.

@alrosenthal-r7 alrosenthal-r7 added the rn-enhancement release notes enhancement label May 16, 2017
@acammack-r7 acammack-r7 added the external modules PRs dealing with modules run as their own process label Apr 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external modules PRs dealing with modules run as their own process feature library module rn-enhancement release notes enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants