An open API service indexing awesome lists of open source software.

https://github.com/bengabay11/networks

Python Network Operations for Humans
https://github.com/bengabay11/networks

arp-spoofing networking ping port-scanning python scapy socket traceroute

Last synced: 4 days ago
JSON representation

Python Network Operations for Humans

Awesome Lists containing this project

README

          


# networks
Python Network Operations for Humans


## Table of contents
1. [networks](#networks)
2. [Table of contents](#table-of-contents)
4. [Examples](#examples)
* [Traceroute](#traceroute)
* [Arp Spoofing](#arp-spoofing)
* [Port Scanning](#port-scanning)
* [Ping](#ping)


## Examples


### Traceroute
Perform trace to the given host.
```pycon
>>> import networks
>>> stations = networks.trace("www.google.com", max_hops=20, timeout=5)
>>> stations
['192.168.1.1', '0.0.0.0', None, '172.18.9.214', '172.17.3.118', None, None, '209.85.241.75', '172.217.18.100']
```


### Arp Spoofing
Perform arp spoofing attack on the given target.
```pycon
>>> import networks
>>> target = "192.168.1.40"
>>> gateway = "192.168.1.1"
>>> networks.arp_spoofing(target, gateway, interval=1, timeout=120)
```


### Port Scanning
Perform port scanning on the given target.
```pycon
>>> import networks
>>> ports = networks.port_scanning("192.168.1.40", min_port=78, max_port=81, timeout=30)
>>> ports
{78: False, 79: False, 80: True, 81: False}
```


### Ping
Send ICMP packets to the given host.
```pycon
>>> import networks
>>> host_up = networks.ping("www.google.com", count=5, ttl=30, timeout=5)
>>> host_up
True
```


### Hosts in segment
get hosts inside a given segment.
```pycon
>>> import networks
>>> hosts = networks.get_hosts_in_segment("192.168.1.0")
>>> hosts
['192.168.1.1', '192.168.1.40', '192.168.1.23']
```