pyntcli 0.1.112__py3-none-any.whl → 0.1.114__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/commands/command.py +1 -1
- pyntcli/commands/har.py +10 -1
- {pyntcli-0.1.112.dist-info → pyntcli-0.1.114.dist-info}/METADATA +1 -1
- {pyntcli-0.1.112.dist-info → pyntcli-0.1.114.dist-info}/RECORD +10 -10
- {pyntcli-0.1.112.dist-info → pyntcli-0.1.114.dist-info}/WHEEL +0 -0
- {pyntcli-0.1.112.dist-info → pyntcli-0.1.114.dist-info}/entry_points.txt +0 -0
- {pyntcli-0.1.112.dist-info → pyntcli-0.1.114.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.114"
|
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
|
|
pyntcli/commands/command.py
CHANGED
|
@@ -249,7 +249,7 @@ class CommandSubCommand(sub_command.PyntSubCommand):
|
|
|
249
249
|
webbrowser.open("file://{}".format(html_report_path))
|
|
250
250
|
|
|
251
251
|
if json_report:
|
|
252
|
-
with open(json_report_path, "w") as json_file:
|
|
252
|
+
with open(json_report_path, "w", encoding="utf-8") as json_file:
|
|
253
253
|
json_file.write(json_report)
|
|
254
254
|
reporter = cli_reporter.PyntReporter(json_report_path)
|
|
255
255
|
reporter.print_summary()
|
pyntcli/commands/har.py
CHANGED
|
@@ -63,7 +63,7 @@ class HarSubCommand(sub_command.PyntSubCommand):
|
|
|
63
63
|
pynt_container.api_port(port),
|
|
64
64
|
)
|
|
65
65
|
|
|
66
|
-
if not os.path.isfile(args.har):
|
|
66
|
+
if not os.path.isfile(args.har) :
|
|
67
67
|
ui_thread.print(
|
|
68
68
|
ui_thread.PrinterText(
|
|
69
69
|
"Could not find the provided har path, please provide with a valid har path",
|
|
@@ -72,6 +72,15 @@ class HarSubCommand(sub_command.PyntSubCommand):
|
|
|
72
72
|
)
|
|
73
73
|
return
|
|
74
74
|
|
|
75
|
+
if os.path.getsize(args.har) == 0:
|
|
76
|
+
ui_thread.print(
|
|
77
|
+
ui_thread.PrinterText(
|
|
78
|
+
"The provided har file is empty, please provide a valid har file",
|
|
79
|
+
ui_thread.PrinterText.WARNING,
|
|
80
|
+
)
|
|
81
|
+
)
|
|
82
|
+
return
|
|
83
|
+
|
|
75
84
|
har_name = os.path.basename(args.har)
|
|
76
85
|
container_config.docker_arguments += ["--har", har_name]
|
|
77
86
|
container_config.mounts.append(
|
|
@@ -1,16 +1,16 @@
|
|
|
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=iSRFeK7cDc1GPwfyu8HXg0EPmcdBiD7ztZImO4LqE1E,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
|
-
pyntcli/commands/command.py,sha256=
|
|
13
|
-
pyntcli/commands/har.py,sha256=
|
|
12
|
+
pyntcli/commands/command.py,sha256=BLV1XVZfYFYnOq-A3M3CY1rLYB389QLUYzV2ZrKybxU,10921
|
|
13
|
+
pyntcli/commands/har.py,sha256=ZPPQFSyP9W1mSo7ankPnWwLzweDwoT4_iMZ7bPwzvoA,4575
|
|
14
14
|
pyntcli/commands/id_command.py,sha256=UBEgMIpm4vauTCsKyixltiGUolNg_OfHEJvJ_i5BpJY,943
|
|
15
15
|
pyntcli/commands/listen.py,sha256=18D9OdW1EakkK1u54hiOjwAuT5J6nsYb2vqlP1nw8p4,8898
|
|
16
16
|
pyntcli/commands/newman.py,sha256=ssMXY7VvYdMCXS38uLftF7uQ4HmDMYYHra4GvZhcR-g,5116
|
|
@@ -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.114.dist-info/METADATA,sha256=qtGIqKnV4wKYJKJNcr9eevjoYBbFUmMKRg79fNoZ82Q,427
|
|
44
|
+
pyntcli-0.1.114.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
45
|
+
pyntcli-0.1.114.dist-info/entry_points.txt,sha256=kcGmqAxXDttNk2EPRcqunc_LTVp61gzakz0v-GEE2SY,43
|
|
46
|
+
pyntcli-0.1.114.dist-info/top_level.txt,sha256=64XSgBzSpgwjYjEKHZE7q3JH2a816zEeyZBXfJi3AKI,42
|
|
47
|
+
pyntcli-0.1.114.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|