Class: Aspisec::Modules::Sqlmap

Inherits:
Aspisec::Module show all
Defined in:
lib-ruby/aspisec/modules/sqlmap.rb

Overview

Sqlmap module.
Inherits Aspisec::Module.

Examples:

# Get the global config
conf = Aspisec::Config.new.conf
# Create a Sqlmap module instance
sqlmap = Aspisec::Modules::Sqlmap.new(conf)
# Generic methods
sqlmap.name # => "sqlmap"
sqlmap.conf # => {…}
sqlmap.enabled? # => true
sqlmap.base # => #<Pathname:/home/noraj/.local/share/sqlmap>
sqlmap.locations_list # => ["history", "logs"]
sqlmap.locations # => [#<Aspisec::Module::Location …>, … ]
# Custom methods for the feature/file/directory location of Sqlmap to clean
sqlmap.history # => #<Aspisec::Module::Location …>
sqlmap.logs # => #<Aspisec::Module::Location …>
# But those custom locations benefits of generic methods
sqlmap.history.enabled? # => true
sqlmap.history.name # => => "history"
sqlmap.history.description # => "Directory containing…"
sqlmap.history.path => #<Pathname:/home/noraj/.local/share/sqlmap/history>
# Since `.path` returns a {Pathname} object, we can use generic {File},
# {FileTest} methods and some from {Dir} and {FileUtils} as well.
sqlmap.history.path.exist? # => true
sqlmap.history.path.file? # => false
sqlmap.history.path.directory? # => true
sqlmap.history.path.readable? # => true
sqlmap.history.path.children # => [#<Pathname:/home/noraj/.local/share/sqlmap/history/os.hst>, #<Pathname:…>]
sqlmap.history.path.children.first.size # => 10

See Also:

Instance Attribute Summary collapse

Attributes inherited from Aspisec::Module

#base, #conf, #locations_list, #name

Instance Method Summary collapse

Methods inherited from Aspisec::Module

#check_config, #enabled?, #locations

Constructor Details

#initialize(conf, logger: nil) ⇒ Sqlmap

Inherits from Aspisec::Module but has only the conf argument,
tool_name is hardcoded for each module.

Parameters:



50
51
52
53
54
55
# File 'lib-ruby/aspisec/modules/sqlmap.rb', line 50

def initialize(conf, logger: nil)
  super(conf, 'sqlmap', logger:)
  @history = Location.new(@conf, 'history')
  @logs = Location.new(@conf, 'logs')
  @locations_list = %w[history logs]
end

Instance Attribute Details

#historyLocation (readonly)

Returns:



41
42
43
# File 'lib-ruby/aspisec/modules/sqlmap.rb', line 41

def history
  @history
end

#logsLocation (readonly)

Returns:



45
46
47
# File 'lib-ruby/aspisec/modules/sqlmap.rb', line 45

def logs
  @logs
end