https://github.com/kyhau/phpipam-api-helper
A simple phpIPAM API helper script finding possible subnets for an IP address.
https://github.com/kyhau/phpipam-api-helper
hacktoberfest ipam phpipam
Last synced: 5 months ago
JSON representation
A simple phpIPAM API helper script finding possible subnets for an IP address.
- Host: GitHub
- URL: https://github.com/kyhau/phpipam-api-helper
- Owner: kyhau
- Created: 2020-09-26T10:38:02.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2026-01-11T21:01:04.000Z (5 months ago)
- Last Synced: 2026-01-12T00:53:18.512Z (5 months ago)
- Topics: hacktoberfest, ipam, phpipam
- Language: Python
- Homepage:
- Size: 54.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# phpipam_api_helper
A simple phpIPAM API helper script for finding possible subnets of the given IP address.
## Usage
1. Create `~/.ipam/token.json`
```
{
"ApiPath": "your-phpipam-api-url",
"AppToken": "your-api-token"
}
```
2. Install requirements
```
# Optional: create and activate virtualenv
virtualenv env
. env/bin/activate
pip install -r requirements.txt
```
3. To find possible subnets of an IP address
```
python phpipam_api_helper.py --ip
```
When running the script the first time, the script makes API request to the phpIPAM to retrieve info of all subnets, then save the data to `~/.ipam/data.json`. So when making subsequent calls, the scripts use the data in this local file instead of making API calls again.
4. To enforce making phpIPAM API calls instead of the local copy of IPAM data
```
python phpipam_api_helper.py --ip --refresh
```
## Notes
1. To create App ID and token, see https://phpipam.net/api/api_curl_example/
2. Test access:
```
curl -X GET https:///api//addresses/tags/ -i --header 'token: ' --insecure
```
3. `url_rewrite` is required for API to work. See https://phpipam.net/api-documentation/
4. See https://github.com/phpipam/phpipam/issues/2624