Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new feature to CLI to show paths for the system #8

Merged
merged 1 commit into from
Jan 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions integrityguard/cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import sys
import click
from integrityguard.helpers.loadconfig import load_config
from integrityguard.helpers.showpaths import show_paths
from integrityguard.hashreport import hash_report
from integrityguard.monitor import monitor

Expand All @@ -18,7 +19,6 @@
@click.option('--target', default=path, help='Target path to monitor')
@click.option('--hash', default=hash_type, help='Hash algorithm type (MD5, SHA1, SHA224, SHA256, SHA384, and SHA512).')


def main(task,target,hash):

"""Console script for IntegrityGuard."""
Expand All @@ -27,7 +27,8 @@ def main(task,target,hash):
hash_report()
elif task == "monitor":
monitor()

elif task == "show_paths":
show_paths()
return 0

if __name__ == "__main__":
Expand Down
23 changes: 23 additions & 0 deletions integrityguard/helpers/showpaths.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import configparser
from appdirs import *
from colorama import init, Fore, Back, Style
import os

def show_paths(config_path=None):

# Identify OS config default path
os_dirs = AppDirs("IntegrityGuard", "IntegrityGuard")

# Define default config file path
config_file = os.path.join(os_dirs.user_config_dir, "integrityguard.conf")

# Check if the user provided a config path
if config_path != None:
config_file = os.path.abspath(config_path)

# Print basic instructions for the user
print(Fore.GREEN + "See important information below:")
print(Fore.YELLOW + "Default config file path: " + config_file )
print(Fore.YELLOW + "Default hashes store path: " + os.path.join(os_dirs.user_data_dir, "hashes.json") )

return True