pyntcli 0.1.114__py3-none-any.whl → 0.1.115__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.
pyntcli/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.1.114"
1
+ __version__ = "0.1.115"
pyntcli/commands/burp.py CHANGED
@@ -149,6 +149,7 @@ def burp_usage():
149
149
  .with_line("\t--report - If present will save the generated report in this path.")
150
150
  .with_line("\t--insecure - Use when target uses self signed certificates")
151
151
  .with_line("\t--application-id - Attach the scan to an application, you can find the ID in your applications area at app.pynt.io")
152
+ .with_line("\t--application-name - Attach the scan to an application, application will be created automatically if it does not exist.")
152
153
  .with_line("\t--host-ca - Path to the CA file in PEM format to enable SSL certificate verification for pynt when running through a VPN.")
153
154
  .with_line("\t--severity-level - 'all', 'medium', 'high', 'critical', 'none' (default) ")
154
155
  .with_line("\t--tag - Tag the scan. Repeat for multiple tags")
@@ -38,6 +38,8 @@ def command_usage():
38
38
  .with_line("\t--self-signed - Use when the functional test verify SSL")
39
39
  .with_line("\t--no-proxy-export - Pynt will not export the proxy settings to the environment")
40
40
  .with_line("\t--application-id - Attach the scan to an application, you can find the ID in your applications area at app.pynt.io")
41
+ .with_line(
42
+ "\t--application-name - Attach the scan to an application, application will be created automatically if it does not exist.")
41
43
  .with_line("\t--host-ca - Path to the CA file in PEM format to enable SSL certificate verification for pynt when running through a VPN.")
42
44
  .with_line("\t--severity-level - 'all', 'medium', 'high', 'critical', 'none' (default) ")
43
45
  .with_line("\t--tag - Tag the scan. Repeat for multiple tags")
pyntcli/commands/har.py CHANGED
@@ -25,6 +25,7 @@ def har_usage():
25
25
  .with_line(
26
26
  "\t--application-id - Attach the scan to an application, you can find the ID in your applications area at app.pynt.io"
27
27
  )
28
+ .with_line("\t--application-name - Attach the scan to an application, application will be created automatically if it does not exist.")
28
29
  .with_line(
29
30
  "\t--host-ca - Path to the CA file in PEM format to enable SSL certificate verification for pynt when running through a VPN."
30
31
  )
@@ -31,6 +31,7 @@ def listen_usage():
31
31
  .with_line("\t--proxy-port - Set the port proxied traffic should be routed to (DEFAULT: 6666)")
32
32
  .with_line("\t--report - If present will save the generated report in this path.")
33
33
  .with_line("\t--application-id - Attach the scan to an application, you can find the ID in your applications area at app.pynt.io")
34
+ .with_line("\t--application-name - Attach the scan to an application, application will be created automatically if it does not exist.")
34
35
  .with_line("\t--insecure - use when target uses self signed certificates")
35
36
  .with_line("\t--host-ca - path to the CA file in PEM format to enable SSL certificate verification for pynt when running through a VPN.")
36
37
  .with_line("\t--severity-level - 'all', 'medium', 'high', 'critical', 'none' (default) ")
@@ -28,6 +28,9 @@ def newman_usage():
28
28
  .with_line(
29
29
  "\t--application-id - Attach the scan to an application, you can find the ID in your applications area at app.pynt.io"
30
30
  )
31
+ .with_line(
32
+ "\t--application-name - Attach the scan to an application, application will be created automatically if it does not exist."
33
+ )
31
34
  .with_line("\t--severity-level - 'all', 'medium', 'high', 'critical', 'none' (default) ")
32
35
  .with_line("\t--tag - Tag the scan. Repeat for multiple tags")
33
36
  .with_line("\t--verbose - Use to get more detailed information about the run")
@@ -142,6 +142,12 @@ class PyntCommand:
142
142
  return False
143
143
 
144
144
  def _post_login_args_validation(self, args: argparse.Namespace, command: str, is_business_plan_user: bool):
145
+ if getattr(args, "application_name"):
146
+ if getattr(args, "yes") or self._is_auto_create_app_confirmed(args.application_name):
147
+ return
148
+ else:
149
+ raise UserAbortedException()
150
+
145
151
  # Confirm not using application-id flag if applicable
146
152
  if getattr(args, "application_id") or command in commands_without_app_id:
147
153
  return
@@ -153,18 +159,18 @@ class PyntCommand:
153
159
  else:
154
160
  raise UserAbortedException()
155
161
 
156
- def _is_missing_app_id_confirmed(self) -> bool:
162
+ def is_confirmed(self, prompt_history_key: str, confirmation_message: str, default_confirmation: str) -> bool:
157
163
  """
158
- Ask for the user's confirmation to continue if he/she wasn't asked in the last week.
164
+ Ask for the user's confirmation to continue if he/she wasn't asked in the last week.
159
165
 
160
- Returns:
161
- bool: True if the user confirms or he/she has confirmed once in the last week. Otherwise, returns False
162
- """
166
+ Returns:
167
+ bool: True if the user confirms or he/she has confirmed once in the last week. Otherwise, returns False
168
+ """
163
169
  with StateStore() as state_store:
164
170
  current_time = datetime.now()
165
171
  prompts_history = state_store.get_prompts_history()
166
172
  last_confirmed = prompts_history.get(
167
- "missing_app_id", {}).get("last_confirmation", "")
173
+ prompt_history_key, {}).get("last_confirmation", "")
168
174
  if last_confirmed:
169
175
  # Calculate the time delta
170
176
  parsed_datetime = datetime.strptime(
@@ -173,13 +179,21 @@ class PyntCommand:
173
179
  if difference < timedelta(days=7):
174
180
  return True
175
181
 
176
- if prompt.confirmation_prompt_with_timeout("Application ID is missing. Use the '--application-id' flag to provide it.\n" +
177
- "Without an Application ID, the scan will not be associated with your application.\n" +
178
- "The Application ID can be fetched from https://app.pynt.io/dashboard/applications.\n" +
179
- "Do you want to continue without associating the scan?", default="yes", timeout=15):
182
+ if prompt.confirmation_prompt_with_timeout(confirmation_message, default=default_confirmation, timeout=15):
180
183
  prompts_history["missing_app_id"] = {"last_confirmation": current_time.strftime("%Y-%m-%d %H:%M:%S")}
181
184
  state_store.put_prompts_history(
182
185
  prompts_history)
183
186
  return True
184
187
 
185
188
  return False
189
+
190
+ def _is_missing_app_id_confirmed(self) -> bool:
191
+ return self.is_confirmed("missing_app_id", "Application ID is missing. Use the '--application-id' flag to provide it.\n" +
192
+ "Without an Application ID, the scan will not be associated with your application.\n" +
193
+ "The Application ID can be fetched from https://app.pynt.io/dashboard/applications.\n" +
194
+ "Do you want to continue without associating the scan?", "yes")
195
+
196
+
197
+ def _is_auto_create_app_confirmed(self, application_name: str) -> bool:
198
+ return self.is_confirmed("auto_create_application", f"Application {application_name} will be created automatically if it does not exist.\n" +
199
+ f"Do you want to continue without the application name {application_name}?", "yes")
pyntcli/commands/root.py CHANGED
@@ -68,6 +68,8 @@ class BaseCommand:
68
68
  parser.add_argument("--transport-config", type=str, default="")
69
69
  parser.add_argument("--application-id", type=str,
70
70
  default="", required=False)
71
+ parser.add_argument("--application-name", type=str,
72
+ default="", required=False)
71
73
  parser.add_argument("--proxy", type=str, default="", required=False)
72
74
  parser.add_argument(
73
75
  "--yes",
@@ -150,6 +150,9 @@ def build_docker_args(integration_name: str, args: argparse.Namespace, port_args
150
150
  if "application_id" in args and args.application_id:
151
151
  docker_arguments += ["--application-id", args.application_id]
152
152
 
153
+ if "application_name" in args and args.application_name:
154
+ docker_arguments += ["--application-name", args.application_name]
155
+
153
156
  if "proxy" in args and args.proxy:
154
157
  docker_arguments += ["--proxy", args.proxy]
155
158
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pyntcli
3
- Version: 0.1.114
3
+ Version: 0.1.115
4
4
  Summary: Command line utility to handle all of Pynt's different integrations
5
5
  Author-email: Pynt-io <support@pynt.io>
6
6
  Project-URL: Homepage, https://pynt.io
@@ -1,22 +1,22 @@
1
1
  ignoreTests/conftest.py,sha256=gToq5K74GtgeGQXjFvXSzMaE6axBYxAzcFG5XJPOXjI,427
2
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=iSRFeK7cDc1GPwfyu8HXg0EPmcdBiD7ztZImO4LqE1E,24
4
+ pyntcli/__init__.py,sha256=w7iUQrCxcREXlc0oJR5V2FHWH8-aYWfF0nTwm9iSFCY,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
9
  pyntcli/auth/login.py,sha256=Oz1DtEZje0afgJcHSwEFHcH78X-QD5Mjn0CQ9ZgCfQU,5844
10
10
  pyntcli/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
- pyntcli/commands/burp.py,sha256=AUJU2cIJ-PSUATxYoHRwDy0K5feqCs-mGdkGle2WcDw,14173
12
- pyntcli/commands/command.py,sha256=BLV1XVZfYFYnOq-A3M3CY1rLYB389QLUYzV2ZrKybxU,10921
13
- pyntcli/commands/har.py,sha256=ZPPQFSyP9W1mSo7ankPnWwLzweDwoT4_iMZ7bPwzvoA,4575
11
+ pyntcli/commands/burp.py,sha256=9kcqjC9Rgj5oZimGZuA_oO71Hn2Z3py8k5vr-eMKnUM,14317
12
+ pyntcli/commands/command.py,sha256=ulxhWyTnuqQfyNy5somqBbQoTCvd0Hg4OnPJ8thJzAs,11078
13
+ pyntcli/commands/har.py,sha256=laVRjG35LDEykoSfRIuEwHYfLstui6EpPxSjcam64ng,4719
14
14
  pyntcli/commands/id_command.py,sha256=UBEgMIpm4vauTCsKyixltiGUolNg_OfHEJvJ_i5BpJY,943
15
- pyntcli/commands/listen.py,sha256=18D9OdW1EakkK1u54hiOjwAuT5J6nsYb2vqlP1nw8p4,8898
16
- pyntcli/commands/newman.py,sha256=ssMXY7VvYdMCXS38uLftF7uQ4HmDMYYHra4GvZhcR-g,5116
15
+ pyntcli/commands/listen.py,sha256=RTlUt2oq5_BPeBZpG5yQ6GPAG_Cf0JVrUrkzz8uw9ns,9042
16
+ pyntcli/commands/newman.py,sha256=w0d0Pi1swJQ8E3oRs6vsgw_591sl-4bcLpWZwuBXmDI,5282
17
17
  pyntcli/commands/postman.py,sha256=kN1PkzPpcUnsbirg17AN9JwJZu6VBt6OeKYrLGrvtFc,4964
18
- pyntcli/commands/pynt_cmd.py,sha256=AeXxKy8dtZTdwWhTirHVvkPkeFUSoZNb3FRyuwkL6kg,7103
19
- pyntcli/commands/root.py,sha256=Lr31nsx2sgM-o3OYEbfqakaxzXHY6irr9uj-X6QWiqk,4325
18
+ pyntcli/commands/pynt_cmd.py,sha256=Sqb64Ow3qhhBdyAglY6wV-SSL0AK5ADoEeOHO4FniQY,7942
19
+ pyntcli/commands/root.py,sha256=bTGlFroeK7WG9dAhFkVTVnpEM-Gdp8QKCuTxW_QWNlQ,4441
20
20
  pyntcli/commands/static_file_extensions.py,sha256=PZJb02BI-64tbU-j3rdCNsXzTh7gkIDGxGKbKNw3h5k,1995
21
21
  pyntcli/commands/sub_command.py,sha256=GF3-rE_qk2L4jGPFqHLm9SdGINmu3EakhjJTFyWjRms,374
22
22
  pyntcli/commands/template.py,sha256=wl-0GhIUUqdO39fyoO7mMsEKXnYqG32XkQdUJhLkdiA,8047
@@ -25,7 +25,7 @@ pyntcli/log/__init__.py,sha256=cOGwOYzMoshEbZiiasBGkj6wF0SBu3Jdpl-AuakDesw,19
25
25
  pyntcli/log/log.py,sha256=YXCvcCzuhQ5QUT2L02uQEdN_lTCzLEuet4OnLuEnjlM,112
26
26
  pyntcli/pynt_docker/__init__.py,sha256=PQIOVxc7XXtMLfEX7ojgwf_Z3mmTllO3ZvzUZTPOxQY,30
27
27
  pyntcli/pynt_docker/container_utils.py,sha256=_Onn7loInzyJAG2-Uk6CGpsuRyelmUFHOvtJj4Uzi9A,175
28
- pyntcli/pynt_docker/pynt_container.py,sha256=u87rBT52rxDYNg8gc0NAs3GhTDS1MFwKLpShJkPlKbA,13861
28
+ pyntcli/pynt_docker/pynt_container.py,sha256=YiYEq8_GZ8NpFNkUV4ynSEdKaYEjE764JgjdEknSw4g,13997
29
29
  pyntcli/store/__init__.py,sha256=1fP8cEAQCF_myja3gnhHH9FEqtBiOJ-2aBmUXSKBdFA,41
30
30
  pyntcli/store/json_connector.py,sha256=UGs3uORw3iyn0YJ8kzab-veEZToA6d-ByXYuqEleWsA,560
31
31
  pyntcli/store/store.py,sha256=Kl_HT9FJFdKlAH7SwAt3g4-bW-r-1ve_u13OPggQai0,2529
@@ -39,9 +39,9 @@ pyntcli/ui/pynt_errors.py,sha256=00UprD4tFViREv7kuXGQ99PAKGTpXYixxi3Ndeoeiew,689
39
39
  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
- tests/commands/test_pynt_cmd.py,sha256=BjGFCFACcSziLrNA6_27t6TjSmvdu54wx9njwLpRSJY,8379
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,,
42
+ tests/commands/test_pynt_cmd.py,sha256=c0m7L_kK3iWaHTIEC5H0IlUSL2UUU4NdakduLDbsVyg,8505
43
+ pyntcli-0.1.115.dist-info/METADATA,sha256=sZ2RGy8wdB9ZZ4HgeoY4kJddkqOAsVkOs8Y218MjMtE,427
44
+ pyntcli-0.1.115.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
45
+ pyntcli-0.1.115.dist-info/entry_points.txt,sha256=kcGmqAxXDttNk2EPRcqunc_LTVp61gzakz0v-GEE2SY,43
46
+ pyntcli-0.1.115.dist-info/top_level.txt,sha256=64XSgBzSpgwjYjEKHZE7q3JH2a816zEeyZBXfJi3AKI,42
47
+ pyntcli-0.1.115.dist-info/RECORD,,
@@ -75,7 +75,7 @@ class TestIsBusinessPlanUser(unittest.TestCase):
75
75
  instance = PyntCommand()
76
76
  try:
77
77
  result = instance._post_login_args_validation(argparse.Namespace(
78
- application_id="", yes=False), "non-postman-command", True)
78
+ application_id="", application_name="", yes=False), "non-postman-command", True)
79
79
  except Exception as e:
80
80
  self.fail(f"Unexpected exception raised {e}")
81
81
 
@@ -85,7 +85,7 @@ class TestIsBusinessPlanUser(unittest.TestCase):
85
85
  instance = PyntCommand()
86
86
  try:
87
87
  result = instance._post_login_args_validation(argparse.Namespace(
88
- application_id="", yes=True), "non-postman-command", True)
88
+ application_id="", application_name="", yes=True), "non-postman-command", True)
89
89
  except Exception as e:
90
90
  self.fail(f"Unexpected exception raised {e}")
91
91
 
@@ -95,7 +95,7 @@ class TestIsBusinessPlanUser(unittest.TestCase):
95
95
  instance = PyntCommand()
96
96
  with self.assertRaises(UserAbortedException):
97
97
  result = instance._post_login_args_validation(argparse.Namespace(
98
- application_id="", yes=False), "non-postman-command", True)
98
+ application_id="", application_name="", yes=False), "non-postman-command", True)
99
99
 
100
100
  @patch.object(PyntCommand, '_is_missing_app_id_confirmed', return_value=False)
101
101
  def test_post_login_args_validation_missing_app_id_free_tier(self, _):
@@ -103,7 +103,7 @@ class TestIsBusinessPlanUser(unittest.TestCase):
103
103
  instance = PyntCommand()
104
104
  try:
105
105
  result = instance._post_login_args_validation(argparse.Namespace(
106
- application_id="", yes=False), "non-postman-command", False)
106
+ application_id="", application_name="", yes=False), "non-postman-command", False)
107
107
  except Exception as e:
108
108
  self.fail(f"Unexpected exception raised {e}")
109
109
 
@@ -113,9 +113,9 @@ class TestIsBusinessPlanUser(unittest.TestCase):
113
113
  instance = PyntCommand()
114
114
  try:
115
115
  result = instance._post_login_args_validation(
116
- argparse.Namespace(application_id="", yes=False), "postman", True)
116
+ argparse.Namespace(application_id="", application_name="", yes=False), "postman", True)
117
117
  result = instance._post_login_args_validation(
118
- argparse.Namespace(application_id="", yes=False), "pynt-id", True)
118
+ argparse.Namespace(application_id="", application_name="", yes=False), "pynt-id", True)
119
119
  except Exception as e:
120
120
  self.fail(f"Unexpected exception raised {e}")
121
121