Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafay Ghafoor authored Mar 26, 2018
1 parent 35c4d45 commit 7f0998a
Showing 1 changed file with 20 additions and 81 deletions.
101 changes: 20 additions & 81 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,98 +2,37 @@

A PTCL-Router API to interact with default router interface.

# Usage:

```
Usage: ptcl.py [-h] [-b [BLOCK]] [-sb] [-u [UNBLOCK]] [-a] [-r] [-sd]
[-s SHOW_ACTIVE] [-c] [-q [QUIET]]
Control PTCL router from command-line.
Options:
-h, --help show this help message and exit
-b [BLOCK], --block [BLOCK]
Block device.
-sb, --blocked_dev Display blocked devices.
-u [UNBLOCK], --unblock [UNBLOCK]
Unblock device.
-a, --active-devices Gets number of devices connected to the router.
-r, --restart Restart Router.
-sd, --show-dhcp Show DHCP Info.
-s SHOW_ACTIVE, --show-active SHOW_ACTIVE
Show Active Devices.
--configure Configure router settings.
-c [CLI], --cli [CLI]
CLI mode (used in conjunction with -u or -b).
```

# Examples:
# Status:

```
>>> python ptcl.py --configure # Configure router gateway, username and password
The API is currently under heavy development.

>>> python ptcl.py # Shows currently active devices.
# Usage:

>>> python ptcl.py -sa # Set custom aliases for mac addresses.
```python

>>> python ptcl.py -b USER # Block user from custom defined alias.
from router import Router
papi = Router(gateway='192.168.10.1', password='ptcl')

>>> python ptcl.py -ub USER # Unblock user from custom defined alias.
# Output the list of active devices
papi.stationinfo() # ['c8:94:bb:75:f6:23', '04:8d:38:f5:44:ef']

>>> python ptcl.py -b -c # Block devices from the active devices display.
# Number of active devices
len(papi.stationinfo() # 2

>>> python ptcl.py -sb # Show blocked users.
# Output DHCP info (dictionary with key-> hostname and values-> mac address, local IP, expire time)

>>> python ptcl.py -sd # Show DHCP info.
papi.dhcpinfo() # {'android-950c5330c76d8678': ['00:08:22:ca:e6:21', '192.168.1.9', '23 hours, 25 minutes, 39 seconds'] }

>>> python ptcl.py -r # Reboots router.
```

# Current-Features:

- Obtain station information, showing their hostnames alongside for better readability (devices currently connected to the router).
- Obtain DHCP information.
- Block and unblock devices using their mac addresses.
- Block and unblock devices using their predefined aliases.
- Reboot router.
- Over-ride hostnames associated to the mac address with custom hostnames.
- Display blocked devices.
- Added two modes for blocking users ( CLI-MODE and SILENT-MODE (Default) ).

# TODO:

- [X] Writing documentation for API usage.
- [ ] Port-Forwarding from command line.
- [ ] Parsing router logs.
- [X] Display number of active devices.
- [X] Optimize Regular Expressions.
- [ ] Obtaining Pin-Code of the router and changing it.
- [ ] Displaying current password of the SSID.
- [X] Setting up custom hostname for specific device (mac address).
- [ ] Changing router username and password from the command-line.
- [ ] Changing Router SSID-Name.
- [X] Add CLI MODE for unblocking devices.
- [ ] Option to change frequency 2.4 Ghz or 5 Ghz.
- [X] Testing on other routers from the same vendor.
- [ ] Option to change router transmission power.
- [X] Improving display for blocked devices.
- [ ] Time restriction for user (by specifying or choosing from station info) device mac address or hostname.
- [ ] Adding URL to block unnecessary use for a website, also time limit for a site usage.
- [X] Reboot router from script.
- [ ] Getting devices connection info in a nice CSV file.
- [X] CLI MODE and SILENT MODE for blocking devices.
# Block a device
papi.block('00:08:22:ca:e6:21')

# Set time limit for a device
papi.time_limit(username='Fred', mac='00:08:22:ca:e6:21', days='Mon-Thu', start='12', end='14:26')

# will create a profile named 'Fred' and set a time limit from 12:00-14:26, Monday to Thursday.

# Block a website
papi.web_filter(url='facebook.com')

```

0 comments on commit 7f0998a

Please sign in to comment.