pyntcli 0.1.82__py3-none-any.whl → 0.1.84__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.82"
1
+ __version__ = "0.1.84"
pyntcli/commands/burp.py CHANGED
@@ -64,6 +64,9 @@ def decode_request(item) -> str:
64
64
 
65
65
  def replay_req(item, proxy_port):
66
66
  url = item["url"]
67
+ if not util.is_http_handler(url):
68
+ return None
69
+
67
70
  decoded_req = decode_request(item)
68
71
 
69
72
  method = decoded_req.split("\r\n")[0].split(" ")[0]
@@ -293,6 +296,13 @@ class BurpCommand(sub_command.PyntSubCommand):
293
296
 
294
297
  self._stop_proxy(args)
295
298
 
299
+ ui_thread.print(
300
+ ui_thread.PrinterText(
301
+ "Please wait while we scan and generate the report, it may take a few minutes...",
302
+ ui_thread.PrinterText.INFO,
303
+ )
304
+ )
305
+
296
306
  with ui_thread.progress(
297
307
  "ws://localhost:{}/progress?scanId={}".format(args.port, self.scan_id),
298
308
  partial(lambda *args: None),
pyntcli/commands/root.py CHANGED
@@ -1,6 +1,4 @@
1
1
  import argparse
2
- import sys
3
-
4
2
  from os import environ
5
3
 
6
4
  from pyntcli.auth import login
@@ -15,22 +13,16 @@ def root_usage():
15
13
  .with_line("\tpynt [COMMAND] [OPTIONS]")
16
14
  .with_line("")
17
15
  .with_line("Commands:", style=ui_thread.PrinterText.HEADER)
18
- .with_line(
19
- "\tpostman - integration with postman, run scan from pynt postman collection"
20
- )
16
+ .with_line("\tpostman - integration with postman, run scan from pynt postman collection")
21
17
  .with_line("\tnewman - run postman collection from the CLI")
22
18
  .with_line("\thar - run scan on static har file")
23
19
  .with_line("\tcommand - run scan with a given command")
24
20
  .with_line("\tlisten - run scan with a routed traffic")
25
21
  .with_line("\tburp - run scan on a burp xml output file")
26
- .with_line(
27
- "\tpynt-id - view your pynt-id to use when running pynt in CI pipeline"
28
- )
22
+ .with_line("\tpynt-id - view your pynt-id to use when running pynt in CI pipeline")
23
+ .with_line("\tlogout - log out from your user")
29
24
  .with_line("")
30
- .with_line(
31
- "Run pynt [COMMAND] -h to get help on a specific command",
32
- style=ui_thread.PrinterText.INFO,
33
- )
25
+ .with_line("Run pynt [COMMAND] -h to get help on a specific command", style=ui_thread.PrinterText.INFO,)
34
26
  )
35
27
 
36
28
 
@@ -0,0 +1,167 @@
1
+ STATIC_FILE_EXTENSIONS = [
2
+ '.css',
3
+ '.js',
4
+ '.jpg',
5
+ '.jpeg',
6
+ '.png',
7
+ '.gif',
8
+ '.svg',
9
+ '.ico',
10
+ '.html',
11
+ '.woff',
12
+ '.woff2',
13
+ '.ttf',
14
+ '.eot',
15
+ '.otf',
16
+ '.map',
17
+ '.json',
18
+ '.xml',
19
+ '.txt',
20
+ '.csv',
21
+ '.pdf',
22
+ '.doc',
23
+ '.docx',
24
+ '.xls',
25
+ '.xlsx',
26
+ '.ppt',
27
+ '.pptx',
28
+ '.mp3',
29
+ '.mp4',
30
+ '.avi',
31
+ '.mov',
32
+ '.wmv',
33
+ '.flv',
34
+ '.wav',
35
+ '.zip',
36
+ '.tar',
37
+ '.gz',
38
+ '.7z',
39
+ '.rar',
40
+ '.exe',
41
+ '.msi',
42
+ '.apk',
43
+ '.dmg',
44
+ '.iso',
45
+ '.img',
46
+ '.bin',
47
+ '.deb',
48
+ '.rpm',
49
+ '.sh',
50
+ '.bat',
51
+ '.cmd',
52
+ '.ps1',
53
+ '.py',
54
+ '.java',
55
+ '.c',
56
+ '.cpp',
57
+ '.h',
58
+ '.hpp',
59
+ '.cs',
60
+ '.php',
61
+ '.rb',
62
+ '.pl',
63
+ '.go',
64
+ '.swift',
65
+ '.kt',
66
+ '.ts',
67
+ '.html',
68
+ '.css',
69
+ '.js',
70
+ '.json',
71
+ '.xml',
72
+ '.yaml',
73
+ '.yml',
74
+ '.md',
75
+ '.rst',
76
+ '.txt',
77
+ '.csv',
78
+ '.tsv',
79
+ '.xls',
80
+ '.xlsx',
81
+ '.ods',
82
+ '.odt',
83
+ '.doc',
84
+ '.docx',
85
+ '.ppt',
86
+ '.pptx',
87
+ '.pdf',
88
+ '.zip',
89
+ '.tar',
90
+ '.gz',
91
+ '.7z',
92
+ '.rar',
93
+ '.apk',
94
+ '.exe',
95
+ '.msi',
96
+ '.dmg',
97
+ '.iso',
98
+ '.img',
99
+ '.bin',
100
+ '.deb',
101
+ '.rpm',
102
+ '.sh',
103
+ '.bat',
104
+ '.cmd',
105
+ '.ps1',
106
+ '.py',
107
+ '.java',
108
+ '.c',
109
+ '.cpp',
110
+ '.h',
111
+ '.hpp',
112
+ '.cs',
113
+ '.php',
114
+ '.rb',
115
+ '.pl',
116
+ '.go',
117
+ '.swift',
118
+ '.kt',
119
+ '.ts',
120
+ '.html',
121
+ '.css',
122
+ '.js',
123
+ '.json',
124
+ '.xml',
125
+ '.yaml',
126
+ '.yml',
127
+ '.md',
128
+ '.rst',
129
+ '.txt',
130
+ '.csv',
131
+ '.tsv',
132
+ '.xls',
133
+ '.xlsx',
134
+ '.ods',
135
+ '.odt',
136
+ '.doc',
137
+ '.docx',
138
+ '.ppt',
139
+ '.pptx',
140
+ '.pdf',
141
+ '.zip',
142
+ '.tar',
143
+ '.gz',
144
+ '.7z',
145
+ '.rar',
146
+ '.apk',
147
+ '.exe',
148
+ '.msi',
149
+ '.dmg',
150
+ '.iso',
151
+ '.img',
152
+ '.bin',
153
+ '.deb',
154
+ '.rpm',
155
+ '.sh',
156
+ '.bat',
157
+ '.cmd',
158
+ '.ps1',
159
+ '.py',
160
+ '.java',
161
+ '.c',
162
+ '.cpp',
163
+ '.h',
164
+ '.hpp',
165
+ '.cs',
166
+ '.php',
167
+ ]
pyntcli/commands/util.py CHANGED
@@ -8,6 +8,7 @@ import webbrowser
8
8
  import json
9
9
  import pyntcli.log.log as log
10
10
 
11
+ from pyntcli.commands.static_file_extensions import STATIC_FILE_EXTENSIONS
11
12
  from pyntcli.pynt_docker import pynt_container
12
13
  from pyntcli.ui import report
13
14
  from pyntcli.transport import pynt_requests
@@ -16,6 +17,15 @@ from pyntcli.transport import pynt_requests
16
17
  logger = log.get_logger()
17
18
 
18
19
 
20
+ def is_http_handler(url):
21
+ path = url.split("/")[-1]
22
+ for ext in STATIC_FILE_EXTENSIONS:
23
+ if ext in path:
24
+ return False
25
+
26
+ return True
27
+
28
+
19
29
  def find_open_port() -> int:
20
30
  with socket.socket() as s:
21
31
  s.bind(('', 0))
@@ -31,6 +41,7 @@ def wait_for_healthcheck(address):
31
41
  while start + HEALTHCHECK_TIMEOUT > time.time():
32
42
  try:
33
43
  res = pynt_requests.get(address + "/healthcheck")
44
+ logger.debug("Health check response: {}".format(res.status_code))
34
45
  if res.status_code == 418:
35
46
  return
36
47
  except:
@@ -56,7 +67,7 @@ class SomeFindingsOrWarningsException(Exception):
56
67
  pass
57
68
 
58
69
 
59
- @contextmanager
70
+ @ contextmanager
60
71
  def create_default_file_mounts(args):
61
72
  html_report_path = os.path.join(tempfile.gettempdir(), "results.html")
62
73
  json_report_path = os.path.join(tempfile.gettempdir(), "results.json")
@@ -66,7 +77,7 @@ def create_default_file_mounts(args):
66
77
  json_report_path = os.path.join(os.getcwd(), "pynt_results.json")
67
78
 
68
79
  mounts = []
69
- with open(html_report_path, "w",encoding="utf-8"), open(json_report_path, "w",encoding="utf-8"):
80
+ with open(html_report_path, "w", encoding="utf-8"), open(json_report_path, "w", encoding="utf-8"):
70
81
  mounts.append(pynt_container.create_mount(json_report_path, "/etc/pynt/results/results.json"))
71
82
  mounts.append(pynt_container.create_mount(html_report_path, "/etc/pynt/results/results.html"))
72
83
 
pyntcli/main.py CHANGED
@@ -1,6 +1,6 @@
1
1
  from sys import argv, exit
2
2
  import signal
3
-
3
+ import os
4
4
  import pyntcli.log.log as log
5
5
  from pyntcli.commands import pynt_cmd
6
6
  from pyntcli.pynt_docker import pynt_container
@@ -16,6 +16,8 @@ from pyntcli.commands.util import SomeFindingsOrWarningsException
16
16
  from pyntcli.commands.postman import PyntWebSocketException
17
17
  from pyntcli import __version__
18
18
 
19
+ from pyntcli.store import CredStore
20
+
19
21
 
20
22
  def shutdown_cli():
21
23
  analytics.stop()
@@ -48,9 +50,25 @@ def start_analytics():
48
50
  log.add_user_details(user_id)
49
51
 
50
52
 
53
+ def logout():
54
+ creds_path = CredStore().get_path()
55
+ try:
56
+ if os.path.isfile(creds_path):
57
+ os.remove(creds_path)
58
+ ui_thread.print("you have successfully logged out")
59
+ return
60
+ except Exception:
61
+ ui_thread.print(f"not able to log out - try to manually delete the {creds_path} file")
62
+
63
+ ui_thread.print("you are not logged in. run pynt --help and choose the required command")
64
+
65
+
51
66
  def main():
52
67
  print_header()
53
68
  try:
69
+ if argv[1] == "logout":
70
+ logout()
71
+ return
54
72
  log.set_source(__version__)
55
73
  start_analytics()
56
74
  check_for_dependecies()
pyntcli/store/store.py CHANGED
@@ -10,8 +10,8 @@ class Store():
10
10
  self.file_location = file_location
11
11
  self.connector: StoreConnector = None
12
12
  self._file = None
13
- self._connector_tpye = connector_type
14
-
13
+ self._connector_type = connector_type
14
+
15
15
  def _get_file_data(self):
16
16
  if self.connector:
17
17
  return
@@ -22,11 +22,11 @@ class Store():
22
22
 
23
23
  if not os.path.exists(self.file_location):
24
24
  with open(self.file_location, "w") as f:
25
- self.connector = self._connector_tpye(self._connector_tpye.default_value())
25
+ self.connector = self._connector_type(self._connector_type.default_value())
26
26
  return
27
27
 
28
28
  with open(self.file_location, "r+") as f:
29
- self.connector = self._connector_tpye(f.read())
29
+ self.connector = self._connector_type(f.read())
30
30
 
31
31
  def get(self, key):
32
32
  self._get_file_data()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyntcli
3
- Version: 0.1.82
3
+ Version: 0.1.84
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,11 +1,11 @@
1
- pyntcli/__init__.py,sha256=YThvBsPSPw2rCgZQb5SxE-vfr4Y0SBQRhFo1VmMzEQg,23
2
- pyntcli/main.py,sha256=qTGMG2JSpieg-1RRgBz9dPL4vHo1WJJIxTPQYAuzxuY,5138
1
+ pyntcli/__init__.py,sha256=3Ugcq_g7QAJpn2vNez96An4skXBk9KuWBd2osYpu08Y,23
2
+ pyntcli/main.py,sha256=wg2Is1ckRCb3EwsLFshDsbPKvntPOR7sDB2Nq-DW4wk,5689
3
3
  pyntcli/analytics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  pyntcli/analytics/send.py,sha256=pJOyOWl3g_Vm9apKK3LzNVqsnC6zsWA1bCK3ZegbLpc,3637
5
5
  pyntcli/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  pyntcli/auth/login.py,sha256=TljsRXbEkNI1YUrKm5mlTw4YiecYScYUsit8Z8vstss,5228
7
7
  pyntcli/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- pyntcli/commands/burp.py,sha256=2FqLc65SjuXdenUS1ggC6dGRU_iSA52Ft_8OnfGsm_8,11193
8
+ pyntcli/commands/burp.py,sha256=7OCLgmIpgXcrUdx0wUAnWg1ER982vsGGvtptNpNENMk,11480
9
9
  pyntcli/commands/command.py,sha256=0O7Za_cjT6vDkDfM0OTMPB6DLI3U1r1R7lXQydz7458,9495
10
10
  pyntcli/commands/har.py,sha256=mSCbTUnxQrKzJd-dAWoc6Tkw6tU1LDH7Ha1w2ylrrrg,3654
11
11
  pyntcli/commands/id_command.py,sha256=UBEgMIpm4vauTCsKyixltiGUolNg_OfHEJvJ_i5BpJY,943
@@ -13,9 +13,10 @@ pyntcli/commands/listen.py,sha256=JoDo3BirYf9f3Fr21qAQ7kIDmLbM5cuFzQtf8RQ_nhs,84
13
13
  pyntcli/commands/newman.py,sha256=y0KolwMgsvoqPz2mp0QRug_qNr-ftOZbu_tN7h4bH7I,4826
14
14
  pyntcli/commands/postman.py,sha256=GWq4NJJ_9WdFiXk5rv2nTyMM27w50XLh4LKkuuWpw4I,4721
15
15
  pyntcli/commands/pynt_cmd.py,sha256=KOl9guUtesO2JcMM5nPKKkjnK6F9HV4jHHcoUk4KVhw,2825
16
- pyntcli/commands/root.py,sha256=GijCi8hqe8sXEo6faWimlCmT8d782yjrw1IWJT5RAMk,3320
16
+ pyntcli/commands/root.py,sha256=dmgdzoFuf5LkwrkwvWf1MtlwTBgsVpS85Yr_cQCVuGA,3291
17
+ pyntcli/commands/static_file_extensions.py,sha256=PZJb02BI-64tbU-j3rdCNsXzTh7gkIDGxGKbKNw3h5k,1995
17
18
  pyntcli/commands/sub_command.py,sha256=GF3-rE_qk2L4jGPFqHLm9SdGINmu3EakhjJTFyWjRms,374
18
- pyntcli/commands/util.py,sha256=NJBJk4tKzrWmilYdo-7CROH5IXKl0UQAPKaMzRZtxm8,2827
19
+ pyntcli/commands/util.py,sha256=oc3xrc7lUI3sM1-__5hw0COt8JcREHKFkOccFtG-rt0,3146
19
20
  pyntcli/log/__init__.py,sha256=cOGwOYzMoshEbZiiasBGkj6wF0SBu3Jdpl-AuakDesw,19
20
21
  pyntcli/log/log.py,sha256=cWCdWmUaAwePwdhYDcgNMEG9d9RM34sGahxBCYEdv2Y,1069
21
22
  pyntcli/pynt_docker/__init__.py,sha256=PQIOVxc7XXtMLfEX7ojgwf_Z3mmTllO3ZvzUZTPOxQY,30
@@ -23,7 +24,7 @@ pyntcli/pynt_docker/container_utils.py,sha256=_Onn7loInzyJAG2-Uk6CGpsuRyelmUFHOv
23
24
  pyntcli/pynt_docker/pynt_container.py,sha256=y4m8wZU16gqFPaMzEJKKHut4DbjPxr_du8g7I4-AcHk,8761
24
25
  pyntcli/store/__init__.py,sha256=xuS9OB21F6B1sUx5XPGxz_6WpG6-KTMbuq50RrZS5OY,29
25
26
  pyntcli/store/json_connector.py,sha256=UGs3uORw3iyn0YJ8kzab-veEZToA6d-ByXYuqEleWsA,560
26
- pyntcli/store/store.py,sha256=Kf4IFCAu0i0DPVGgntrSYUiwz6kmW9HvItKnCT-MosE,1905
27
+ pyntcli/store/store.py,sha256=9KwalOd1EA1VtYwr9oJgBsPgUYakX5uyif_sNXGQ614,1917
27
28
  pyntcli/store/store_connector.py,sha256=w4LzcpRZesUZL1f63RmLlWEFRtJ6Y6rcS6PkkGtO4MA,357
28
29
  pyntcli/transport/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
30
  pyntcli/transport/pynt_requests.py,sha256=KiEG3hNcwY7DLIJDCq-7LIPq54yYQcDBhHe3KhpqRTc,1563
@@ -35,8 +36,8 @@ pyntcli/ui/ui_thread.py,sha256=OVTbiIFMg2KgxAvHf7yy86xGm4RVS2vj_VYZkMi-SRY,4956
35
36
  tests/conftest.py,sha256=gToq5K74GtgeGQXjFvXSzMaE6axBYxAzcFG5XJPOXjI,427
36
37
  tests/auth/test_login.py,sha256=KFlzWhXBAuwdi7GXf16gCB3ya94LQG2wjcSChE149rQ,3798
37
38
  tests/store/test_cred_store.py,sha256=_7-917EtNC9eKEumO2_lt-7KuDmCwOZFaowCm7DbA_A,254
38
- pyntcli-0.1.82.dist-info/METADATA,sha256=WpnF74sRKWiYhqK37FpYb6ggOl_FscYOIjVjaAedZuU,463
39
- pyntcli-0.1.82.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
40
- pyntcli-0.1.82.dist-info/entry_points.txt,sha256=kcGmqAxXDttNk2EPRcqunc_LTVp61gzakz0v-GEE2SY,43
41
- pyntcli-0.1.82.dist-info/top_level.txt,sha256=u9MDStwVHB7UG8PUcODeWCul_NvzL2EzoLvSlgwLHFs,30
42
- pyntcli-0.1.82.dist-info/RECORD,,
39
+ pyntcli-0.1.84.dist-info/METADATA,sha256=IDf8-YB7CT9f2B4tdFgj7mzSZ9TVpvpEDfKvZGYysh4,463
40
+ pyntcli-0.1.84.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
41
+ pyntcli-0.1.84.dist-info/entry_points.txt,sha256=kcGmqAxXDttNk2EPRcqunc_LTVp61gzakz0v-GEE2SY,43
42
+ pyntcli-0.1.84.dist-info/top_level.txt,sha256=u9MDStwVHB7UG8PUcODeWCul_NvzL2EzoLvSlgwLHFs,30
43
+ pyntcli-0.1.84.dist-info/RECORD,,