-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4055343
commit ddc7057
Showing
8 changed files
with
136 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# frozen_string_literal: true | ||
|
||
module Aspisec | ||
class Config | ||
module Configs | ||
HOME_HISTORY_FILES = { | ||
'enabled' => true, | ||
'location' => { | ||
'base' => '$HOME', # ~/ | ||
'python' => { | ||
'path' => '<base>/.python_history', | ||
'description' => "Python history file.\n" \ | ||
'Contains all commands entered in the Python REPL.' | ||
}, | ||
'postgresql' => { | ||
'path' => '<base>/.psql_history', | ||
'description' => "PostgreSQL history file.\n" \ | ||
'Contains all commands entered in the PostegreSQL shell.' | ||
}, | ||
'ruby-irb' => { | ||
'path' => '<base>/.irb_history', | ||
'description' => "Ruby (IRB) hitory file.\n" \ | ||
'Contains all commands entered in the Ruby REPL.' | ||
}, | ||
'ruby-rdbg' => { | ||
'path' => '<base>/.rdbg_history', | ||
'description' => "Ruby (rdbg) hitory file.\n" \ | ||
'Contains all commands entered in the Ruby debugger.' | ||
}, | ||
'redis-cli' => { | ||
'path' => '<base>/.rediscli_history', | ||
'description' => "Redis CLI history file.\n" \ | ||
'Contains all commands entered in the redis-cli shell.' | ||
}, | ||
'bash' => { | ||
'enabled' => false, | ||
'path' => '<base>/.bash_history', | ||
'description' => "Bash history file.\n" \ | ||
'Contains all commands entered in the Bash shell.' | ||
}, | ||
'zsh' => { | ||
'enabled' => false, | ||
'path' => '<base>/.zsh_history', | ||
'description' => "Zsh history file.\n" \ | ||
'Contains all commands entered in the Zsh shell.' | ||
}, | ||
'zsh-alt' => { | ||
'enabled' => false, | ||
'path' => '<base>/.histfile', | ||
'description' => "Zsh history file.\n" \ | ||
"Contains all commands entered in the Zsh shell.\n" \ | ||
'Alternative Zsh history file location set by zsh-newuser-install in HISTFILE ' \ | ||
'environment variable.' | ||
} | ||
} | ||
}.freeze | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'aspisec/module' | ||
|
||
module Aspisec | ||
module Modules | ||
# Module for various history files stored in the user home directory. | ||
# Inherits {Aspisec::Module}. | ||
# For more examples of methods, see {Aspisec::Modules::Sqlmap}. | ||
# @example | ||
# # Get the global config | ||
# conf = Aspisec::Config.new.conf | ||
# # Create a HomeHistoryFiles module instance | ||
# hhf = Aspisec::Modules::HomeHistoryFiles.new(conf) | ||
# # Locations available | ||
# hhf.locations_list # => ["python", "postgresql", "ruby_irb", "ruby_rdbg", "redis_cli", "bash", "zsh", "zsh_alt"] | ||
class HomeHistoryFiles < Aspisec::Module | ||
# see {Aspisec::Config::DEFAULT_CONFIG} or call {Aspisec::Module::Location#description}. | ||
# @return [Location] | ||
attr_reader :python | ||
|
||
# see {Aspisec::Config::DEFAULT_CONFIG} or call {Aspisec::Module::Location#description}. | ||
# @return [Location] | ||
attr_reader :postgresql | ||
|
||
# see {Aspisec::Config::DEFAULT_CONFIG} or call {Aspisec::Module::Location#description}. | ||
# @return [Location] | ||
attr_reader :ruby_irb | ||
|
||
# see {Aspisec::Config::DEFAULT_CONFIG} or call {Aspisec::Module::Location#description}. | ||
# @return [Location] | ||
attr_reader :ruby_rdbg | ||
|
||
# see {Aspisec::Config::DEFAULT_CONFIG} or call {Aspisec::Module::Location#description}. | ||
# @return [Location] | ||
attr_reader :redis_cli | ||
|
||
# see {Aspisec::Config::DEFAULT_CONFIG} or call {Aspisec::Module::Location#description}. | ||
# @return [Location] | ||
attr_reader :bash | ||
|
||
# see {Aspisec::Config::DEFAULT_CONFIG} or call {Aspisec::Module::Location#description}. | ||
# @return [Location] | ||
attr_reader :zsh | ||
|
||
# see {Aspisec::Config::DEFAULT_CONFIG} or call {Aspisec::Module::Location#description}. | ||
# @return [Location] | ||
attr_reader :zsh_alt | ||
|
||
# Inherits from {Aspisec::Module} but has only the `conf` argument, | ||
# `tool_name` is hardcoded for each module. | ||
# @param conf [Aspisec::Config] an instance of the global configuration | ||
def initialize(conf, logger: nil) | ||
super(conf, 'home-history-files', logger:) | ||
@python = Location.new(@conf, 'python') | ||
@postgresql = Location.new(@conf, 'postgresql') | ||
@ruby_irb = Location.new(@conf, 'ruby-irb') | ||
@ruby_rdbg = Location.new(@conf, 'ruby-rdbg') | ||
@redis_cli = Location.new(@conf, 'redis-cli') | ||
@bash = Location.new(@conf, 'bash') | ||
@zsh = Location.new(@conf, 'zsh') | ||
@zsh_alt = Location.new(@conf, 'zsh-alt') | ||
@locations_list = %w[python postgresql ruby_irb ruby_rdbg redis_cli bash zsh zsh_alt] | ||
end | ||
end | ||
end | ||
end |