Skip to content

The temporary build directory is not being removed after running ronin-exploits run --dry-run #162

@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-exploits run --dry-run command does not call @exploit.perform_cleanup after calling @exploit.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-exploits-#{exploit_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-exploits-#{exploit_name}-") do |dir|
  @build_dir = dir
  super
  @build_dir = nil
end

Metadata

Metadata

Assignees

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions