Detectors Documentation
Contains code documentation for pyhtools.Detectors
ARP spoof detector
Helps to detect ARP spoofing/poisoning attacks in the network
SpoofDetector
SpoofDetector class to detect Local MITM attacks
Source code in pyhtools\detectors\arp_spoof_detector.py
__init__(interface)
SpoofDetector class constructor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
interface |
str
|
network interface on which spoofing needs to be detected |
required |
Returns:
Type | Description |
---|---|
None
|
None |
check_spoof(packet)
checks if machine is under ARP/MITM attack
Parameters:
Name | Type | Description | Default |
---|---|---|---|
packet |
scapy.Packet
|
sniffed scapy packet from the interface |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if ARP spoofing/poisoning detected else False |
Source code in pyhtools\detectors\arp_spoof_detector.py
get_mac(ip)
returns mac address of the ip
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ip |
str
|
ip address of the string |
required |
Returns:
Name | Type | Description |
---|---|---|
str | Mac address of the ip in the network |
Source code in pyhtools\detectors\arp_spoof_detector.py
start()
captures and processes packets to check whether network is being attacked or not
Parameters:
Name | Type | Description | Default |
---|---|---|---|
None |
required |
Returns:
Type | Description |
---|---|
None |
Win Block USB
Blocks all root hubs on windows machine
block_root_hubs()
Blocks USB root hubs on windows machine
Returns:
Type | Description |
---|---|
None |
Source code in pyhtools\detectors\win_block_usb.py
run_cmd(cmd, succ_msg, err_msg, succ_rcode=0)
Run shell commands
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cmd |
str
|
command to be executed |
required |
succ_msg |
str
|
message to be logged if cmd is executed successfully |
required |
err_msg |
str
|
message to be logged if cmd is interrupted |
required |
succ_rcode |
int
|
return status code after successfully executing code |
0
|
Returns:
Name | Type | Description |
---|---|---|
tuple |
tuple
|
returns executed command output/error along with status code |