Коммит
a1ce2203f8
|
@ -14,9 +14,6 @@ class List:
|
||||||
'Accept' : 'application/json',
|
'Accept' : 'application/json',
|
||||||
'Authorization' : "Bearer " + self.token
|
'Authorization' : "Bearer " + self.token
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
req = urllib.request.Request(url, headers=headers)
|
req = urllib.request.Request(url, headers=headers)
|
||||||
response = urllib.request.urlopen(req)
|
response = urllib.request.urlopen(req)
|
||||||
self.jsonResponse = json.loads(response.read())
|
self.jsonResponse = json.loads(response.read())
|
||||||
|
|
|
@ -6,7 +6,7 @@ from MDEAPI import list
|
||||||
from TEAMS import send2teams
|
from TEAMS import send2teams
|
||||||
|
|
||||||
#menu argparser
|
#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')
|
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()
|
args = parser.parse_args()
|
||||||
|
@ -33,7 +33,7 @@ try:
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
|
|
||||||
#Loop - keep running
|
#infinite loop
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
new_events = list.List(token, f'{args.list}')
|
new_events = list.List(token, f'{args.list}')
|
||||||
|
@ -42,17 +42,16 @@ while True:
|
||||||
if events_list == baseline_list:
|
if events_list == baseline_list:
|
||||||
print(f'No new {args.list}')
|
print(f'No new {args.list}')
|
||||||
else:
|
else:
|
||||||
diff = [i for i in events_list if i not in baseline_list]
|
for dict in events_list:
|
||||||
message = f'{args.list} - {str(diff)}'
|
if dict not in baseline_list:
|
||||||
new_message_teams = send2teams.Send2teams(webhook, message)
|
new_teams_message = send2teams.Send2teams(webhook, dict)
|
||||||
new_message_teams.send2teams()
|
new_teams_message.send2teams()
|
||||||
print(f'{args.list} sent to Teams')
|
print('Message sent to Teams Channel')
|
||||||
update_baseline = list.List(token, f'{args.list}')
|
update_baseline = list.List(token, f'{args.list}')
|
||||||
update_baseline.list()
|
update_baseline.list()
|
||||||
baseline_list = update_baseline.jsonResponse['value']
|
baseline_list = update_baseline.jsonResponse['value']
|
||||||
local_time = time.ctime()
|
local_time = time.ctime()
|
||||||
print(local_time)
|
print(local_time)
|
||||||
time.sleep(120)
|
time.sleep(120)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче