Skip to content

Commit

Permalink
refactor of arp_scanner
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberRoute committed Sep 21, 2024
1 parent 7f819d9 commit e62dc11
Showing 1 changed file with 33 additions and 14 deletions.
47 changes: 33 additions & 14 deletions core/arp_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,49 @@
"""
import io
import sys
from PySide6.QtWidgets import *
from ui.ui_arpscan import Ui_DeviceDiscovery
from PySide6.QtGui import *
from PySide6.QtCore import *
from PyQt6.QtCore import QThread, pyqtSignal
import scapy.all as scapy
import socket
import netifaces
import core.networking as net
import core.sniffer as sniffer
import core.vendor as vendor
import scapy.all as scapy
from PySide6.QtWidgets import ( # pylint: disable=E0611
QMainWindow,
QVBoxLayout,
QLabel,
QWidget,
QDialog,
QListWidget,
QListWidgetItem
)
from PySide6.QtGui import QIcon, QFont, QColor # pylint: disable=E0611
from PySide6.QtCore import QRunnable, Slot, Qt, QThreadPool, QTimer # pylint: disable=E0611
from PyQt6.QtCore import QThread, pyqtSignal # pylint: disable=E0611
from ui.ui_arpscan import Ui_DeviceDiscovery # pylint: disable=E0401
from core import sniffer
from core import vendor
from core.platform import get_os
import core.networking as net



class DeviceDetailsWindow(QMainWindow):
def __init__(self, ip_address, mac_address, hostname, vendor):

class DeviceDetailsWindow(QMainWindow): # pylint: disable=too-few-public-methods
"""
A window that displays detailed information about a network device.
Attributes:
ip_address (str): The IP address of the device.
mac_address (str): The MAC address of the device.
hostname (str): The hostname of the device.
vendor (str): The vendor of the device.
"""
def __init__(self, ip_address, mac_address, hostname, device_vendor):
super().__init__()
self.setWindowTitle("Device Details")

layout = QVBoxLayout()
layout.addWidget(QLabel(f"IP Address: {ip_address}"))
layout.addWidget(QLabel(f"MAC Address: {mac_address}"))
layout.addWidget(QLabel(f"Hostname: {hostname}"))
layout.addWidget(QLabel(f"Vendor: {vendor}"))
layout.addWidget(QLabel(f"Vendor: {device_vendor}"))

central_widget = QWidget()
central_widget.setLayout(layout)
Expand Down Expand Up @@ -176,8 +195,8 @@ def start_scan(self):

@Slot(list)
def handle_scan_results(self, results):
for ip_address, mac, hostname, vendor, packet in results:
label = f"{ip_address} {mac} {hostname} {vendor}"
for ip_address, mac, hostname, device_vendor, packet in results:
label = f"{ip_address} {mac} {hostname} {device_vendor}"
items = self._ui.list.findItems(label, Qt.MatchExactly)
if not items:
item = QListWidgetItem(label)
Expand Down

0 comments on commit e62dc11

Please sign in to comment.