GithubHelp home page GithubHelp logo

Not able to get this working about azvalidate HOT 9 CLOSED

lmvdz avatar lmvdz commented on June 17, 2024
Not able to get this working

from azvalidate.

Comments (9)

lmvdz avatar lmvdz commented on June 17, 2024
import requests
import os

from dotenv import load_dotenv, find_dotenv

load_dotenv(find_dotenv())



mgraphSecret = os.getenv('GRAPH_SECRET')
mgraphAppID = os.getenv('GRAPH_APP_ID')
mgraphTenant = os.getenv('TENANT_ID')

api_url = "https://login.microsoftonline.com/" + mgraphTenant + "/oauth2/token"

data = {
    'resource': 'https://adnotifications.windowsazure.com/StrongAuthenticationService.svc/Connector',
    'client_id': mgraphAppID,
    'scope': 'openid',
    'client_secret': mgraphSecret,
    'grant_type': 'client_credentials',
}
response = requests.post(url=api_url, data=data)
response_data = response.json()
access_token = response_data['access_token']

emailAddressToPush = "[email protected]"

xml = '<BeginTwoWayAuthenticationRequest> \
<Version>1.0</Version>\
<UserPrincipalName>' + emailAddressToPush + '</UserPrincipalName>\
<Lcid>en-us</Lcid> \
<AuthenticationMethodProperties xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> \
<a:KeyValueOfstringstring> \
<a:Key>OverrideVoiceOtp</a:Key> \
<a:Value>true</a:Value> \
</a:KeyValueOfstringstring> \
</AuthenticationMethodProperties> \
<ContextId>69ff05bf-eb61-47f7-a70e-e7d77b6d47d0</ContextId> \
<SyncCall>true</SyncCall> \
<RequireUserMatch>true</RequireUserMatch> \
<CallerName>Pritunl Authy</CallerName> \
<CallerIP>UNKNOWN:</CallerIP> \
</BeginTwoWayAuthenticationRequest>'

response = requests.post(url="https://adnotifications.windowsazure.com/StrongAuthenticationService.svc/Connector//BeginTwoWayAuthentication", headers={"Authorization": "Bearer " + access_token, "Content-Type": "application/xml"}, data = xml)

print(response.content)

from azvalidate.

lmvdz avatar lmvdz commented on June 17, 2024

The server encountered an error processing the request. See server logs for more details.

from azvalidate.

lmvdz avatar lmvdz commented on June 17, 2024

image

from azvalidate.

KelvinTegelaar avatar KelvinTegelaar commented on June 17, 2024

i honestly have no clue. You seem to be missing a lot of code though, such as using the correct spn and generating password.

But, this is a powershell solution, not a python solution. Im not really sure why you are asking for help here.

As they say on the internet, Sir, this is a wendys

from azvalidate.

lmvdz avatar lmvdz commented on June 17, 2024

Can you confirm that the powershell script is still working?

from azvalidate.

KelvinTegelaar avatar KelvinTegelaar commented on June 17, 2024

Yup

from azvalidate.

lmvdz avatar lmvdz commented on June 17, 2024

Where does the RefreshToken and Genpass token come from? I have an AppID and AppSecret

Also what does spn stand for?

from azvalidate.

KelvinTegelaar avatar KelvinTegelaar commented on June 17, 2024

You can check out the docs here https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow

from azvalidate.

lwhitelock avatar lwhitelock commented on June 17, 2024

Here is a version I made which only uses graph requests which might be easier to convert https://github.com/lwhitelock/AzValidate-1
and here is an improved version I tweaked for CIPP https://github.com/KelvinTegelaar/CIPP-API/blob/master/ExecSendPush/run.ps1

from azvalidate.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.