This commit is contained in:
Bruno Rodrigues 2021-11-23 10:07:50 +00:00 коммит произвёл GitHub
Родитель 4879834834
Коммит 20ed10c654
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 0 добавлений и 54 удалений

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

@ -1,14 +0,0 @@
import getpass
from mdeapi import gettoken
#Login token
try:
tenantid = input('Please enter your Tenant ID: ')
appid = input('Please enter your Application ID: ')
secret = getpass.getpass('Please enter your Application Secret:')
new_token = gettoken.GetToken(tenantid, appid, secret)
new_token.gettoken()
token = new_token.aadToken
print(token)
except Exception as e:
print(e)

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

@ -1,8 +0,0 @@
import jwt
from aadtoken import get_public_key
token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Imwzc1EtNTBjQ0g0eEJWWkxIVEd3blNSNzY4MCIsImtpZCI6Imwzc1EtNTBjQ0g0eEJWWkxIVEd3blNSNzY4MCJ9.eyJhdWQiOiJodHRwczovL2FwaS5zZWN1cml0eWNlbnRlci5taWNyb3NvZnQuY29tIiwiaXNzIjoiaHR0cHM6Ly9zdHMud2luZG93cy5uZXQvNzViM2U3ZjYtMmUyNC00ZmIwLThlODQtZWM5ZTU4N2M4ZDRjLyIsImlhdCI6MTYzNDY4NzcwMywibmJmIjoxNjM0Njg3NzAzLCJleHAiOjE2MzQ2OTE2MDMsImFpbyI6IkUyWmdZR0RNOFREcCtOckN1SE1oajNISzA3b0RBQT09IiwiYXBwX2Rpc3BsYXluYW1lIjoiTURFY2xpIiwiYXBwaWQiOiI2M2IyMzI5MS04ZTExLTRlMWItYjEwMi05ZTVhZDA5OGFmNmUiLCJhcHBpZGFjciI6IjEiLCJpZHAiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC83NWIzZTdmNi0yZTI0LTRmYjAtOGU4NC1lYzllNTg3YzhkNGMvIiwib2lkIjoiNGYyOWJhN2UtZDNlZS00ZTFhLWExNzItZjZmNWE0Nzg1ZjFkIi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idmVyIjoiMS4wIn0.EtqOEjwTPANOmLceJeE0KFoqTWgZWy8xIlNe9JT6GkCBQii8k0qHiDJLwmRAJ_fjtwBZD_aRw4QNpEdjwKODbptQhBLq4INmslhScluBH2FyXmyunACrsDWxDso4jSbvi-c9kUgwHfGoN7R2jYzVPbAulAYyRmFHTBfxfLwbjTSGFPjhGHN7-A5pIr7MWyeCQC1ocPmBgd0rGmZ-hblB84H4mjZCNr-Ib1io9pwbCCGEF78p3WiHnQErS7gL-2y6QvE3Ms-nwnx3rs64cSBCXF6bB7Hnbn2vMsuTkyJNeEG4mwGD6FznXHVuRdoXk9Q1ZlNiKNIhyDyZsSr-Brac7g"
token_header = jwt.get_unverified_header(token)
print(token_header)

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

@ -1,30 +0,0 @@
import json
import urllib.request
import urllib.parse
class GetToken:
def __init__(self, tenantId, appId, appSecret):
self.tenantId = tenantId
self.appId = appId
self.appSecret = appSecret
def gettoken(self):
url = "https://login.microsoftonline.com/%s/oauth2/token" % (self.tenantId)
resourceAppIdUri = 'https://api.securitycenter.microsoft.com'
body = {
'resource' : resourceAppIdUri,
'client_id' : self.appId,
'client_secret' : self.appSecret,
'grant_type' : 'client_credentials'
}
data = urllib.parse.urlencode(body).encode("utf-8")
req = urllib.request.Request(url, data)
response = urllib.request.urlopen(req)
jsonResponse = json.loads(response.read())
self.aadToken = jsonResponse["access_token"]
return self.aadToken

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

@ -1,2 +0,0 @@
getpass4
jwt