Skip to content

Commit

Permalink
fixing code on arpscanner and changing to pip
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberRoute committed Oct 2, 2024
1 parent c5fc4d6 commit 30861b6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,18 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

# Install pip and pipenv
- name: Install pip and pipenv
# Install pip
- name: Install pip
run: |
python -m pip install --upgrade pip
pip install pipenv
# Install dependencies using pipenv and explicitly specify the Python version
- name: Install dependencies with pipenv
run: |
pipenv install --dev --python $(which python)
pip install -r requirements.txt
# Run pylint within the pipenv environment
- name: Analyse code with pylint
run: |
pipenv run pylint $(find . -type f -name "*.py" ! -path "./ui/*")
pylint $(find . -type f -name "*.py" ! -path "./ui/*")
6 changes: 2 additions & 4 deletions core/arp_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def __init__(self, interface, oui_url, parent=None):
# Initialize scanner and device info storage
self.scanner_timer = None
self.device_info = {} # Store dynamic device info here
self.arp_scanner_thread = None

def setup_ui_elements(self):
"""Sets up the UI elements and connections."""
Expand Down Expand Up @@ -158,17 +159,15 @@ def setup_scanner_timer(self):
def start_scan(self):
"""Starts scanning the network."""
# Check if there's already a running scan, and don't start another one
if hasattr(self, 'arp_scanner_thread') and self.arp_scanner_thread.isRunning():
if self.arp_scanner_thread is not None and self.arp_scanner_thread.isRunning():
print("Scan is already in progress.")
return

# Create and start a new ARP scan thread
self.arp_scanner_thread = ARPScannerThread(self.interface, self.mac_vendor_lookup)

# Connect signals to handle thread completion and verbose output
self.arp_scanner_thread.finished.connect(self.handle_scan_results)
self.arp_scanner_thread.verbose_output.connect(self.update_tab7_verbose_output)

# Start the thread
self.arp_scanner_thread.start()
print("Started ARP scan.")
Expand Down Expand Up @@ -253,7 +252,6 @@ def run(self):
print(f"Error during ARP scan: {e}")
self.finished.emit([])
return

for _, packet in enumerate(arp_packets):
if packet[1].haslayer(ARP):
ip_address = packet[1][ARP].psrc
Expand Down

0 comments on commit 30861b6

Please sign in to comment.