pyntcli 0.1.112__py3-none-any.whl → 0.1.113__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ignoreTests/auth/login.py +1 -1
- pyntcli/__init__.py +1 -1
- pyntcli/auth/login.py +23 -14
- {pyntcli-0.1.112.dist-info → pyntcli-0.1.113.dist-info}/METADATA +1 -1
- {pyntcli-0.1.112.dist-info → pyntcli-0.1.113.dist-info}/RECORD +8 -8
- {pyntcli-0.1.112.dist-info → pyntcli-0.1.113.dist-info}/WHEEL +0 -0
- {pyntcli-0.1.112.dist-info → pyntcli-0.1.113.dist-info}/entry_points.txt +0 -0
- {pyntcli-0.1.112.dist-info → pyntcli-0.1.113.dist-info}/top_level.txt +0 -0
ignoreTests/auth/login.py
CHANGED
pyntcli/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.1.
|
|
1
|
+
__version__ = "0.1.113"
|
pyntcli/auth/login.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import random
|
|
2
|
+
import string
|
|
1
3
|
from base64 import b64decode
|
|
2
4
|
import webbrowser
|
|
3
|
-
import uuid
|
|
4
5
|
import urllib.parse
|
|
5
6
|
import datetime
|
|
6
7
|
import time
|
|
@@ -28,6 +29,8 @@ PYNT_ID = "PYNT_ID"
|
|
|
28
29
|
PYNT_CREDENTIALS = "PYNT_CREDENTIALS"
|
|
29
30
|
PYNT_SAAS = os.environ.get("PYNT_SAAS_URL") if os.environ.get(
|
|
30
31
|
"PYNT_SAAS_URL") else "https://api.pynt.io/v1"
|
|
32
|
+
PYNT_APP_URL = os.environ.get("PYNT_APP_URL") if os.environ.get(
|
|
33
|
+
"PYNT_APP_URL") else "https://app.pynt.io"
|
|
31
34
|
PYNT_BUCKET_NAME = os.environ.get(
|
|
32
35
|
"PYNT_BUCKET_NAME") if os.environ.get("PYNT_BUCKET_NAME") else ""
|
|
33
36
|
PYNT_PARAM1 = os.environ.get(
|
|
@@ -36,18 +39,24 @@ PYNT_PARAM2 = os.environ.get(
|
|
|
36
39
|
"PYNT_PARAM2") if os.environ.get("PYNT_PARAM2") else ""
|
|
37
40
|
|
|
38
41
|
|
|
42
|
+
def generate_device_code() -> str:
|
|
43
|
+
"""
|
|
44
|
+
Generates a random 8 alphanumeric string of pattern `XXXX-XXXX`
|
|
45
|
+
"""
|
|
46
|
+
part_one = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(4))
|
|
47
|
+
part_two = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(4))
|
|
48
|
+
return f"{part_one}-{part_two}"
|
|
49
|
+
|
|
50
|
+
|
|
39
51
|
class Login():
|
|
40
52
|
def __init__(self) -> None:
|
|
41
53
|
self.delay = 5
|
|
42
|
-
self.base_authorization_url = "https://pynt.io/login?"
|
|
43
|
-
self.poll_url = "https://n592meacjj.execute-api.us-east-1.amazonaws.com/default/cli_validate_login"
|
|
44
54
|
self.login_wait_period = (60 * 3) # 3 minutes
|
|
45
55
|
|
|
46
|
-
def create_login_request(self):
|
|
47
|
-
|
|
48
|
-
request_url =
|
|
49
|
-
|
|
50
|
-
{"request_id": request_id, "utm_source": "cli"})
|
|
56
|
+
def create_login_request(self) -> str:
|
|
57
|
+
device_code = generate_device_code()
|
|
58
|
+
request_url = f"{PYNT_APP_URL}/login?" + urllib.parse.urlencode(
|
|
59
|
+
{"device_code": device_code, "utm_source": "cli"})
|
|
51
60
|
webbrowser.open(request_url)
|
|
52
61
|
|
|
53
62
|
ui_thread.print(ui_thread.PrinterText("To continue, you need to log in to your account.")
|
|
@@ -55,22 +64,22 @@ class Login():
|
|
|
55
64
|
.with_line("")
|
|
56
65
|
.with_line("If you are not automatically redirected, please click on the link provided below (or copy to your web browser)")
|
|
57
66
|
.with_line(request_url))
|
|
58
|
-
return
|
|
67
|
+
return device_code
|
|
59
68
|
|
|
60
|
-
def
|
|
69
|
+
def claim_token_using_device_code(self, device_code: str):
|
|
70
|
+
poll_url = f"{PYNT_SAAS}/auth/device-code/{device_code}"
|
|
61
71
|
with ui_thread.spinner("Waiting...", "point"):
|
|
62
72
|
start = time.time()
|
|
63
73
|
while start + self.login_wait_period > time.time():
|
|
64
|
-
response = pynt_requests.get(
|
|
65
|
-
"request_id": request_id})
|
|
74
|
+
response = pynt_requests.get(poll_url)
|
|
66
75
|
if response.status_code == 200:
|
|
67
76
|
return response.json()
|
|
68
77
|
time.sleep(self.delay)
|
|
69
78
|
raise Timeout()
|
|
70
79
|
|
|
71
80
|
def login(self):
|
|
72
|
-
|
|
73
|
-
token = self.
|
|
81
|
+
device_code = self.create_login_request()
|
|
82
|
+
token = self.claim_token_using_device_code(device_code)
|
|
74
83
|
with CredStore() as store:
|
|
75
84
|
store.put("token", token)
|
|
76
85
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
ignoreTests/conftest.py,sha256=gToq5K74GtgeGQXjFvXSzMaE6axBYxAzcFG5XJPOXjI,427
|
|
2
|
-
ignoreTests/auth/login.py,sha256=
|
|
2
|
+
ignoreTests/auth/login.py,sha256=7GeBirHTD9t6EassLYsegCw1FZHkfjvVW1Z5uybHzgM,3801
|
|
3
3
|
ignoreTests/store/cred_store.py,sha256=_7-917EtNC9eKEumO2_lt-7KuDmCwOZFaowCm7DbA_A,254
|
|
4
|
-
pyntcli/__init__.py,sha256=
|
|
4
|
+
pyntcli/__init__.py,sha256=j3sjtalrZ7qzajUh_46Une0yUZprSFiTpVECCQnsaGI,24
|
|
5
5
|
pyntcli/main.py,sha256=RD0W2_0ogYBCXubo-YewxHYkiIXxNv6NkZOh3n1VujE,5964
|
|
6
6
|
pyntcli/analytics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
7
|
pyntcli/analytics/send.py,sha256=0hJ0WJNFHLqyohtRr_xOg5WEXzxHrUOlcePPg-k65Hk,3846
|
|
8
8
|
pyntcli/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
-
pyntcli/auth/login.py,sha256=
|
|
9
|
+
pyntcli/auth/login.py,sha256=Oz1DtEZje0afgJcHSwEFHcH78X-QD5Mjn0CQ9ZgCfQU,5844
|
|
10
10
|
pyntcli/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
11
|
pyntcli/commands/burp.py,sha256=AUJU2cIJ-PSUATxYoHRwDy0K5feqCs-mGdkGle2WcDw,14173
|
|
12
12
|
pyntcli/commands/command.py,sha256=3egvDDr68sTUnyJpUE0bO9TfVy_rgeuM2C4zkMA-9GQ,10903
|
|
@@ -40,8 +40,8 @@ pyntcli/ui/report.py,sha256=W-icPSZrGLOubXgam0LpOvHLl_aZg9Zx9qIkL8Ym5PE,1930
|
|
|
40
40
|
pyntcli/ui/ui_thread.py,sha256=XUBgLpYQjVhrilU-ofw7VSXgTiwneSdTxm61EvC3x4Q,5091
|
|
41
41
|
tests/test_utils.py,sha256=t5fTQUk1U_Js6iMxcGYGqt4C-crzOJ0CqCKtLkRtUi0,2050
|
|
42
42
|
tests/commands/test_pynt_cmd.py,sha256=BjGFCFACcSziLrNA6_27t6TjSmvdu54wx9njwLpRSJY,8379
|
|
43
|
-
pyntcli-0.1.
|
|
44
|
-
pyntcli-0.1.
|
|
45
|
-
pyntcli-0.1.
|
|
46
|
-
pyntcli-0.1.
|
|
47
|
-
pyntcli-0.1.
|
|
43
|
+
pyntcli-0.1.113.dist-info/METADATA,sha256=8sdhJod-t85esbW4yJ0okltq4ljGEX1_4sQ2u5p5Mhg,427
|
|
44
|
+
pyntcli-0.1.113.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
45
|
+
pyntcli-0.1.113.dist-info/entry_points.txt,sha256=kcGmqAxXDttNk2EPRcqunc_LTVp61gzakz0v-GEE2SY,43
|
|
46
|
+
pyntcli-0.1.113.dist-info/top_level.txt,sha256=64XSgBzSpgwjYjEKHZE7q3JH2a816zEeyZBXfJi3AKI,42
|
|
47
|
+
pyntcli-0.1.113.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|