BishopFox / GitGot

Semi-automated, feedback-driven tool to rapidly search through troves of public data on GitHub for sensitive secrets.
GNU Lesser General Public License v3.0
1.45k stars 207 forks source link

Use it from any working directory #5

Closed lynch-a closed 5 years ago

lynch-a commented 5 years ago

It can be helpful for command line tools to run reliably regardless of the current working directory, GitGot looks in "/checks/default.list" for its default list of regexes, which fails unless "checks/default.list" exists in your current directory.

Reproduction

sudo ln -s <Your_Path>/GitGot/gitgot.py /usr/bin/gitgot
cd ~ # navigate to directory where checks/default.list does not exist
gitgot -q test

Traceback:

Traceback (most recent call last):
  File "GitGot/gitgot.py", line 365, in <module>
    main()
  File "GitGot/gitgot.py", line 359, in main
    state = regex_validator(args, state)
  File "GitGot/gitgot.py", line 274, in regex_validator
    with open(args.checks, "r") as fd:
FileNotFoundError: [Errno 2] No such file or directory: 'checks/default.list'

In this case, the full path to the "default.list" file would have to be provided, despite -f being an optional parameter.

The log and state folders appear interact nicely with the working directory.