Merge pull request #11 from bmrodrigues/main

V1 stable push
This commit is contained in:
Bruno Rodrigues 2022-01-10 22:40:23 +00:00 коммит произвёл GitHub
Родитель d47333e40e f15a0482e9
Коммит a1ce2203f8
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 11 добавлений и 15 удалений

Просмотреть файл

@ -14,9 +14,6 @@ class List:
'Accept' : 'application/json',
'Authorization' : "Bearer " + self.token
}
req = urllib.request.Request(url, headers=headers)
response = urllib.request.urlopen(req)
self.jsonResponse = json.loads(response.read())

Просмотреть файл

@ -6,7 +6,7 @@ from MDEAPI import list
from TEAMS import send2teams
#menu argparser
parser = argparse.ArgumentParser(description='MDE4Teams = A tool to track MDE events in Teams', epilog='Original project created by Bruno Rodrigues - rodrigues.bruno@microsoft.com')
parser = argparse.ArgumentParser(prog='app.py', description='MDE4Teams = A tool to track MDE events in Teams', epilog='Original project created by Bruno Rodrigues - rodrigues.bruno@microsoft.com')
parser.add_argument('list', choices=['alerts', 'investigations', 'indicators', 'machines', 'machineactions', 'recommendations', 'Software', 'vulnerabilities'], help='Select which notifications to List in Teams')
args = parser.parse_args()
@ -33,7 +33,7 @@ try:
except Exception as e:
print(e)
#Loop - keep running
#infinite loop
while True:
try:
new_events = list.List(token, f'{args.list}')
@ -42,17 +42,16 @@ while True:
if events_list == baseline_list:
print(f'No new {args.list}')
else:
diff = [i for i in events_list if i not in baseline_list]
message = f'{args.list} - {str(diff)}'
new_message_teams = send2teams.Send2teams(webhook, message)
new_message_teams.send2teams()
print(f'{args.list} sent to Teams')
update_baseline = list.List(token, f'{args.list}')
update_baseline.list()
baseline_list = update_baseline.jsonResponse['value']
for dict in events_list:
if dict not in baseline_list:
new_teams_message = send2teams.Send2teams(webhook, dict)
new_teams_message.send2teams()
print('Message sent to Teams Channel')
update_baseline = list.List(token, f'{args.list}')
update_baseline.list()
baseline_list = update_baseline.jsonResponse['value']
local_time = time.ctime()
print(local_time)
time.sleep(120)
except Exception as e:
print(e)
print(e)