Skip to content

Commit

Permalink
Fixed impossibility to launch the script from outside its directory
Browse files Browse the repository at this point in the history
  • Loading branch information
simondotsh committed Jan 12, 2022
1 parent e765c5d commit f40cff7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions analysis/users/analyze.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env python3

from argparse import ArgumentParser
from os.path import isfile, expanduser
from os.path import join, dirname, realpath, isfile, expanduser
from json import load, dumps, decoder

COMPROMISED_FILE = 'principals_filter.txt'
FILTER_FILE = join(dirname(realpath(__file__)), 'principals_filter.txt')
REMOTE_ACCESS_RIDS = [544, 555, 580]
POTENTIAL_REMOTE_ACCESS_RIDS = [559, 562]

Expand Down Expand Up @@ -58,11 +58,11 @@ def get_principals(filter):
if not filter:
return []

if not isfile(COMPROMISED_FILE):
print(f'{COMPROMISED_FILE}: No such file.')
if not isfile(FILTER_FILE):
print(f'{FILTER_FILE}: No such file.')
exit(0)

with open(COMPROMISED_FILE) as f:
with open(FILTER_FILE) as f:
return f.read().lower().splitlines()

def get_remote_groups(groups, principals_filter):
Expand Down

0 comments on commit f40cff7

Please sign in to comment.