lanscape 1.4.4__py3-none-any.whl → 1.5.0__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.

@@ -62,7 +62,10 @@ class SubnetScanner():
62
62
  """
63
63
  self._set_stage('scanning devices')
64
64
  self.running = True
65
- with ThreadPoolExecutor(max_workers=self.cfg.t_cnt('isalive')) as executor:
65
+ with ThreadPoolExecutor(
66
+ max_workers=self.cfg.t_cnt('isalive'),
67
+ thread_name_prefix="DeviceAlive") as executor:
68
+
66
69
  futures = {executor.submit(self._get_host_details, str(
67
70
  ip)): str(ip) for ip in self.subnet}
68
71
  for future in as_completed(futures):
@@ -187,7 +190,7 @@ class SubnetScanner():
187
190
  """
188
191
  Get the MAC address and open ports of the given host.
189
192
  """
190
- device = Device(host)
193
+ device = Device(ip=host)
191
194
  device.alive = self._ping(device)
192
195
  self.results.scanned()
193
196
  if not device.alive:
@@ -199,7 +202,8 @@ class SubnetScanner():
199
202
 
200
203
  @terminator
201
204
  def _scan_network_ports(self):
202
- with ThreadPoolExecutor(max_workers=self.cfg.t_cnt('port_scan')) as executor:
205
+ with ThreadPoolExecutor(max_workers=self.cfg.t_cnt('port_scan'),
206
+ thread_name_prefix="DevicePortScanParent") as executor:
203
207
  futures = {executor.submit(
204
208
  self._scan_ports, device): device for device in self.results.devices}
205
209
  for future in futures:
@@ -210,7 +214,9 @@ class SubnetScanner():
210
214
  def _scan_ports(self, device: Device):
211
215
  self.log.debug(f'[{device.ip}] Initiating port scan')
212
216
  device.stage = 'scanning'
213
- with ThreadPoolExecutor(max_workers=self.cfg.t_cnt('port_test')) as executor:
217
+ with ThreadPoolExecutor(
218
+ max_workers=self.cfg.t_cnt('port_test'),
219
+ thread_name_prefix=f"{device.ip}-PortScan") as executor:
214
220
  futures = {executor.submit(self._test_port, device, int(
215
221
  port)): port for port in self.ports}
216
222
  for future in futures:
@@ -226,9 +232,9 @@ class SubnetScanner():
226
232
  If port open, determine service.
227
233
  Device class handles tracking open ports.
228
234
  """
229
- is_alive = host.test_port(port)
235
+ is_alive = host.test_port(port, self.cfg.port_scan_config)
230
236
  if is_alive and self.cfg.task_scan_port_services:
231
- host.scan_service(port)
237
+ host.scan_service(port, self.cfg.service_scan_config)
232
238
  return is_alive
233
239
 
234
240
  @terminator
@@ -264,6 +270,7 @@ class ScannerResults:
264
270
  # Scan statistics
265
271
  self.devices_total: int = len(list(scan.subnet))
266
272
  self.devices_scanned: int = 0
273
+ self.port_list_length: int = len(scan.ports)
267
274
  self.devices: List[Device] = []
268
275
 
269
276
  # Status tracking