forked from dirkjanm/ROADtools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from subprocess import Popen, PIPE, STDOUT | ||
import json | ||
import struct | ||
out = { | ||
"uri": "https://login.microsoftadaa.com?sso_nonce=abc", | ||
"p3pHeader": "CP=\"CAO DSP COR ADMa DEV CONo TELo CUR PSA PSD TAI IVDo OUR SAMi BUS DEM NAV STA UNI COM INT PHY ONL FIN PUR LOCi CNT\"", | ||
"flags": 8256 | ||
} | ||
text = json.dumps(out) | ||
lf = struct.pack('L', len(text)) | ||
output = lf + text.encode('utf-8') | ||
p = Popen(['python','browsercore.py'], stdout=PIPE, stdin=PIPE, stderr=PIPE) | ||
stdout_data = p.communicate(input=output) | ||
print(stdout_data[0]) | ||
print(stdout_data[1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from subprocess import Popen, PIPE, STDOUT | ||
import struct | ||
import json | ||
import sys | ||
import binascii | ||
import codecs | ||
from urllib.parse import urlparse, parse_qs | ||
from roadtools.roadlib.auth import Authentication | ||
with codecs.open('roadtx.prt', 'r','utf-8') as prtfile: | ||
prtdata = json.load(prtfile) | ||
prt = prtdata['refresh_token'] | ||
sessionkey = binascii.unhexlify(prtdata['session_key']) | ||
auth = Authentication(client_id = '1fec8e78-bce4-4aaf-ab1b-5451cc387264') | ||
lengthb = sys.stdin.buffer.read(4) | ||
length = struct.unpack('L', lengthb)[0] | ||
data = sys.stdin.buffer.read(length).decode('utf-8') | ||
request = json.loads(data) | ||
|
||
ups = urlparse(request["uri"]) | ||
qdata = parse_qs(ups.query) | ||
cookie = auth.create_prt_cookie_kdf_ver_2(prt, sessionkey, qdata["sso_nonce"]) | ||
out = { | ||
"response": [ | ||
{ | ||
"name": "x-ms-RefreshTokenCredential", | ||
"data": cookie, | ||
"p3pHeader": "CP=\"CAO DSP COR ADMa DEV CONo TELo CUR PSA PSD TAI IVDo OUR SAMi BUS DEM NAV STA UNI COM INT PHY ONL FIN PUR LOCi CNT\"", | ||
"flags": 8256 | ||
} | ||
] | ||
} | ||
text = json.dumps(out) | ||
lf = struct.pack('L', len(text)) | ||
sys.stdout.buffer.write(lf + text.encode('utf-8')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "com.microsoft.browsercore", | ||
"description": "BrowserCore", | ||
"path": "BrowserCore.py", | ||
"type": "stdio", | ||
"allowed_origins": [ | ||
"chrome-extension://ppnbnpeolgkicgegkbkbjmhlideopiji/", | ||
"chrome-extension://ndjpnladcallmjemlbaebfadecfhkepb/" | ||
] | ||
} |