Merge pull request #6 from bmrodrigues/main

Latest MDEcli version
This commit is contained in:
Bruno Rodrigues 2021-11-22 14:02:35 +00:00 коммит произвёл GitHub
Родитель 4606e30cb2 ec2b57bae0
Коммит f477b1212d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 17 добавлений и 18 удалений

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

@ -24,7 +24,6 @@ try:
tenantid = input('Please enter your Tenant ID: ')
appid = input('Please enter your Application ID: ')
secret = getpass.getpass('Please enter your Application Secret:')
webhook = getpass.getpass('Please enter your webhook from Teams: ')
new_token = gettoken.GetToken(tenantid, appid, secret)
new_token.gettoken()
token = new_token.aadToken
@ -33,14 +32,12 @@ try:
if args.Commands == 'actions':
if args.offboard:
filename = input('Please enter the CSV filename (export from MDE/Devices): ')
comment = input('COmment (mandatory): ')
comment = input('Comment (mandatory): ')
new_csv = read.Csv(filename)
new_csv.open()
for ids in new_csv.list_ids:
new_offboard = offboard.Offboard(token, ids, comment)
new_offboard.offboard()
print(new_offboard.results)
new_offboard_action = offboard.Offboard(token, ids, comment)
new_offboard_action.offboard()
elif args.quick:
print("Let's quick scan")
else:

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

@ -9,6 +9,7 @@ class Offboard:
self.comment = comment
def offboard(self):
try:
url = f"https://api.securitycenter.microsoft.com/api/machines/{self.id}/offboard"
headers = {
'Content-Type' : 'application/json',
@ -21,5 +22,6 @@ class Offboard:
req = urllib.request.Request(url, data, headers)
response = urllib.request.urlopen(req)
jsonResponse = json.loads(response.read())
self.results = jsonResponse["Results"]
return self.results
print(jsonResponse)
except Exception as e:
print(e)