https://github.com/marplex/nat-port-starvation
Fill the NAT port mapping table with useless ip/port records
https://github.com/marplex/nat-port-starvation
Last synced: about 1 year ago
JSON representation
Fill the NAT port mapping table with useless ip/port records
- Host: GitHub
- URL: https://github.com/marplex/nat-port-starvation
- Owner: Marplex
- Created: 2022-03-25T11:29:01.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-03-25T11:29:29.000Z (about 4 years ago)
- Last Synced: 2025-01-30T12:29:42.888Z (over 1 year ago)
- Language: Python
- Size: 1000 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NAT Port Starvation
Fill the NAT port mapping table with useless port/ip records.
## How it works
```python
for sport in range(0, 60999):
udp_header = struct.pack('!HHHH', sport, dport, length, checksum)
s.sendto(udp_header+data, ('1.1.1.1', 0));
```
I made this tool for fun while learning NAT, specifically port mapping.
On the transport layer, TCP and UDP protocols use source and destination ports to communicate with other hosts.
To connect with servers out of the local network, the router creates and maintains a table associating internal port/ip to destination port/ip.
| LAN | WAN |
| :---------------: | :----------------: |
| 192.168.1.2: 1546 | 230.100.10.1: 7777 |
| 192.168.1.2: 1547 | 230.100.10.1: 7778 |
If never used, entries on this table are deleted after some time (depends on the router). But if you are quick, you can fill this table with junk data, leaving no space for real requests and therefore "disabling" access to the WAN.
## How to use
Just run `main.py` and you'll disable internet access for 1/2 minutes depending on your router (or it might not work)