sipinfo-cli 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sipinfo_cli-0.1.0/PKG-INFO +51 -0
- sipinfo_cli-0.1.0/README.md +40 -0
- sipinfo_cli-0.1.0/pyproject.toml +21 -0
- sipinfo_cli-0.1.0/setup.cfg +4 -0
- sipinfo_cli-0.1.0/src/ipinfo_cli/__init__.py +0 -0
- sipinfo_cli-0.1.0/src/ipinfo_cli/main.py +36 -0
- sipinfo_cli-0.1.0/src/sipinfo_cli.egg-info/PKG-INFO +51 -0
- sipinfo_cli-0.1.0/src/sipinfo_cli.egg-info/SOURCES.txt +10 -0
- sipinfo_cli-0.1.0/src/sipinfo_cli.egg-info/dependency_links.txt +1 -0
- sipinfo_cli-0.1.0/src/sipinfo_cli.egg-info/entry_points.txt +2 -0
- sipinfo_cli-0.1.0/src/sipinfo_cli.egg-info/requires.txt +2 -0
- sipinfo_cli-0.1.0/src/sipinfo_cli.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sipinfo-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Get IP information from terminal
|
|
5
|
+
Author-email: Mehdi <elmehdiiskandar3@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.8
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Requires-Dist: requests
|
|
10
|
+
Requires-Dist: colorama
|
|
11
|
+
|
|
12
|
+
# IPInfo
|
|
13
|
+
|
|
14
|
+
A command-line tool to get detailed information about any public IP address.
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
git clone https://github.com/Mehdi23-bit/ipinfo
|
|
19
|
+
cd ipinfo
|
|
20
|
+
pip install -r requirements.txt
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
python ipinfo.py <ip>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Examples
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
python ipinfo.py 8.8.8.8
|
|
33
|
+
python ipinfo.py 1.1.1.1
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Error Handling
|
|
37
|
+
|
|
38
|
+
| Input | Response |
|
|
39
|
+
|-------------|-------------------|
|
|
40
|
+
| Private IP | private addr |
|
|
41
|
+
| Loopback | loopback addr |
|
|
42
|
+
| Invalid IP | not a valid IP |
|
|
43
|
+
| No argument | Usage message |
|
|
44
|
+
| No internet | Connection error |
|
|
45
|
+
|
|
46
|
+
## Requirements
|
|
47
|
+
requests
|
|
48
|
+
colorama
|
|
49
|
+
## Author
|
|
50
|
+
|
|
51
|
+
**Mehdi** — [@Mehdi23-bit](https://github.com/Mehdi23-bit)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# IPInfo
|
|
2
|
+
|
|
3
|
+
A command-line tool to get detailed information about any public IP address.
|
|
4
|
+
## Installation
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
git clone https://github.com/Mehdi23-bit/ipinfo
|
|
8
|
+
cd ipinfo
|
|
9
|
+
pip install -r requirements.txt
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
python ipinfo.py <ip>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Examples
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
python ipinfo.py 8.8.8.8
|
|
22
|
+
python ipinfo.py 1.1.1.1
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Error Handling
|
|
26
|
+
|
|
27
|
+
| Input | Response |
|
|
28
|
+
|-------------|-------------------|
|
|
29
|
+
| Private IP | private addr |
|
|
30
|
+
| Loopback | loopback addr |
|
|
31
|
+
| Invalid IP | not a valid IP |
|
|
32
|
+
| No argument | Usage message |
|
|
33
|
+
| No internet | Connection error |
|
|
34
|
+
|
|
35
|
+
## Requirements
|
|
36
|
+
requests
|
|
37
|
+
colorama
|
|
38
|
+
## Author
|
|
39
|
+
|
|
40
|
+
**Mehdi** — [@Mehdi23-bit](https://github.com/Mehdi23-bit)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "sipinfo-cli"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Get IP information from terminal"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = {text = "MIT"}
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Mehdi", email = "elmehdiiskandar3@gmail.com"}
|
|
14
|
+
]
|
|
15
|
+
dependencies = [
|
|
16
|
+
"requests",
|
|
17
|
+
"colorama"
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
[project.scripts]
|
|
21
|
+
ipinfo = "ipinfo_cli.main:main" # ← this creates the CLI command
|
|
File without changes
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
def main():
|
|
2
|
+
# your existing code
|
|
3
|
+
import sys
|
|
4
|
+
import requests
|
|
5
|
+
import ipaddress
|
|
6
|
+
from colorama import init, Fore, Style
|
|
7
|
+
init(autoreset=True)
|
|
8
|
+
|
|
9
|
+
argv = sys.argv
|
|
10
|
+
try:
|
|
11
|
+
if len(argv) != 2:
|
|
12
|
+
raise ValueError("Usage: ipinfo <ip>")
|
|
13
|
+
ip_addr = ipaddress.ip_address(argv[1])
|
|
14
|
+
if ip_addr.is_private:
|
|
15
|
+
raise ValueError(f"{ip_addr} is a private addr")
|
|
16
|
+
if ip_addr.is_loopback:
|
|
17
|
+
raise ValueError(f"{ip_addr} is a loopback addr")
|
|
18
|
+
res = requests.get(f"https://ipinfo.io/{ip_addr}/json", timeout=5)
|
|
19
|
+
res.raise_for_status()
|
|
20
|
+
data = res.json()
|
|
21
|
+
print(f"{Fore.CYAN}──────────────────────────")
|
|
22
|
+
print(f" IP Info")
|
|
23
|
+
print(f"──────────────────────────{Style.RESET_ALL}")
|
|
24
|
+
print(f"{Fore.MAGENTA} ip :{Fore.WHITE} {data.get('ip')}")
|
|
25
|
+
print(f"{Fore.MAGENTA} city :{Fore.WHITE} {data.get('city')}")
|
|
26
|
+
print(f"{Fore.MAGENTA} country :{Fore.WHITE} {data.get('country')}")
|
|
27
|
+
print(f"{Fore.MAGENTA} org :{Fore.WHITE} {data.get('org')}")
|
|
28
|
+
print(f"{Fore.MAGENTA} timezone :{Fore.WHITE} {data.get('timezone')}")
|
|
29
|
+
print(f"{Fore.CYAN}──────────────────────────")
|
|
30
|
+
except requests.exceptions.ConnectionError:
|
|
31
|
+
print(f"{Fore.RED} no internet connection")
|
|
32
|
+
except Exception as e:
|
|
33
|
+
print(f"{Fore.RED} {e}")
|
|
34
|
+
|
|
35
|
+
if __name__ == '__main__':
|
|
36
|
+
main()
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sipinfo-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Get IP information from terminal
|
|
5
|
+
Author-email: Mehdi <elmehdiiskandar3@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.8
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Requires-Dist: requests
|
|
10
|
+
Requires-Dist: colorama
|
|
11
|
+
|
|
12
|
+
# IPInfo
|
|
13
|
+
|
|
14
|
+
A command-line tool to get detailed information about any public IP address.
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
git clone https://github.com/Mehdi23-bit/ipinfo
|
|
19
|
+
cd ipinfo
|
|
20
|
+
pip install -r requirements.txt
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
python ipinfo.py <ip>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Examples
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
python ipinfo.py 8.8.8.8
|
|
33
|
+
python ipinfo.py 1.1.1.1
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Error Handling
|
|
37
|
+
|
|
38
|
+
| Input | Response |
|
|
39
|
+
|-------------|-------------------|
|
|
40
|
+
| Private IP | private addr |
|
|
41
|
+
| Loopback | loopback addr |
|
|
42
|
+
| Invalid IP | not a valid IP |
|
|
43
|
+
| No argument | Usage message |
|
|
44
|
+
| No internet | Connection error |
|
|
45
|
+
|
|
46
|
+
## Requirements
|
|
47
|
+
requests
|
|
48
|
+
colorama
|
|
49
|
+
## Author
|
|
50
|
+
|
|
51
|
+
**Mehdi** — [@Mehdi23-bit](https://github.com/Mehdi23-bit)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
src/ipinfo_cli/__init__.py
|
|
4
|
+
src/ipinfo_cli/main.py
|
|
5
|
+
src/sipinfo_cli.egg-info/PKG-INFO
|
|
6
|
+
src/sipinfo_cli.egg-info/SOURCES.txt
|
|
7
|
+
src/sipinfo_cli.egg-info/dependency_links.txt
|
|
8
|
+
src/sipinfo_cli.egg-info/entry_points.txt
|
|
9
|
+
src/sipinfo_cli.egg-info/requires.txt
|
|
10
|
+
src/sipinfo_cli.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ipinfo_cli
|