Module: Ronin::Exploits::Mixins::FileBuilder
- Defined in:
- lib/ronin/exploits/mixins/file_builder.rb
Overview
Adds methods for building exploit files. Also adds a filename
param
and a
default_filename
class method.
Examples
include Mixins::FileBuilder
default_filename 'exploit.docx'
def build
# ...
build_file do |file|
# ...
file.write(buffer)
# ...
end
# ...
end
Class Method Summary collapse
-
.included(exploit) ⇒ Object
private
Includes Params::Filename into the exploit including FileBuilder.
Instance Method Summary collapse
-
#build_file(name = filename) {|file| ... } ⇒ String
Opens the file to be built.
Class Method Details
.included(exploit) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Includes Params::Filename into the exploit including Ronin::Exploits::Mixins::FileBuilder.
64 65 66 |
# File 'lib/ronin/exploits/mixins/file_builder.rb', line 64 def self.included(exploit) exploit.include Params::Filename end |
Instance Method Details
#build_file(name = filename) {|file| ... } ⇒ String
Opens the file to be built.
94 95 96 97 98 99 |
# File 'lib/ronin/exploits/mixins/file_builder.rb', line 94 def build_file(name=filename,&block) path = File.(name) File.open(name,'wb',&block) return path end |