arptools
CLI tools to do network analysis with ARP packets.
- arp_announcement(mapping: tuple[str, str], ethernet_src: str | None = None, ethernet_dst: str | None = None, count: int = 0, interval: float = 1.0, verbose: int | None = None) None [source]
Sends and ARP announcement advertising the given MAC/IP mapping.
- Parameters:
- Return type:
- arp_probe(target_ip: str, count: int = 0, interval: float = 1.0, quit_on_first_reply: bool = False, timeout: int | None = None, verbose: int | None = None) None [source]
Sends an ARP probe to the specified target.
- arp_pscan(target_range: str, ttl: int = 300) None [source]
Performs a passive scan of the network by extracting MAC/IP pairs from broadcast ARP requests.
- arp_reply(target_ip: str, ethernet_src: str | None = None, ethernet_dst: str | None = None, arp_hwsrc: str | None = None, arp_psrc: str | None = None, count: int = 0, interval: float = 1.0, verbose: int | None = None, prn: ~collections.abc.Callable[[~scapy.plist.QueryAnswer], str | None] = <function _prn>, prnfail: ~collections.abc.Callable[[~scapy.packet.Packet | ~scapy.plist.PacketList | ~scapy.plist.SndRcvList], str | None] = <function _prnfail>) None [source]
Sends an ARP reply packet.
- Parameters:
target_ip (
str
) – the target IP of the ARP reply.ethernet_src (
Optional
[str
]) – the source MAC address of the Ethernet frame.ethernet_dst (
Optional
[str
]) – the destination MAC address of the Ethernet frame.arp_hwsrc (
Optional
[str
]) – the hardware source address of the ARP packet.arp_psrc (
Optional
[str
]) – the protocol source address of the ARP packet.count (
int
) – how many packet to send.interval (
float
) – time interval between packets (only used when count is 0).prn (
Callable
[[QueryAnswer
],str
|None
]) – function used to print packets that have received an answer.prnfail (
Callable
[[Packet
|PacketList
|SndRcvList
],str
|None
]) – function used to print packets that have not received an answer.
- Return type:
- arp_request(target_ip: str, ethernet_src: str | None = None, ethernet_dst: str | None = None, arp_hwsrc: str | None = None, arp_psrc: str | None = None, count: int = 0, interval: float = 1.0, quit_on_first_reply: bool = False, timeout: int | None = None, ignore_unanswered: bool = False, verbose: int | None = None, prn: ~collections.abc.Callable[[~scapy.plist.QueryAnswer], str | None] = <function _prn>, prn_qofr: ~collections.abc.Callable[[~scapy.plist.QueryAnswer], None] = <function _prn_qofr>, prnfail: ~collections.abc.Callable[[~scapy.packet.Packet | ~scapy.plist.PacketList | ~scapy.plist.SndRcvList], str | None] = <function _prnfail>) None [source]
Sends an ARP request packet.
- Parameters:
target_ip (
str
) – the target IP of the ARP request.ethernet_src (
Optional
[str
]) – the source MAC address of the Ethernet frame.ethernet_dst (
Optional
[str
]) – the destination MAC address of the Ethernet frame.arp_hwsrc (
Optional
[str
]) – the hardware source address of the ARP packet.arp_psrc (
Optional
[str
]) – the protocol source address of the ARP packet.count (
int
) – how many packet to send.interval (
float
) – time interval between packets (only used when count is 0).quit_on_first_reply (
bool
) – sends packets until it gets a reply.ignore_unanswered (
bool
) – whether to print unanswered packets.prn (
Callable
[[QueryAnswer
],str
|None
]) – function used to print packets that have received an answer.prn_qofr (
Callable
[[QueryAnswer
],None
]) – function used to print packets that have received an answer when quit_on_first_reply is True.prnfail (
Callable
[[Packet
|PacketList
|SndRcvList
],str
|None
]) – function used to print packets that have not received an answer.
- Return type: