lanscape 1.3.1a3__py3-none-any.whl → 1.3.1a4__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.

Potentially problematic release.


This version of lanscape might be problematic. Click here for more details.

@@ -76,7 +76,7 @@ class IPAlive:
76
76
  if os_name == "windows":
77
77
  # -n count, -w timeout in ms
78
78
  cmd = ['ping', '-n', str(ping_count), '-w', str(timeout*1000)]
79
- else:
79
+ else: # Linux, macOS, and other Unix-like systems
80
80
  # -c count, -W timeout in s
81
81
  cmd = ['ping', '-c', str(ping_count), '-W', str(timeout)]
82
82
 
@@ -211,9 +211,9 @@ mac_selector = MacSelector()
211
211
 
212
212
  def get_ip_address(interface: str):
213
213
  """
214
- Get the IP address of a network interface on Windows or Linux.
214
+ Get the IP address of a network interface on Windows, Linux, or macOS.
215
215
  """
216
- def linux():
216
+ def unix_like(): # Combined Linux and macOS
217
217
  try:
218
218
  import fcntl
219
219
  import struct
@@ -239,17 +239,15 @@ def get_ip_address(interface: str):
239
239
  # Call the appropriate function based on the platform
240
240
  if psutil.WINDOWS:
241
241
  return windows()
242
- elif psutil.LINUX:
243
- return linux()
244
- else:
245
- return None
242
+ else: # Linux, macOS, and other Unix-like systems
243
+ return unix_like()
246
244
 
247
245
  def get_netmask(interface: str):
248
246
  """
249
247
  Get the netmask of a network interface.
250
248
  """
251
249
 
252
- def linux():
250
+ def unix_like(): # Combined Linux and macOS
253
251
  try:
254
252
  import fcntl
255
253
  sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
@@ -273,7 +271,8 @@ def get_netmask(interface: str):
273
271
 
274
272
  if psutil.WINDOWS:
275
273
  return windows()
276
- return linux()
274
+ else: # Linux, macOS, and other Unix-like systems
275
+ return unix_like()
277
276
 
278
277
  def get_cidr_from_netmask(netmask: str):
279
278
  """
@@ -29,22 +29,12 @@ def open_webapp(url: str) -> bool:
29
29
  """
30
30
  start = time.time()
31
31
  try:
32
- if sys.platform.startswith("darwin"):
33
- # macOS does not support chrome-style app mode via the generic
34
- # method. Fallback to the system "open" command which will use the
35
- # default browser.
36
- cmd = """"$(mdfind 'kMDItemCFBundleIdentifier == "com.google.Chrome"' | head -n1)/Contents/MacOS/Google Chrome" """
37
- cmd += f' --app="{url}"'
38
- subprocess.run(cmd, check=True, shell=True)
32
+ exe = get_default_browser_executable()
33
+ if not exe:
34
+ raise RuntimeError('Unable to find browser binary')
35
+ log.debug(f'Opening {url} with {exe}')
39
36
 
40
- else:
41
-
42
- exe = get_default_browser_executable()
43
- if not exe:
44
- raise RuntimeError('Unable to find browser binary')
45
- log.debug(f'Opening {url} with {exe}')
46
-
47
- subprocess.run(f'{exe} --app="{url}"')
37
+ subprocess.run(exe, check=True, shell=True)
48
38
 
49
39
  if time.time() - start < 2:
50
40
  log.debug(f'Unable to hook into closure of UI, listening for flask shutdown')
@@ -131,7 +121,19 @@ def get_default_browser_executable() -> Optional[str]:
131
121
  return None
132
122
 
133
123
  elif sys.platform.startswith("darwin"):
134
- # macOS will use the system 'open' command to launch the default browser
124
+ # macOS: try to find Chrome first for app mode support, fallback to default
125
+ try:
126
+ p = subprocess.run(
127
+ ["mdfind", "kMDItemCFBundleIdentifier == 'com.google.Chrome'"],
128
+ capture_output=True, text=True, check=True
129
+ )
130
+ chrome_paths = p.stdout.strip().split('\n')
131
+ if chrome_paths and chrome_paths[0]:
132
+ return f"\"{chrome_paths[0]}/Contents/MacOS/Google Chrome\""
133
+ except subprocess.CalledProcessError:
134
+ pass
135
+
136
+ # Fallback to system default
135
137
  return "/usr/bin/open"
136
138
 
137
139
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lanscape
3
- Version: 1.3.1a3
3
+ Version: 1.3.1a4
4
4
  Summary: A python based local network scanner
5
5
  Author-email: Michael Dennis <michael@dipduo.com>
6
6
  Project-URL: Homepage, https://github.com/mdennis281/py-lanscape
@@ -6,13 +6,13 @@ lanscape/libraries/errors.py,sha256=DaercNEZD_tUuXF7KsNk3SD6AqAwT-S7fvzpEybVn08,
6
6
  lanscape/libraries/ip_parser.py,sha256=ElXz3LU5CUYWqKOHEyrj5Y4Iv6OBtoSlbCcxhCsibfQ,2226
7
7
  lanscape/libraries/logger.py,sha256=doD8KKb4TNWDwVXc1VR7NK4UdharrAoRHl8vZnSAupI,1407
8
8
  lanscape/libraries/mac_lookup.py,sha256=-dRV0ygtjjh3JkgL3GTi_5-w7pcZ1oj4XVH4chjsmRs,2121
9
- lanscape/libraries/net_tools.py,sha256=JU4mnQptO3-WGGlGR4lCRvOM8qpoCIvw6CuApiTQ-t4,11855
9
+ lanscape/libraries/net_tools.py,sha256=_XWdZjboJ76dIoi90gDkk2fUzvEKHPsy2TQ7URj7QlE,12040
10
10
  lanscape/libraries/port_manager.py,sha256=fNext3FNfGnGYRZK9RhTEwQ2K0e0YmmMlhK4zVAvoCw,1977
11
11
  lanscape/libraries/runtime_args.py,sha256=ICX_JkOmqDQdewZNfRxJb9jMggDw1XqF5CxM9zXZE_Q,1947
12
12
  lanscape/libraries/service_scan.py,sha256=jLU84ZoJnqSQbE30Zly2lm2zHrCGutNXjla1sEvp1hE,1949
13
13
  lanscape/libraries/subnet_scan.py,sha256=0LW_xdoL-PRp59rJr6r6pSL3LiXEO_SJnjdrgEF_pO8,13120
14
14
  lanscape/libraries/version_manager.py,sha256=v-IsZ7sYIsNRiraIRckGZthlyL0iTuscR6jF_o9LBK8,1720
15
- lanscape/libraries/web_browser.py,sha256=geXxw5xv9y_XGwMc7k8agazGzqibpl2TkLfvTz-wE1k,4981
15
+ lanscape/libraries/web_browser.py,sha256=vgyue0eqLyCDO1mergpCJrgxc1hrcPgzW7DFIyDQzgo,4992
16
16
  lanscape/resources/mac_addresses/convert_csv.py,sha256=w3Heed5z2mHYDEZNBep3_hNg4dbrp_N6J54MGxnrq4s,721
17
17
  lanscape/resources/mac_addresses/mac_db.json,sha256=ygtFSwNwJzDlg6hmAujdgCyzUjxt9Di75J8SO4xYIs8,2187804
18
18
  lanscape/resources/ports/convert_csv.py,sha256=mWe8zucWVfnlNEx_ZzH5Vc3tJJbdi-Ih4nm2yKNrRN0,720
@@ -65,8 +65,8 @@ lanscape/ui/templates/scan/ip-table-row.html,sha256=ptY24rxJRaA4PEEQRDncaq6Q0ql5
65
65
  lanscape/ui/templates/scan/ip-table.html,sha256=ds__UP9JiTKf5IxCmTMzw--eN_yg1Pvn3Nj1KvQxeZg,940
66
66
  lanscape/ui/templates/scan/overview.html,sha256=FsX-jSFhGKwCxZGKE8AMKk328UuawN6O9RNTzYvIOts,1205
67
67
  lanscape/ui/templates/scan/scan-error.html,sha256=Q4eZM5ThrxnFaWOSTUpK8hA2ksHwhxOBTaVUCLALhyA,1032
68
- lanscape-1.3.1a3.dist-info/licenses/LICENSE,sha256=cCO-NbS01Ilwc6djHjZ7LIgPFRkRmWdr0fH2ysXKioA,1090
69
- lanscape-1.3.1a3.dist-info/METADATA,sha256=xHhw_GlkbSRLen_UqJjJlKDZvsB9Bk5pCv3wXtbYf3A,2567
70
- lanscape-1.3.1a3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
71
- lanscape-1.3.1a3.dist-info/top_level.txt,sha256=E9D4sjPz_6H7c85Ycy_pOS2xuv1Wm-ilKhxEprln2ps,9
72
- lanscape-1.3.1a3.dist-info/RECORD,,
68
+ lanscape-1.3.1a4.dist-info/licenses/LICENSE,sha256=cCO-NbS01Ilwc6djHjZ7LIgPFRkRmWdr0fH2ysXKioA,1090
69
+ lanscape-1.3.1a4.dist-info/METADATA,sha256=TdipW4jw0j6URgjkZk6RSo3LH67QsWy1f-7edKU2bNQ,2567
70
+ lanscape-1.3.1a4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
71
+ lanscape-1.3.1a4.dist-info/top_level.txt,sha256=E9D4sjPz_6H7c85Ycy_pOS2xuv1Wm-ilKhxEprln2ps,9
72
+ lanscape-1.3.1a4.dist-info/RECORD,,