an instance of the global configuration
If none is provided, the default config is loaded.
@@ -458,8 +481,8 @@
—
-
logger instance. See Logger.
-If none is provided, a default logger with log level 2 is created.
+
logger instance. See Logger.
+If none is provided, a default logger with log level 2 is created.
See Logger::LOG_LEVEL.
@@ -519,8 +542,8 @@
-
Main method, handling the cleaning.
-Only enabled modules and locations will be removed.
+
Main method, handling the cleaning.
+Only enabled modules and locations will be removed.
Works either with auto-cleaning or ask for manual confirmation.
Calculate directory size (size of all files stored in it).
-It will be the real size of files not the size on disk.
-It ignores anything else than files so it could be wrong for symlinks, mounts, etc.
+
Calculate directory size (size of all files stored in it).
+It will be the real size of files not the size on disk.
+It ignores anything else than files so it could be wrong for symlinks, mounts, etc.
It also don't take into consideration the size of the directory itself.
Display location (file or directory) information and prompt user for deletion
+
Display location (file or directory) information and prompt user for deletion
It will follow the configuration wether it has to display the description or not.
@@ -1095,7 +1118,7 @@
puts "——— #{@painter.decorate(location.name, :cyan, :bold)} ———"
puts_decorated('Path', location.path.to_s)
puts_decorated('Type', file_type(location.path))
- puts_decorated('Size', type_size(location.path))
+ puts_decorated('Size', type_size_human(location.path))
puts_decorated('Description', location.description) if@describe@prompt.yes?("Do you want to remove #{location.name}?")
end
@@ -1236,23 +1259,29 @@
# File 'lib-ruby/aspisec/clean.rb', line 112deftype_delete(path)
+ @logger.warn("The current user doesn't have permission to remove #{path}") unless path.writable?
if path.directory?
path.rmtree
- else
+ elsif path.file?
path.delete
+ else# for example when the location contains glogging representing multiple files
+ Dir[path].map { |path| Pathname.new(path).delete }
endnilend
# File 'lib-ruby/aspisec/config.rb', line 192defself.expand_path_variables(path)
return path unless path.is_a?(String) # not a path, let untouched
@@ -941,31 +807,31 @@
{
+ 'enabled' => true,
+ 'location' => {
+ 'base' => '$XDG_DATA_HOME/hashcat', # ~/.local/share/hashcat
+ 'sessions' => {
+ 'path' => '<base>/sessions',
+ 'enaled' => false,
+ 'description' => "Directory containing session related data.\n" \
+ 'hashcat.log should not contain any sensible data unless the file name ' \
+ "of a target file is sensible.\n" \
+ 'show.log should not contain any sensible data unless the folder name is sensible.'
+ },
+ 'potfile' => {
+ 'path' => '<base>/hashcat.potfile',
+ 'description' => "File containing all cracked hashes.\n" \
+ 'Passwords may include enterprize related content or may be easily recognizable.'
+ },
+ 'dict_cache' => {
+ 'path' => '<base>/hashcat.dictstat2',
+ 'enabled' => false,
+ 'description' => "File is a cache for dictionaries.\n" \
+ 'It should not be sensible unless dict. contain confidential data.'
+ }
+ }
+}.freeze
{
+ 'enabled' => true,
+ 'location' => {
+ 'base' => '$HOME/.mongodb/compass', # ~/.mongodb/compass
+ 'logs' => {
+ 'path' => '<base>/*_log.gz',
+ 'description' => "Compressed log files.\n" \
+ 'Credentials are redacted but logs still contain IP and port.'
+ }
+ }
+}.freeze
+
+
MONGODB_MONGOSH =
+
+
+
{
+ 'enabled' => true,
+ 'location' => {
+ 'base' => '$HOME/.mongodb/mongosh', # ~/.mongodb/mongosh
+ 'logs' => {
+ 'path' => '<base>/*_log',
+ 'description' => "Log files.\n" \
+ 'Contain at least information about target (IP, port).'
+ },
+ 'history' => {
+ 'path' => '<base>/mongosh_repl_history',
+ 'description' => "History file.\n" \
+ 'Contain the history of commands typed in mongosh shell.'
+ }
+ }
+}.freeze
+
+
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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/ruby/Aspisec/Logger.html b/docs/ruby/Aspisec/Logger.html
index 862ea51..47d5f7e 100644
--- a/docs/ruby/Aspisec/Logger.html
+++ b/docs/ruby/Aspisec/Logger.html
@@ -356,7 +356,7 @@
Check if the location exist (weither it's a file, directory or a path contaning globbing so multiple files / directories).
+
+
@@ -313,7 +336,7 @@
—
-
Name of the feature/file/directory to clean.
+
Name of the feature/file/directory to clean.
Must be equal to the configuration key.
@@ -585,6 +608,92 @@
+
+
+
+
+
+ #exist? ⇒ true|false
+
+
+
+
+
+
+
+
Check if the location exist (weither it's a file, directory or a path contaning globbing so
+multiple files / directories).
+loc.path.exist? will return false when a path contains globbing as it's not expended,
+that's the main reason for creating the loc.exist? helper.
This Ruby module contains all Aspisec modules.
-Each Aspisec module is a Ruby class inherinting the Aspisec::Module base class.
+
This Ruby module contains all Aspisec modules.
+Each Aspisec module is a Ruby class inherinting the Aspisec::Module base class.
The "Modules" module also contains methods to manage all Aspisec modules.
# Get the global config
+conf = Aspisec::Config.new.conf
+# Create a Amass module instance
+ama = Aspisec::Modules::Amass.new(conf)
+# Locations available
+ama.locations_list # => ["logs", "database"]
Bloodhound module.
+Inherits Aspisec::Module.
+For more examples of methods, see Sqlmap.
+
+
+
+
+
+
+
+
Examples:
+
+
+
# Get the global config
+conf = Aspisec::Config.new.conf
+# Create a Bloodhound module instance
+blh = Aspisec::Modules::Bloodhound.new(conf)
+# Locations available
+blh.locations_list # => ["database", "transactions"]
# File 'lib-ruby/aspisec/modules/bloodhound.rb', line 25
+
+deftransactions
+ @transactions
+end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/ruby/Aspisec/Modules/Crackmapexec.html b/docs/ruby/Aspisec/Modules/Crackmapexec.html
index 2843be9..91922c2 100644
--- a/docs/ruby/Aspisec/Modules/Crackmapexec.html
+++ b/docs/ruby/Aspisec/Modules/Crackmapexec.html
@@ -103,8 +103,8 @@
dbgate module.
+Inherits Aspisec::Module.
+For more examples of methods, see Sqlmap.
+
+
+
+
+
+
+
+
Examples:
+
+
+
# Get the global config
+conf = Aspisec::Config.new.conf
+# Create a Dbgate module instance
+dbg = Aspisec::Modules::Dbgate.new(conf)
+# Locations available
+dbg.locations_list # => ["connections", "logs"]
# Get the global config
+conf = Aspisec::Config.new.conf
+# Create a Ffuf module instance
+ffu = Aspisec::Modules::Ffuf.new(conf)
+# Locations available
+ffu.locations_list # => ["history"]
# File 'lib-ruby/aspisec/modules/ffuf.rb', line 21
+
+defhistory
+ @history
+end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/ruby/Aspisec/Modules/Hashcat.html b/docs/ruby/Aspisec/Modules/Hashcat.html
index 35df013..7e6e0a1 100644
--- a/docs/ruby/Aspisec/Modules/Hashcat.html
+++ b/docs/ruby/Aspisec/Modules/Hashcat.html
@@ -103,8 +103,8 @@
# File 'lib-ruby/aspisec/modules/home_history_files.rb', line 48
+
+defzsh_alt
+ @zsh_alt
+end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/ruby/Aspisec/Modules/John.html b/docs/ruby/Aspisec/Modules/John.html
index b9547e4..bbb6f1e 100644
--- a/docs/ruby/Aspisec/Modules/John.html
+++ b/docs/ruby/Aspisec/Modules/John.html
@@ -103,8 +103,8 @@
lsassy module.
+Inherits Aspisec::Module.
+For more examples of methods, see Sqlmap.
+
+
+
+
+
+
+
+
Examples:
+
+
+
# Get the global config
+conf = Aspisec::Config.new.conf
+# Create a Lsassy module instance
+lsa = Aspisec::Modules::Lsassy.new(conf)
+# Locations available
+lsa.locations_list # => ["masterkeys", "tickets"]
# File 'lib-ruby/aspisec/modules/lsassy.rb', line 25
+
+deftickets
+ @tickets
+end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/ruby/Aspisec/Modules/Manspider.html b/docs/ruby/Aspisec/Modules/Manspider.html
index 5dd2c91..68368c6 100644
--- a/docs/ruby/Aspisec/Modules/Manspider.html
+++ b/docs/ruby/Aspisec/Modules/Manspider.html
@@ -103,8 +103,8 @@
MongoDB Compass module.
+Inherits Aspisec::Module.
+For more examples of methods, see Sqlmap.
+
+
+
+
+
+
+
+
Examples:
+
+
+
# Get the global config
+conf = Aspisec::Config.new.conf
+# Create a MongodbCompass module instance
+mdc = Aspisec::Modules::MongodbCompass.new(conf)
+# Locations available
+mdc.locations_list # => ["logs"]
MongoDB Shell (mongosh) module.
+Inherits Aspisec::Module.
+For more examples of methods, see Sqlmap.
+
+
+
+
+
+
+
+
Examples:
+
+
+
# Get the global config
+conf = Aspisec::Config.new.conf
+# Create a MongodbMongosh module instance
+msh = Aspisec::Modules::MongodbMongosh.new(conf)
+# Locations available
+msh.locations_list # => ["logs", "history"]
ncrack module.
+Inherits Aspisec::Module.
+For more examples of methods, see Sqlmap.
+
+
+
+
+
+
+
+
Examples:
+
+
+
# Get the global config
+conf = Aspisec::Config.new.conf
+# Create a Ncrack module instance
+ncr = Aspisec::Modules::Ncrack.new(conf)
+# Locations available
+ncr.locations_list # => ["restore"]
# File 'lib-ruby/aspisec/modules/ncrack.rb', line 21
+
+defrestore
+ @restore
+end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/ruby/Aspisec/Modules/Netexec.html b/docs/ruby/Aspisec/Modules/Netexec.html
index 90f4b97..310ebf7 100644
--- a/docs/ruby/Aspisec/Modules/Netexec.html
+++ b/docs/ruby/Aspisec/Modules/Netexec.html
@@ -103,8 +103,8 @@
# Get the global config
+conf = Aspisec::Config.new.conf
+# Create a Recaf module instance
+rec = Aspisec::Modules::Recaf.new(conf)
+# Locations available
+rec.locations_list # => ["classpath", "logs"]
Remmina module.
+Inherits Aspisec::Module.
+For more examples of methods, see Sqlmap.
+
+
+
+
+
+
+
+
Examples:
+
+
+
# Get the global config
+conf = Aspisec::Config.new.conf
+# Create a Remmina module instance
+rem = Aspisec::Modules::Remmina.new(conf)
+# Locations available
+rem.locations_list # => ["configs"]
Semgrep module.
+Inherits Aspisec::Module.
+For more examples of methods, see Sqlmap.
+
+
+
+
+
+
+
+
Examples:
+
+
+
# Get the global config
+conf = Aspisec::Config.new.conf
+# Create a Semgrep module instance
+smg = Aspisec::Modules::Semgrep.new(conf)
+# Locations available
+smg.locations_list # => ["logs1", "logs2"]
Spiderfoot module.
+Inherits Aspisec::Module.
+For more examples of methods, see Sqlmap.
+
+
+
+
+
+
+
+
Examples:
+
+
+
# Get the global config
+conf = Aspisec::Config.new.conf
+# Create a Spiderfoot module instance
+spf = Aspisec::Modules::Spiderfoot.new(conf)
+# Locations available
+spf.locations_list # => ["database", "logs"]
# File 'lib-ruby/aspisec/modules/spiderfoot.rb', line 25
+
+deflogs
+ @logs
+end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/ruby/Aspisec/Modules/Sqlmap.html b/docs/ruby/Aspisec/Modules/Sqlmap.html
index a9e0d73..9c39ab5 100644
--- a/docs/ruby/Aspisec/Modules/Sqlmap.html
+++ b/docs/ruby/Aspisec/Modules/Sqlmap.html
@@ -103,7 +103,7 @@
WhatWaf module.
+Inherits Aspisec::Module.
+For more examples of methods, see Sqlmap.
+
+
+
+
+
+
+
+
Examples:
+
+
+
# Get the global config
+conf = Aspisec::Config.new.conf
+# Create a Whatwaf module instance
+whw = Aspisec::Modules::Whatwaf.new(conf)
+# Locations available
+whw.locations_list # => ["database"]
# File 'lib-ruby/aspisec/modules/whatwaf.rb', line 21
+
+defdatabase
+ @database
+end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/ruby/_index.html b/docs/ruby/_index.html
index 1bdddc3..755cad7 100644
--- a/docs/ruby/_index.html
+++ b/docs/ruby/_index.html
@@ -113,6 +113,13 @@
Locations now support globbing, useful when needing to remove several files in a directory while not removing the whole directory (e.g. log files with rotation in the same directory as the configuration file)
+
+
+
Quality
The configuration now has a version and there are several checks to detected mismatch between the configuration version and the tool version. This prevents the user performing complex debugging after an update.
+
Warns the user when a location is not deletable (lack of permissions).
+
+
+
UX
+
+
More compact display of aspisec list. As the list of modules is growing, the output is longer, displayed on several screens, requiring to scroll while being a very thin column. That was really a waste of space. The new compact display better optimizes the usage of space. Now there is one module per line and all locations are displayed horizontally (2D) rather than vertically under the module (1D).
-
[0.0.2]
+
[0.0.2]
Change from xdg dependency to sxdg, allowing support for Ruby 3.1 and 3.2 as well as 3.3.
Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
+
Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
-
The above copyright notice and this permission notice shall be included in all
+
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Nettoyage à l'aspirateur des restes d'outils offensifs. AspiSec est chargé de supprimer les traces et informations confidentielles laissées par les outils de sécurité offensive sur l'ordinateur d'un auditeur dans divers fichiers de cache et de journalisation.
Vacuuming out the remnants of offensive tools. AspiSec is responsible for removing the traces and confidential information left by offensive security tools on an auditor's computer in various cache and log files.
When no configuration file exists, Aspisec will automatically create a default one under $XDG_CONFIG_HOME/aspisec/aspisec.config.yaml (which will typically be ~/.config/aspisec/aspisec.config.yaml).
aspisec.autoclean.enabled allows you to choose between:
interactive mode: (false, default) ask confirmation (Y/n) before removing each location
automatic mode: (true) auto clean, remove files without asking confirmation
-
Description
+
Description
aspisec.describe.enabled controls if the description for each location is displayed or not. If you already know what everything is doing, disabling it allows having a lighter output.
-
Modules
-
Disabling
+
Modules
+
Disabling
Each module can be separately disabled, e.g. <tool>.enabled so it will not be taken into consideration while cleaning.
-
Locations
-
Each module will look for the files from a default location which is the most common.
+
Locations
+
Each module will look for the files from a default location which is the most common.
But if you have deployed the tool in an uncommon location (exotic distribution, git clone in random places) or a custom location (under /opt), you can change the location where Aspisec will look for, e.g. <tool>.location.base.
Aspisec is using standard XDG Base Directory variables like $XDG_DATA_HOME to be more cross-platform. But you could use an absolute path if you don't need your config to be portable, e.g. /home/noraj/.local/share/sqlmap instead of $XDG_DATA_HOME/sqlmap.
For each location (feature, file, directory) you can configure the path too (<tool>.location.<lcoation>.path) but it's very unlikely you would need to. <base> is a keyword resolved by Aspisec refering to <tool>.location.base. You could change the location description too if you want it to be shorter or to add emojis.
-
Audit
+
Audit
The audit section is unused and is just a placeholder for future features.
?> Note: You can check log / verbosity levels here.
-
Cleaning
+
Cleaning
Starting the cleaning is as easy as that:
$ aspisec clean
By default, it will be interactive, the description of each file / directory will be displayed, etc. If you want to change the default behavior, see config.
Of course, Aspisec::Config manages the configuration and Aspisec::Logger the logger (level of additional information displayed).
Aspisec::Module is a generic module class with core methods and properties. Aspisec::Module::Location is a generic location subclass. A location is either a file or directory handled by modules.
Vacuuming out the remnants of offensive tools. AspiSec is responsible for removing the traces and confidential information left by offensive security tools on an auditor's computer in various cache and log files.
diff --git a/lib-ruby/aspisec/version.rb b/lib-ruby/aspisec/version.rb
index ac4618a..032ee24 100644
--- a/lib-ruby/aspisec/version.rb
+++ b/lib-ruby/aspisec/version.rb
@@ -2,5 +2,5 @@
module Aspisec
# Version of aspisec library and app
- VERSION = '0.0.2'
+ VERSION = '0.1.0'
end