Skip to content

Commit

Permalink
Add dependency check for /proc/net/arp
Browse files Browse the repository at this point in the history
  • Loading branch information
bitplane committed Apr 3, 2012
1 parent 7318308 commit a73facc
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Discoverer_Arp.py
@@ -1,8 +1,14 @@
"""Discovers machines using ARP.
"""

import os

from Discoverer import Discoverer

# dependency check
if not os.path.exists('/proc/net/arp'):
raise ImportError('Discoverer_Arp requires /proc/net/arp access')

class Discoverer_Arp(Discoverer):
"""ARP Discoverer.
This passive discoverer queries the system's Address Resolution
Expand All @@ -12,8 +18,14 @@ class Discoverer_Arp(Discoverer):
isIntrusive = False
isPassive = True

def validate(self):
"""Raise an exception if dependencies aren't met.
This discoverer requires /proc/net/arp.
"""

def runOnce(self):
"""Adds machines from the ARP cache to the caller's queue."""
"""Adds machines from the ARP cache to the caller's queue.
"""
input = open('/proc/net/arp')
# ignore the first line (header)
input.next()
Expand Down

0 comments on commit a73facc

Please sign in to comment.