Skip to content

The temporary build directory is not being removed after running ronin-payloads build #192

@postmodern

Description

@postmodern

The Mixins::BuildDir mixin creates a temporary build directory in perform_build, then calls build, but only deletes the directory later in perform_cleanup. The ronin-payloads build command does not call @payload.perform_cleanup after calling @payload.perform_build, thus the temporary build directories never get deleted.

Mixins::BuildDir#perform_build should delete the build directory after calling super:

@build_dir   = Dir.mktmpdir("ronin-payloads-#{payload_name}-")

super

FileUtils.rm_r(@build_dir)
@build_dir = nil

Or call Dir.mktmpdir with a block and let Dir.mktmpdir automatically delete the temporary directory:

Dir.mktmpdir("ronin-payloads-#{payload_name}-") do |dir|
  @build_dir = dir
  super
  @build_dir = nil
end

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions