lanscape 1.3.6b1__py3-none-any.whl → 1.3.8__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.

@@ -6,7 +6,6 @@ import re
6
6
  import socket
7
7
  import subprocess
8
8
  import time
9
- import random
10
9
  from typing import List
11
10
  import psutil
12
11
 
@@ -218,10 +217,13 @@ class Poker():
218
217
 
219
218
  @timeout_enforcer(enforcer_timeout, raise_on_timeout=True)
220
219
  def do_poke():
221
- for _ in range(cfg.attempts):
220
+ # Use a small set of common ports likely to be filtered but still trigger ARP
221
+ common_ports = [80, 443, 22]
222
+ for i in range(cfg.attempts):
222
223
  sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
223
224
  sock.settimeout(cfg.timeout)
224
- sock.connect_ex((device.ip, random.randint(1024, 65535))) # port shouldn't matter
225
+ port = common_ports[i % len(common_ports)]
226
+ sock.connect_ex((device.ip, port))
225
227
  sock.close()
226
228
 
227
229
  do_poke()
@@ -178,9 +178,9 @@ class ScanConfig(BaseModel):
178
178
  subnet: str
179
179
  port_list: str
180
180
  t_multiplier: float = 1.0
181
- t_cnt_port_scan: int = os.cpu_count()
182
- t_cnt_port_test: int = os.cpu_count() * 4
183
- t_cnt_isalive: int = os.cpu_count() * 6
181
+ t_cnt_port_scan: int = os.cpu_count() or 4
182
+ t_cnt_port_test: int = (os.cpu_count() or 4) * 4
183
+ t_cnt_isalive: int = (os.cpu_count() or 4) * 6
184
184
 
185
185
  task_scan_ports: bool = True
186
186
  # below wont run if above false
@@ -5,7 +5,7 @@ API endpoints for subnet testing and listing.
5
5
  import traceback
6
6
  from flask import request, jsonify
7
7
  from lanscape.ui.blueprints.api import api_bp
8
- from lanscape.libraries.net_tools import get_all_network_subnets
8
+ from lanscape.libraries.net_tools import get_all_network_subnets, is_arp_supported
9
9
  from lanscape.libraries.ip_parser import parse_ip_input
10
10
  from lanscape.libraries.errors import SubnetTooLargeError
11
11
  from lanscape.libraries.scan_config import DEFAULT_CONFIGS
@@ -46,7 +46,26 @@ def list_subnet():
46
46
  def get_default_configs():
47
47
  """
48
48
  Get default scan configurations.
49
+
50
+ When active ARP lookups are not supported on the host system, adjust any
51
+ presets that rely on ``ARP_LOOKUP`` to use the ``POKE_THEN_ARP`` fallback
52
+ instead. This keeps presets such as ``accurate`` usable without requiring
53
+ frontend overrides.
49
54
  """
50
- return jsonify(
51
- {key: config.to_dict() for key, config in DEFAULT_CONFIGS.items()}
52
- )
55
+ arp_supported = is_arp_supported()
56
+
57
+ configs = {}
58
+ for key, config in DEFAULT_CONFIGS.items():
59
+ config_dict = config.to_dict()
60
+
61
+ if not arp_supported:
62
+ lookup_types = list(config_dict.get('lookup_type') or [])
63
+ if 'ARP_LOOKUP' in lookup_types:
64
+ lookup_types = [lt for lt in lookup_types if lt != 'ARP_LOOKUP']
65
+ if 'POKE_THEN_ARP' not in lookup_types:
66
+ lookup_types.append('POKE_THEN_ARP')
67
+ config_dict['lookup_type'] = lookup_types
68
+
69
+ configs[key] = config_dict
70
+
71
+ return jsonify(configs)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lanscape
3
- Version: 1.3.6b1
3
+ Version: 1.3.8
4
4
  Summary: A python based local network scanner
5
5
  Author-email: Michael Dennis <michael@dipduo.com>
6
6
  License-Expression: MIT
@@ -30,6 +30,7 @@ A python based local network scanner.
30
30
 
31
31
  PyPi Stats:
32
32
 
33
+ ![Version](https://img.shields.io/pypi/v/lanscape)
33
34
  ![Monthly Downloads](https://img.shields.io/pypi/dm/lanscape)
34
35
 
35
36
  Latest release:
@@ -38,14 +39,14 @@ Latest release:
38
39
  ![Beta](https://img.shields.io/github/v/tag/mdennis281/LANScape?filter=pre-releases%2F*b*&label=Beta)
39
40
  ![Alpha](https://img.shields.io/github/v/tag/mdennis281/LANScape?filter=pre-releases%2F*a*&label=Alpha)
40
41
 
41
- Tests:
42
+ Health:
42
43
 
43
44
  ![pytest](https://img.shields.io/github/actions/workflow/status/mdennis281/LANscape/test.yml?branch=main&label=pytest)
44
45
  ![packaging](https://img.shields.io/github/actions/workflow/status/mdennis281/LANscape/test-package.yml?label=packaging)
45
46
  ![pylint](https://img.shields.io/github/actions/workflow/status/mdennis281/LANscape/pylint.yml?branch=main&label=pylint)
46
47
 
47
48
 
48
- ## Local Run
49
+ ## Installation
49
50
  ```sh
50
51
  pip install lanscape
51
52
  python -m lanscape
@@ -73,16 +74,14 @@ The program does an ARP lookup to determine the MAC address. This lookup
73
74
  can sometimes require admin-level permissions to retrieve accurate results.
74
75
  *Try elevating your shell before execution.*
75
76
 
76
- ### Message "WARNING: No libpcap provider available ! pcap won't be used"
77
- This is a missing dependency related to the ARP lookup. This is handled in the code, but you would get marginally faster/better results with this installed: [npcap download](https://npcap.com/#download)
78
-
79
77
  ### The accuracy of the devices found is low
80
- I use a combination of ARP and Ping to determine if a device is online. This method drops in stability when used in many threads.
78
+ I use a combination of ARP, ICMP & port testing to determine if a device is online. Sometimes the scan settings can use some tuning to maximize both speed and accuracy.
79
+
81
80
  Recommendations:
82
81
 
83
- - Drop parallelism value (advanced dropdown)
84
- - Use python > 3.10 im noticing threadpool improvements after this version
85
- - Create a bug - I'm curious
82
+ - Adjust scan configuration
83
+ - Configure ARP lookup [ARP lookup setup](./support/arp-issues.md)
84
+ - Create a bug
86
85
 
87
86
 
88
87
  ### Something else
@@ -3,7 +3,7 @@ lanscape/__main__.py,sha256=PuY42yuCLAwHrOREJ6u2DgVyGX5hZKRQeoE9pajkNfM,170
3
3
  lanscape/libraries/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  lanscape/libraries/app_scope.py,sha256=EqYQRQcbjOPPcIOhFkIepcz2cKHmoUHxWj2JSoRJmzk,2542
5
5
  lanscape/libraries/decorators.py,sha256=SoNqfEInPyL-rrUKY6njK5d6Mwqu7Ix6He-BZRu2VKQ,5394
6
- lanscape/libraries/device_alive.py,sha256=4K-wGQr4dv-aPqMmzACYyF82uiIAfsqLTgdf8gj4Mik,6723
6
+ lanscape/libraries/device_alive.py,sha256=mwvHJp9rWV1_zfrE57aPKOsGp06fHdzrXOuGDWiZ2T8,6851
7
7
  lanscape/libraries/errors.py,sha256=QTf42UzR9Zxj1t1mdwfLvZIp0c9a5EItELOdCR7kTmE,1322
8
8
  lanscape/libraries/ip_parser.py,sha256=RgIEvHw_oQEcjUYOrvcpbfm4KThtH8L68WyhSOJNOfE,4201
9
9
  lanscape/libraries/logger.py,sha256=nzo6J8UdlMdhRkOJEDOIHKztoE3Du8PQZad7ixvNgeM,2534
@@ -11,7 +11,7 @@ lanscape/libraries/mac_lookup.py,sha256=PxBSMe3wEVDtivCsh5NclSAguZz9rqdAS7QshBiu
11
11
  lanscape/libraries/net_tools.py,sha256=nIvOV_qYXmWIBYEd5PqWH1Mkadg3I1T0vbcHPkzlw6I,15853
12
12
  lanscape/libraries/port_manager.py,sha256=3_ROOb6JEiB0NByZVtADuGcldFkgZwn1RKtvwgs9AIk,4479
13
13
  lanscape/libraries/runtime_args.py,sha256=2vIqRrcWr-NHRSBlZGrxh1PdkPY0ytkPguu8KZqy2L8,2543
14
- lanscape/libraries/scan_config.py,sha256=KkY5tzuEbTbUeQrMgbn95IArgYBerFRuu-JIPsQd7AA,8310
14
+ lanscape/libraries/scan_config.py,sha256=IOtwAaiy_f1r1KcsyTUVurOmo3kUmWdquAxWh8Gv39A,8329
15
15
  lanscape/libraries/service_scan.py,sha256=ZF4LL2gSI0T5oYEMjc8pCVtJkV1KIk4xP-AeEAkSdLc,1944
16
16
  lanscape/libraries/subnet_scan.py,sha256=lL2LzuxoTgPyvsdkPPEcZDqQPbCAGMHAjoX2slKGUKc,14136
17
17
  lanscape/libraries/version_manager.py,sha256=fIAv6bVHb_VCOrqT8Do53trxwEgR2mnZV82v3YGxJ14,2944
@@ -32,7 +32,7 @@ lanscape/ui/blueprints/__init__.py,sha256=WLnPfPE06684wArgKDDLfsW-1hKFlLe75AR7uL
32
32
  lanscape/ui/blueprints/api/__init__.py,sha256=5Z4Y7B36O-bNFenpomfuNhPuJ9dW_MC0TPUU3pCFVfA,103
33
33
  lanscape/ui/blueprints/api/port.py,sha256=8FuNcjF56wmgjoCZeaYrIakTGdshAmDjUmkjXHbaZ8I,1981
34
34
  lanscape/ui/blueprints/api/scan.py,sha256=lbwV5AciMGP-S2J_EaXcPOHeHywImzQ_bm2ZSJg-H5U,3331
35
- lanscape/ui/blueprints/api/tools.py,sha256=Dm5eAlWajr670H3O6note5hS_BZ888IGp2Rsdu2kXmY,1670
35
+ lanscape/ui/blueprints/api/tools.py,sha256=IhY_ldrnVYuZKFv6gsevr9LL5gfTnmVuR95zFc05Tlo,2452
36
36
  lanscape/ui/blueprints/web/__init__.py,sha256=NvgnjP0X4LwqVhSEyh5RUzoG45N44kHK1MEFlfvBxTg,118
37
37
  lanscape/ui/blueprints/web/routes.py,sha256=883puFTHePUEgwS4a2-Co6-gdLwr5NbOx0goUck7054,3571
38
38
  lanscape/ui/static/lanscape.webmanifest,sha256=07CqA-PQsO35KJD8R96sI3Pxix6UuBjijPDCuy9vM3s,446
@@ -67,8 +67,8 @@ lanscape/ui/templates/scan/ip-table-row.html,sha256=RANDsfW4xBATdtiLrxUlRouFSjgw
67
67
  lanscape/ui/templates/scan/ip-table.html,sha256=CP7AG8WHOgy3AyYCIN0wA2wO6n0H1X0F9IOncQtpPvE,914
68
68
  lanscape/ui/templates/scan/overview.html,sha256=xWj9jWDPg2KcPLvS8fnSins23_UXjKCdb2NJwNG2U2Q,1176
69
69
  lanscape/ui/templates/scan/scan-error.html,sha256=wmAYQ13IJHUoO8fAGNDjMvNml7tu4rsIU3Vav71ETlA,999
70
- lanscape-1.3.6b1.dist-info/licenses/LICENSE,sha256=VLoE0IrNTIc09dFm7hMN0qzk4T3q8V0NaPcFQqMemDs,1070
71
- lanscape-1.3.6b1.dist-info/METADATA,sha256=gFPPjGjX9PTEDsr1ykCtccH_TmmjyFB4BoI9IiCLUas,3346
72
- lanscape-1.3.6b1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
73
- lanscape-1.3.6b1.dist-info/top_level.txt,sha256=E9D4sjPz_6H7c85Ycy_pOS2xuv1Wm-ilKhxEprln2ps,9
74
- lanscape-1.3.6b1.dist-info/RECORD,,
70
+ lanscape-1.3.8.dist-info/licenses/LICENSE,sha256=VLoE0IrNTIc09dFm7hMN0qzk4T3q8V0NaPcFQqMemDs,1070
71
+ lanscape-1.3.8.dist-info/METADATA,sha256=zHjKdQjb2qNFHzqJrv_5OpAo10AFlT_8RCHfViunpvo,3121
72
+ lanscape-1.3.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
73
+ lanscape-1.3.8.dist-info/top_level.txt,sha256=E9D4sjPz_6H7c85Ycy_pOS2xuv1Wm-ilKhxEprln2ps,9
74
+ lanscape-1.3.8.dist-info/RECORD,,