pyntcli 0.1.80__py3-none-any.whl → 0.1.82__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 +1 -1
- pyntcli/analytics/send.py +27 -8
- pyntcli/commands/burp.py +29 -3
- pyntcli/main.py +0 -1
- {pyntcli-0.1.80.dist-info → pyntcli-0.1.82.dist-info}/METADATA +1 -1
- {pyntcli-0.1.80.dist-info → pyntcli-0.1.82.dist-info}/RECORD +9 -9
- {pyntcli-0.1.80.dist-info → pyntcli-0.1.82.dist-info}/WHEEL +0 -0
- {pyntcli-0.1.80.dist-info → pyntcli-0.1.82.dist-info}/entry_points.txt +0 -0
- {pyntcli-0.1.80.dist-info → pyntcli-0.1.82.dist-info}/top_level.txt +0 -0
pyntcli/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.1.
|
|
1
|
+
__version__ = "0.1.82"
|
pyntcli/analytics/send.py
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import requests
|
|
2
2
|
import time
|
|
3
3
|
import platform
|
|
4
|
+
import socket
|
|
5
|
+
import subprocess
|
|
4
6
|
|
|
5
7
|
from pyntcli import __version__
|
|
6
8
|
from pyntcli.transport import pynt_requests
|
|
7
9
|
import pyntcli.log.log as log
|
|
10
|
+
from pyntcli.ui import ui_thread
|
|
8
11
|
|
|
9
12
|
|
|
10
13
|
PYNT_DEFAULT_USER_ID = "d9e3b82b-2900-43bf-8c8f-7ffe2f0cda36"
|
|
11
14
|
MIXPANEL_TOKEN = "05c26edb86084bbbb803eed6818cd8aa"
|
|
12
|
-
|
|
15
|
+
MIXPANEL_DOMAIN = "api-eu.mixpanel.com"
|
|
16
|
+
MIXPANEL_URL = f"https://{MIXPANEL_DOMAIN}/track?ip=1"
|
|
13
17
|
|
|
14
18
|
logger = log.get_logger()
|
|
15
19
|
|
|
@@ -47,18 +51,32 @@ class AnalyticsSender():
|
|
|
47
51
|
self.user_id = user_id
|
|
48
52
|
self.version = __version__
|
|
49
53
|
self.events = []
|
|
54
|
+
self.disable_analytics = False
|
|
50
55
|
|
|
51
56
|
@staticmethod
|
|
52
57
|
def instance():
|
|
53
58
|
if not AnalyticsSender._instance:
|
|
54
59
|
AnalyticsSender._instance = AnalyticsSender()
|
|
60
|
+
AnalyticsSender._instance.check_network_restrictions()
|
|
55
61
|
|
|
56
62
|
return AnalyticsSender._instance
|
|
57
63
|
|
|
64
|
+
def check_network_restrictions(self):
|
|
65
|
+
try:
|
|
66
|
+
result = subprocess.run(["ping", "-c", "1", MIXPANEL_DOMAIN], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=2)
|
|
67
|
+
if result.returncode != 0:
|
|
68
|
+
self.set_disable_analytics("ping return code not 0")
|
|
69
|
+
except (socket.gaierror, subprocess.TimeoutExpired):
|
|
70
|
+
self.set_disable_analytics("timeout")
|
|
71
|
+
|
|
72
|
+
def set_disable_analytics(self, reason: str):
|
|
73
|
+
self.disable_analytics = True
|
|
74
|
+
logger.debug(f"Disabling analytics due to : {reason}")
|
|
75
|
+
|
|
58
76
|
def base_event(self, event_type):
|
|
59
77
|
return {
|
|
60
78
|
"event": event_type,
|
|
61
|
-
"properties":
|
|
79
|
+
"properties": {
|
|
62
80
|
"time": time.time(),
|
|
63
81
|
"distinct_id": self.user_id,
|
|
64
82
|
"$os": platform.platform(),
|
|
@@ -75,10 +93,10 @@ class AnalyticsSender():
|
|
|
75
93
|
base_event["properties"][k] = v
|
|
76
94
|
|
|
77
95
|
if self.user_id != PYNT_DEFAULT_USER_ID:
|
|
78
|
-
|
|
96
|
+
if self.disable_analytics:
|
|
97
|
+
logger.info(f"Analytics disabled, sending to logz: {base_event}")
|
|
98
|
+
else:
|
|
79
99
|
pynt_requests.post(MIXPANEL_URL, json=[base_event])
|
|
80
|
-
except Exception:
|
|
81
|
-
logger.info(f"mixpanel unavailable, sending to logz: {base_event}")
|
|
82
100
|
else:
|
|
83
101
|
self.events.append(base_event)
|
|
84
102
|
|
|
@@ -99,8 +117,9 @@ class AnalyticsSender():
|
|
|
99
117
|
|
|
100
118
|
def done(self):
|
|
101
119
|
if self.events:
|
|
102
|
-
|
|
120
|
+
if self.disable_analytics:
|
|
121
|
+
logger.info(f"Analytics disabled, sending to logz: {self.events}")
|
|
122
|
+
else:
|
|
103
123
|
pynt_requests.post(MIXPANEL_URL, json=self.events)
|
|
104
|
-
|
|
105
|
-
logger.info(f"mixpanel unavailable, sending to logz: {self.events}")
|
|
124
|
+
|
|
106
125
|
self.events = []
|
pyntcli/commands/burp.py
CHANGED
|
@@ -10,6 +10,7 @@ from subprocess import Popen, PIPE
|
|
|
10
10
|
from functools import partial
|
|
11
11
|
import xmltodict
|
|
12
12
|
import base64
|
|
13
|
+
import pyntcli.log.log as log
|
|
13
14
|
from xml.parsers.expat import ExpatError
|
|
14
15
|
|
|
15
16
|
from pyntcli.pynt_docker import pynt_container
|
|
@@ -30,6 +31,9 @@ methods = [
|
|
|
30
31
|
"connect",
|
|
31
32
|
]
|
|
32
33
|
|
|
34
|
+
logger = log.get_logger()
|
|
35
|
+
supported_encoding = ["utf-8", "latin1", "utf-16", "cp1252"]
|
|
36
|
+
|
|
33
37
|
|
|
34
38
|
def is_valid_method(method: str):
|
|
35
39
|
if method.lower() in methods:
|
|
@@ -37,9 +41,31 @@ def is_valid_method(method: str):
|
|
|
37
41
|
return False
|
|
38
42
|
|
|
39
43
|
|
|
44
|
+
def decode_request(item) -> str:
|
|
45
|
+
error = None
|
|
46
|
+
for encoding in supported_encoding:
|
|
47
|
+
try:
|
|
48
|
+
return base64.b64decode(item["request"]["#text"]).decode(encoding)
|
|
49
|
+
except UnicodeDecodeError as e:
|
|
50
|
+
error = e
|
|
51
|
+
continue
|
|
52
|
+
except Exception as e:
|
|
53
|
+
error = e
|
|
54
|
+
break
|
|
55
|
+
|
|
56
|
+
ui_thread.print(
|
|
57
|
+
ui_thread.PrinterText(
|
|
58
|
+
f"Error decoding request: {error}"),
|
|
59
|
+
ui_thread.PrinterText.WARNING)
|
|
60
|
+
logger.error(f"Error decoding request: {error}")
|
|
61
|
+
|
|
62
|
+
raise e
|
|
63
|
+
|
|
64
|
+
|
|
40
65
|
def replay_req(item, proxy_port):
|
|
41
66
|
url = item["url"]
|
|
42
|
-
decoded_req =
|
|
67
|
+
decoded_req = decode_request(item)
|
|
68
|
+
|
|
43
69
|
method = decoded_req.split("\r\n")[0].split(" ")[0]
|
|
44
70
|
|
|
45
71
|
if not is_valid_method(method):
|
|
@@ -289,12 +315,12 @@ class BurpCommand(sub_command.PyntSubCommand):
|
|
|
289
315
|
json_report_path = util.get_user_report_path(full_path, "json")
|
|
290
316
|
|
|
291
317
|
if html_report:
|
|
292
|
-
with open(html_report_path, "w",encoding="utf-8") as html_file:
|
|
318
|
+
with open(html_report_path, "w", encoding="utf-8") as html_file:
|
|
293
319
|
html_file.write(html_report)
|
|
294
320
|
webbrowser.open("file://{}".format(html_report_path))
|
|
295
321
|
|
|
296
322
|
if json_report:
|
|
297
|
-
with open(json_report_path, "w",encoding="utf-8") as json_file:
|
|
323
|
+
with open(json_report_path, "w", encoding="utf-8") as json_file:
|
|
298
324
|
json_file.write(json_report)
|
|
299
325
|
reporter = cli_reporter.PyntReporter(json_report_path)
|
|
300
326
|
reporter.print_summary()
|
pyntcli/main.py
CHANGED
|
@@ -6,7 +6,6 @@ from pyntcli.commands import pynt_cmd
|
|
|
6
6
|
from pyntcli.pynt_docker import pynt_container
|
|
7
7
|
from pyntcli.ui import ui_thread
|
|
8
8
|
from pyntcli.ui import pynt_errors
|
|
9
|
-
from pyntcli.ui import ui_thread
|
|
10
9
|
from pyntcli.auth import login
|
|
11
10
|
from pyntcli.analytics import send as analytics
|
|
12
11
|
from requests.exceptions import SSLError
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
pyntcli/__init__.py,sha256=
|
|
2
|
-
pyntcli/main.py,sha256=
|
|
1
|
+
pyntcli/__init__.py,sha256=YThvBsPSPw2rCgZQb5SxE-vfr4Y0SBQRhFo1VmMzEQg,23
|
|
2
|
+
pyntcli/main.py,sha256=qTGMG2JSpieg-1RRgBz9dPL4vHo1WJJIxTPQYAuzxuY,5138
|
|
3
3
|
pyntcli/analytics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
pyntcli/analytics/send.py,sha256=
|
|
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=
|
|
8
|
+
pyntcli/commands/burp.py,sha256=2FqLc65SjuXdenUS1ggC6dGRU_iSA52Ft_8OnfGsm_8,11193
|
|
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
|
|
@@ -35,8 +35,8 @@ pyntcli/ui/ui_thread.py,sha256=OVTbiIFMg2KgxAvHf7yy86xGm4RVS2vj_VYZkMi-SRY,4956
|
|
|
35
35
|
tests/conftest.py,sha256=gToq5K74GtgeGQXjFvXSzMaE6axBYxAzcFG5XJPOXjI,427
|
|
36
36
|
tests/auth/test_login.py,sha256=KFlzWhXBAuwdi7GXf16gCB3ya94LQG2wjcSChE149rQ,3798
|
|
37
37
|
tests/store/test_cred_store.py,sha256=_7-917EtNC9eKEumO2_lt-7KuDmCwOZFaowCm7DbA_A,254
|
|
38
|
-
pyntcli-0.1.
|
|
39
|
-
pyntcli-0.1.
|
|
40
|
-
pyntcli-0.1.
|
|
41
|
-
pyntcli-0.1.
|
|
42
|
-
pyntcli-0.1.
|
|
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,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|