PandaAPI 1.0.4__tar.gz → 1.0.6__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.
@@ -0,0 +1,85 @@
1
+ Metadata-Version: 2.4
2
+ Name: PandaAPI
3
+ Version: 1.0.6
4
+ Summary: Python utility hub by @ll_PANDA_BBY_ll
5
+ Author: PANDA
6
+ Author-email:
7
+ License-Expression: MIT
8
+ Keywords: python,PandaAPI,telegram,bot,osint,hacker
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: requests
14
+ Requires-Dist: beautifulsoup4
15
+ Provides-Extra: media
16
+ Requires-Dist: yt-dlp; extra == "media"
17
+ Provides-Extra: exif
18
+ Requires-Dist: Pillow; extra == "exif"
19
+ Dynamic: requires-python
20
+
21
+ # PandaAPI
22
+
23
+ **PandaAPI** — Python utility hub by [@ll_PANDA_BBY_ll](https://t.me/ll_PANDA_BBY_ll)
24
+
25
+ ## Install
26
+
27
+ ```bash
28
+ pip install PandaAPI
29
+ ```
30
+
31
+ ## Usage
32
+
33
+ ```python
34
+ from PandaAPI import api
35
+
36
+ # OSINT
37
+ print(api.ip_lookup("8.8.8.8"))
38
+ print(api.username_search("pandaqt"))
39
+ print(api.dns_lookup("google.com"))
40
+
41
+ # Network
42
+ print(api.port_scan("scanme.nmap.org"))
43
+ print(api.ssl_check("google.com"))
44
+
45
+ # Crypto
46
+ print(api.b64_encode("hello"))
47
+ print(api.sha256("password"))
48
+ print(api.jwt_decode("your.jwt.token"))
49
+
50
+ # Temp Mail (with OTP support)
51
+ mail = api.temp_mail_create()
52
+ print(mail["email"])
53
+ inbox = api.temp_mail_inbox(mail["sid_token"])
54
+ if inbox["emails"]:
55
+ msg = api.temp_mail_read(mail["sid_token"], inbox["emails"][0]["id"])
56
+ print(msg["otp_codes"]) # extracted OTP codes
57
+ print(msg["verify_links"]) # extracted verification links
58
+
59
+ # Fake Identity
60
+ print(api.fake_identity("IN")) # Indian fake identity
61
+
62
+ # Lyrics
63
+ print(api.lyrics("Kesariya", "Arijit Singh"))
64
+
65
+ # AI
66
+ print(api.gemini("Hello!"))
67
+ print(api.chatgpt("Explain black holes"))
68
+ ```
69
+
70
+ ## Modules
71
+
72
+ | Module | Functions |
73
+ |--------|-----------|
74
+ | `tools` | `password`, `morse_encode`, `morse_decode`, `github`, `pypi`, `hashtag`, `chatbot`, `meme`, `unsplash`, `imdb`, `leetcode`, `bhagwatgita` |
75
+ | `ai` | `gemini`, `chatgpt`, `blackbox` |
76
+ | `telegram` | `tg_bot_info`, `tg_user` |
77
+ | `media` | `yt_search`, `yt_thumb` |
78
+ | `osint` | `ip_lookup`, `phone_lookup`, `email_verify`, `username_search`, `breach_check`, `whois`, `dns_lookup`, `ssl_info`, `exif_read` |
79
+ | `crypto` | `b64_encode`, `b64_decode`, `md5`, `sha256`, `sha512`, `rot13`, `caesar`, `xor_encrypt`, `xor_decrypt`, `jwt_decode` |
80
+ | `network` | `ping`, `port_scan`, `headers`, `ssl_check`, `torcheck`, `reverse_ip`, `subdomain_scan` |
81
+ | `dark` | `fake_identity`, `temp_mail_create`, `temp_mail_inbox`, `temp_mail_read`, `dark_joke`, `lyrics` |
82
+
83
+ ## License
84
+
85
+ MIT
@@ -0,0 +1,180 @@
1
+ import random
2
+ import string
3
+ import requests
4
+ from .modules import telegram, media, tools, ai, osint, crypto, network, dark
5
+
6
+ __version__ = "1.0.5"
7
+ __all__ = ["PandaAPI"]
8
+
9
+
10
+ class PandaAPI:
11
+ """
12
+ PandaAPI — Python utility hub by @ll_PANDA_BBY_ll
13
+ """
14
+
15
+ def __init__(self) -> None:
16
+ pass
17
+
18
+ # ── Tools ────────────────────────────────────────────
19
+ def password(self, length: int = 12) -> str:
20
+ return tools.password(length)
21
+
22
+ def morse_encode(self, text: str) -> dict:
23
+ return tools.morse_encode(text)
24
+
25
+ def morse_decode(self, code: str) -> dict:
26
+ return tools.morse_decode(code)
27
+
28
+ def github(self, username: str) -> dict:
29
+ return tools.github(username)
30
+
31
+ def pypi(self, package: str) -> dict:
32
+ return tools.pypi(package)
33
+
34
+ def hashtag(self, keyword: str) -> dict:
35
+ return tools.hashtag(keyword)
36
+
37
+ def chatbot(self, text: str) -> dict:
38
+ return tools.chatbot(text)
39
+
40
+ def meme(self) -> dict:
41
+ return tools.meme()
42
+
43
+ def unsplash(self, query: str) -> dict:
44
+ return tools.unsplash(query)
45
+
46
+ def imdb(self, query: str) -> dict:
47
+ return tools.imdb(query)
48
+
49
+ def leetcode(self, username: str) -> dict:
50
+ return tools.leetcode(username)
51
+
52
+ def bhagwatgita(self, chapter: int, shalok: int = 1) -> dict:
53
+ return tools.bhagwatgita(chapter, shalok)
54
+
55
+ # ── AI ───────────────────────────────────────────────
56
+ def gemini(self, prompt: str) -> dict:
57
+ return ai.gemini(prompt)
58
+
59
+ def chatgpt(self, prompt: str) -> dict:
60
+ return ai.chatgpt(prompt)
61
+
62
+ def blackbox(self, prompt: str) -> dict:
63
+ return ai.blackbox(prompt)
64
+
65
+ # ── Telegram ─────────────────────────────────────────
66
+ def tg_bot_info(self, bot_token: str) -> dict:
67
+ return telegram.get_bot_info(bot_token)
68
+
69
+ def tg_user(self, user_id: int, bot_token: str) -> dict:
70
+ return telegram.get_user(user_id, bot_token)
71
+
72
+ # ── Media ────────────────────────────────────────────
73
+ def yt_search(self, query: str) -> list:
74
+ return media.yt_search(query)
75
+
76
+ def yt_thumb(self, video_id: str) -> str:
77
+ return media.yt_thumb(video_id)
78
+
79
+ # ── OSINT ────────────────────────────────────────────
80
+ def ip_lookup(self, ip: str) -> dict:
81
+ return osint.ip_lookup(ip)
82
+
83
+ def phone_lookup(self, phone: str) -> dict:
84
+ return osint.phone_lookup(phone)
85
+
86
+ def email_verify(self, email: str) -> dict:
87
+ return osint.email_verify(email)
88
+
89
+ def username_search(self, username: str) -> dict:
90
+ return osint.username_search(username)
91
+
92
+ def breach_check(self, email: str) -> dict:
93
+ return osint.breach_check(email)
94
+
95
+ def whois(self, domain: str) -> dict:
96
+ return osint.whois(domain)
97
+
98
+ def dns_lookup(self, domain: str) -> dict:
99
+ return osint.dns_lookup(domain)
100
+
101
+ def ssl_info(self, domain: str) -> dict:
102
+ return osint.ssl_info(domain)
103
+
104
+ def exif_read(self, image_url: str) -> dict:
105
+ return osint.exif_read(image_url)
106
+
107
+ # ── Crypto / Encode ───────────────────────────────
108
+ def b64_encode(self, text: str) -> dict:
109
+ return crypto.b64_encode(text)
110
+
111
+ def b64_decode(self, text: str) -> dict:
112
+ return crypto.b64_decode(text)
113
+
114
+ def md5(self, text: str) -> dict:
115
+ return crypto.md5(text)
116
+
117
+ def sha256(self, text: str) -> dict:
118
+ return crypto.sha256(text)
119
+
120
+ def sha512(self, text: str) -> dict:
121
+ return crypto.sha512(text)
122
+
123
+ def rot13(self, text: str) -> dict:
124
+ return crypto.rot13(text)
125
+
126
+ def caesar(self, text: str, shift: int = 13) -> dict:
127
+ return crypto.caesar(text, shift)
128
+
129
+ def xor_encrypt(self, text: str, key: str) -> dict:
130
+ return crypto.xor_encrypt(text, key)
131
+
132
+ def xor_decrypt(self, encoded: str, key: str) -> dict:
133
+ return crypto.xor_decrypt(encoded, key)
134
+
135
+ def jwt_decode(self, token: str) -> dict:
136
+ return crypto.jwt_decode(token)
137
+
138
+ # ── Network ──────────────────────────────────────────
139
+ def ping(self, host: str) -> dict:
140
+ return network.ping(host)
141
+
142
+ def port_scan(self, host: str, ports: list = None) -> dict:
143
+ return network.port_scan(host, ports)
144
+
145
+ def headers(self, url: str) -> dict:
146
+ return network.headers(url)
147
+
148
+ def ssl_check(self, domain: str) -> dict:
149
+ return network.ssl_check(domain)
150
+
151
+ def torcheck(self, ip: str = None) -> dict:
152
+ return network.torcheck(ip)
153
+
154
+ def reverse_ip(self, ip: str) -> dict:
155
+ return network.reverse_ip(ip)
156
+
157
+ def subdomain_scan(self, domain: str) -> dict:
158
+ return network.subdomain_scan(domain)
159
+
160
+ # ── Dark / Fun ───────────────────────────────────────
161
+ def fake_identity(self, country: str = "US") -> dict:
162
+ return dark.fake_identity(country)
163
+
164
+ def temp_mail_create(self) -> dict:
165
+ return dark.temp_mail_create()
166
+
167
+ def temp_mail_inbox(self, sid_token: str, seq: int = 0) -> dict:
168
+ return dark.temp_mail_inbox(sid_token, seq)
169
+
170
+ def temp_mail_read(self, sid_token: str, mail_id: str) -> dict:
171
+ return dark.temp_mail_read(sid_token, mail_id)
172
+
173
+ def dark_joke(self) -> dict:
174
+ return dark.dark_joke()
175
+
176
+ def lyrics(self, song: str, artist: str = "") -> dict:
177
+ return dark.lyrics(song, artist)
178
+
179
+
180
+ api = PandaAPI()
@@ -0,0 +1 @@
1
+ from . import telegram, media, tools, ai, osint, crypto, network, dark
@@ -0,0 +1,109 @@
1
+ import base64
2
+ import hashlib
3
+ import json
4
+
5
+
6
+ def b64_encode(text: str) -> dict:
7
+ try:
8
+ result = base64.b64encode(text.encode()).decode()
9
+ return {"input": text, "result": result, "success": True}
10
+ except Exception as e:
11
+ return {"success": False, "error": str(e)}
12
+
13
+
14
+ def b64_decode(text: str) -> dict:
15
+ try:
16
+ result = base64.b64decode(text.encode()).decode()
17
+ return {"input": text, "result": result, "success": True}
18
+ except Exception as e:
19
+ return {"success": False, "error": str(e)}
20
+
21
+
22
+ def md5(text: str) -> dict:
23
+ try:
24
+ result = hashlib.md5(text.encode()).hexdigest()
25
+ return {"input": text, "result": result, "success": True}
26
+ except Exception as e:
27
+ return {"success": False, "error": str(e)}
28
+
29
+
30
+ def sha256(text: str) -> dict:
31
+ try:
32
+ result = hashlib.sha256(text.encode()).hexdigest()
33
+ return {"input": text, "result": result, "success": True}
34
+ except Exception as e:
35
+ return {"success": False, "error": str(e)}
36
+
37
+
38
+ def sha512(text: str) -> dict:
39
+ try:
40
+ result = hashlib.sha512(text.encode()).hexdigest()
41
+ return {"input": text, "result": result, "success": True}
42
+ except Exception as e:
43
+ return {"success": False, "error": str(e)}
44
+
45
+
46
+ def rot13(text: str) -> dict:
47
+ try:
48
+ result = text.translate(
49
+ str.maketrans(
50
+ 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',
51
+ 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm'
52
+ )
53
+ )
54
+ return {"input": text, "result": result, "success": True}
55
+ except Exception as e:
56
+ return {"success": False, "error": str(e)}
57
+
58
+
59
+ def caesar(text: str, shift: int = 13) -> dict:
60
+ try:
61
+ result = ""
62
+ for ch in text:
63
+ if ch.isalpha():
64
+ base = ord('A') if ch.isupper() else ord('a')
65
+ result += chr((ord(ch) - base + shift) % 26 + base)
66
+ else:
67
+ result += ch
68
+ return {"input": text, "shift": shift, "result": result, "success": True}
69
+ except Exception as e:
70
+ return {"success": False, "error": str(e)}
71
+
72
+
73
+ def xor_encrypt(text: str, key: str) -> dict:
74
+ try:
75
+ result = ''.join(chr(ord(c) ^ ord(key[i % len(key)])) for i, c in enumerate(text))
76
+ encoded = base64.b64encode(result.encode('latin-1')).decode()
77
+ return {"input": text, "key": key, "result": encoded, "success": True}
78
+ except Exception as e:
79
+ return {"success": False, "error": str(e)}
80
+
81
+
82
+ def xor_decrypt(encoded: str, key: str) -> dict:
83
+ try:
84
+ decoded = base64.b64decode(encoded.encode()).decode('latin-1')
85
+ result = ''.join(chr(ord(c) ^ ord(key[i % len(key)])) for i, c in enumerate(decoded))
86
+ return {"input": encoded, "key": key, "result": result, "success": True}
87
+ except Exception as e:
88
+ return {"success": False, "error": str(e)}
89
+
90
+
91
+ def jwt_decode(token: str) -> dict:
92
+ try:
93
+ parts = token.split('.')
94
+ if len(parts) != 3:
95
+ return {"success": False, "error": "Invalid JWT format"}
96
+ def decode_part(p):
97
+ p += '=' * (-len(p) % 4)
98
+ return json.loads(base64.urlsafe_b64decode(p).decode())
99
+ header = decode_part(parts[0])
100
+ payload = decode_part(parts[1])
101
+ return {
102
+ "header": header,
103
+ "payload": payload,
104
+ "signature": parts[2],
105
+ "note": "Signature not verified",
106
+ "success": True,
107
+ }
108
+ except Exception as e:
109
+ return {"success": False, "error": str(e)}
@@ -0,0 +1,184 @@
1
+ import requests
2
+ import re
3
+
4
+
5
+ def fake_identity(country: str = "US") -> dict:
6
+ try:
7
+ r = requests.get(
8
+ f"https://randomuser.me/api/?nat={country.lower()}&inc=name,location,email,phone,dob,login",
9
+ timeout=10,
10
+ ).json()
11
+ user = r["results"][0]
12
+ return {
13
+ "name": f"{user['name']['first']} {user['name']['last']}",
14
+ "email": user["email"],
15
+ "phone": user["phone"],
16
+ "username": user["login"]["username"],
17
+ "password": user["login"]["password"],
18
+ "dob": user["dob"]["date"][:10],
19
+ "age": user["dob"]["age"],
20
+ "address": f"{user['location']['street']['number']} {user['location']['street']['name']}, {user['location']['city']}, {user['location']['state']}, {user['location']['country']}",
21
+ "postcode": str(user["location"]["postcode"]),
22
+ "success": True,
23
+ }
24
+ except Exception as e:
25
+ return {"success": False, "error": str(e)}
26
+
27
+
28
+ def temp_mail_create() -> dict:
29
+ try:
30
+ r = requests.get(
31
+ "https://api.guerrillamail.com/ajax.php?f=get_email_address&lang=en",
32
+ timeout=10,
33
+ ).json()
34
+ email = r.get("email_addr")
35
+ sid_token = r.get("sid_token")
36
+ return {
37
+ "email": email,
38
+ "sid_token": sid_token,
39
+ "note": "Use sid_token in temp_mail_inbox() to check emails",
40
+ "success": True,
41
+ }
42
+ except Exception as e:
43
+ return {"success": False, "error": str(e)}
44
+
45
+
46
+ def temp_mail_inbox(sid_token: str, seq: int = 0) -> dict:
47
+ try:
48
+ r = requests.get(
49
+ f"https://api.guerrillamail.com/ajax.php?f=check_email&seq={seq}&sid_token={sid_token}",
50
+ timeout=10,
51
+ ).json()
52
+ emails = r.get("list", [])
53
+ parsed = []
54
+ for mail in emails:
55
+ parsed.append({
56
+ "id": mail.get("mail_id"),
57
+ "from": mail.get("mail_from"),
58
+ "subject": mail.get("mail_subject"),
59
+ "date": mail.get("mail_date"),
60
+ "read": mail.get("mail_read") == "1",
61
+ })
62
+ return {"emails": parsed, "count": len(parsed), "success": True}
63
+ except Exception as e:
64
+ return {"success": False, "error": str(e)}
65
+
66
+
67
+ def temp_mail_read(sid_token: str, mail_id: str) -> dict:
68
+ try:
69
+ r = requests.get(
70
+ f"https://api.guerrillamail.com/ajax.php?f=fetch_email&email_id={mail_id}&sid_token={sid_token}",
71
+ timeout=10,
72
+ ).json()
73
+ body = r.get("mail_body", "")
74
+ otp_patterns = re.findall(r'\b\d{4,8}\b', body)
75
+ links = re.findall(r'https?://[^\s<>"]+', body)
76
+ verify_links = [l for l in links if any(k in l.lower() for k in ['verify', 'confirm', 'activate', 'token', 'otp', 'code', 'click'])]
77
+ return {
78
+ "from": r.get("mail_from"),
79
+ "subject": r.get("mail_subject"),
80
+ "date": r.get("mail_date"),
81
+ "body": body,
82
+ "otp_codes": otp_patterns,
83
+ "verify_links": verify_links,
84
+ "success": True,
85
+ }
86
+ except Exception as e:
87
+ return {"success": False, "error": str(e)}
88
+
89
+
90
+ def dark_joke() -> dict:
91
+ try:
92
+ r = requests.get(
93
+ "https://v2.jokeapi.dev/joke/Dark?type=twopart",
94
+ timeout=10,
95
+ ).json()
96
+ if r.get("type") == "twopart":
97
+ return {
98
+ "setup": r.get("setup"),
99
+ "punchline": r.get("delivery"),
100
+ "category": r.get("category"),
101
+ "success": True,
102
+ }
103
+ return {"joke": r.get("joke"), "success": True}
104
+ except Exception as e:
105
+ return {"success": False, "error": str(e)}
106
+
107
+
108
+ def lyrics(song: str, artist: str = "") -> dict:
109
+ try:
110
+ query = f"{artist} {song}".strip()
111
+ headers = {
112
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
113
+ }
114
+
115
+ # Method 1: lyrics.ovh (English songs)
116
+ if artist:
117
+ r = requests.get(
118
+ f"https://api.lyrics.ovh/v1/{requests.utils.quote(artist)}/{requests.utils.quote(song)}",
119
+ timeout=10,
120
+ )
121
+ if r.status_code == 200:
122
+ lyr = r.json().get("lyrics", "")
123
+ if lyr:
124
+ return {"song": song, "artist": artist, "lyrics": lyr, "source": "lyrics.ovh", "success": True}
125
+
126
+ # Method 2: Genius search scrape
127
+ search_r = requests.get(
128
+ f"https://api.genius.com/search?q={requests.utils.quote(query)}",
129
+ headers={**headers, "Authorization": "Bearer alXE5K2_D2ZJVMWKW7pWAbsOaOFWlEAzHmDNJY3CyGRTMh5z3HKFqSBJaWrHK2T9"},
130
+ timeout=10,
131
+ )
132
+ if search_r.status_code == 200:
133
+ hits = search_r.json().get("response", {}).get("hits", [])
134
+ if hits:
135
+ top = hits[0]["result"]
136
+ song_title = top.get("title", song)
137
+ artist_name = top.get("primary_artist", {}).get("name", artist)
138
+ song_url = top.get("url", "")
139
+ # scrape lyrics from genius page
140
+ page = requests.get(song_url, headers=headers, timeout=10)
141
+ from bs4 import BeautifulSoup
142
+ soup = BeautifulSoup(page.text, "html.parser")
143
+ # remove scripts
144
+ for s in soup.find_all("script"):
145
+ s.decompose()
146
+ containers = soup.find_all("div", attrs={"data-lyrics-container": "true"})
147
+ if containers:
148
+ lyr_parts = []
149
+ for c in containers:
150
+ for br in c.find_all("br"):
151
+ br.replace_with("\n")
152
+ lyr_parts.append(c.get_text())
153
+ lyr = "\n".join(lyr_parts).strip()
154
+ return {
155
+ "song": song_title,
156
+ "artist": artist_name,
157
+ "lyrics": lyr,
158
+ "genius_url": song_url,
159
+ "source": "genius",
160
+ "success": True,
161
+ }
162
+
163
+ # Method 3: lyrics.ovh suggest fallback
164
+ rs = requests.get(
165
+ f"https://api.lyrics.ovh/suggest/{requests.utils.quote(query)}",
166
+ timeout=10,
167
+ ).json()
168
+ results = rs.get("data", [])
169
+ if results:
170
+ top = results[0]
171
+ artist_name = top.get("artist", {}).get("name", "")
172
+ title = top.get("title", "")
173
+ r2 = requests.get(
174
+ f"https://api.lyrics.ovh/v1/{requests.utils.quote(artist_name)}/{requests.utils.quote(title)}",
175
+ timeout=10,
176
+ )
177
+ if r2.status_code == 200:
178
+ lyr = r2.json().get("lyrics", "")
179
+ if lyr:
180
+ return {"song": title, "artist": artist_name, "lyrics": lyr, "source": "lyrics.ovh", "success": True}
181
+
182
+ return {"success": False, "error": "Lyrics not found — try English song name or add artist name"}
183
+ except Exception as e:
184
+ return {"success": False, "error": str(e)}
@@ -0,0 +1 @@
1
+ aW1wb3J0IHJlcXVlc3RzCgoKZGVmIHl0X3NlYXJjaChxdWVyeTogc3RyKSAtPiBsaXN0OgogICAgIiIiCiAgICBVc2VzIHl0LWRscCdzIHl0c2VhcmNoIHZpYSBhIHNpbXBsZSBzY3JhcGUtZnJlZSBhcHByb2FjaC4KICAgIFJldHVybnMgbGlzdCBvZiBkaWN0cyB3aXRoIHRpdGxlLCB1cmwsIGR1cmF0aW9uLCBjaGFubmVsLgogICAgIiIiCiAgICB0cnk6CiAgICAgICAgaW1wb3J0IHl0X2RscAoKICAgICAgICB5ZGxfb3B0cyA9IHsKICAgICAgICAgICAgInF1aWV0IjogVHJ1ZSwKICAgICAgICAgICAgInNraXBfZG93bmxvYWQiOiBUcnVlLAogICAgICAgICAgICAiZXh0cmFjdF9mbGF0IjogVHJ1ZSwKICAgICAgICB9CiAgICAgICAgd2l0aCB5dF9kbHAuWW91dHViZURMKHlkbF9vcHRzKSBhcyB5ZGw6CiAgICAgICAgICAgIGluZm8gPSB5ZGwuZXh0cmFjdF9pbmZvKGYieXRzZWFyY2g1OnF1ZXJ5fSIsIGRvd25sb2FkPUZhbHNlKQogICAgICAgICAgICBlbnRyaWVzID0gaW5mby5nZXQoImVudHJpZXMiLCBbXSkKICAgICAgICAgICAgcmV0dXJuIFsKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAidGl0bGUiOiBlLmdldCgidGl0bGUiKSwKICAgICAgICAgICAgICAgICAgICAidXJsIjogZiJodHRwczovL3lvdXR1YmUuY29tL3dhdGNoP3Y9e2UuZ2V0KCdpZCcpfSIsCiAgICAgICAgICAgICAgICAgICAgImR1cmF0aW9uIjogZS5nZXQoImR1cmF0aW9uIiksCiAgICAgICAgICAgICAgICAgICAgImNoYW5uZWwiOiBlLmdldCgiY2hhbm5lbCIpLAogICAgICAgICAgICAgICAgICAgICJpZCI6IGUuZ2V0KCJpZCIpLAogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZm9yIGUgaW4gZW50cmllcwogICAgICAgICAgICBdCiAgICBleGNlcHQgSW1wb3J0RXJyb3I6CiAgICAgICAgcmV0dXJuIFt7ImVycm9yIjogInl0X2RscCBub3QgaW5zdGFsbGVkIiwgInN1Y2Nlc3MiOiBGYWxzZX1dCgoKZGVmIHl0X3RodW1iKHZpZGVvX2lkOiBzdHIpIC0+IHN0cjoKICAgIHJldHVybiBmImh0dHBzOi8vaW1nLnlvdXR1YmUuY29tL3ZpL3t2aWRlb19pZH0vbWF4cmVzZGVmYXVsdC5qcGciCgoKZGVmIGx5cmljcyhhcnRpc3Q6IHN0ciwgdGl0bGU6IHN0cikgLT4gZGljdDoKICAgICIiIgogICAgRmV0Y2ggbHlyaWNzIGZvciBhIHNvbmcuCiAgICBQcmltYXJ5OiBseXJpY3Mub3ZoIChwbGFpbiB0ZXh0KQogICAgRmFsbGJhY2s6IGxyY2xpYi5uZXQgKHN5bmNlZCArIHBsYWluKQogICAgIiIiCiAgICAjIC0tLSBQcmltYXJ5OiBseXJpY3Mub3ZoIC0tLQogICAgdHJ5OgogICAgICAgIHVybCA9IGYiaHR0cHM6Ly9hcGkubHlyaWNzLm92aC92MS97YXJ0aXN0fS97dGl0bGV9IgogICAgICAgIHIgPSByZXF1ZXN0cy5nZXQodXJsLCB0aW1lb3V0PTgpCiAgICAgICAgaWYgci5zdGF0dXNfY29kZSA9PSAyMDA6CiAgICAgICAgICAgIGRhdGEgPSByLmpzb24oKQogICAgICAgICAgICBpZiBkYXRhLmdldCgibHlyaWNzIik6CiAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICJzdWNjZXNzIjogVHJ1ZSwKICAgICAgICAgICAgICAgICAgICAiYXJ0aXN0IjogYXJ0aXN0LAogICAgICAgICAgICAgICAgICAgICJ0aXRsZSI6IHRpdGxlLAogICAgICAgICAgICAgICAgICAgICJseXJpY3MiOiBkYXRhWyJseXJpY3MiXSwKICAgICAgICAgICAgICAgICAgICAic3luY2VkIjogRmFsc2UsCiAgICAgICAgICAgICAgICAgICAgInNvdXJjZSI6ICJseXJpY3Mub3ZoIiwKICAgICAgICAgICAgICAgIH0KICAgIGV4Y2VwdCBFeGNlcHRpb246CiAgICAgICAgcGFzcwoKICAgICMgLS0tIEZhbGxiYWNrOiBscmNsaWIubmV0IC0tLQogICAgdHJ5OgogICAgICAgIHVybCA9ICJodHRwczovL2xyY2xpYi5uZXQvYXBpL2dldCIKICAgICAgICBwYXJhbXMgPSB7ImFydGlzdF9uYW1lIjogYXJ0aXN0LCAidHJhY2tfbmFtZSI6IHRpdGxlfQogICAgICAgIHIgPSByZXF1ZXN0cy5nZXQodXJsLCBwYXJhbXM9cGFyYW1zLCB0aW1lb3V0PTgpCiAgICAgICAgaWYgci5zdGF0dXNfY29kZSA9PSAyMDA6CiAgICAgICAgICAgIGRhdGEgPSByLmpzb24oKQogICAgICAgICAgICBzeW5jZWQgPSBkYXRhLmdldCgic3luY2VkTHlyaWNzIikKICAgICAgICAgICAgcGxhaW4gPSBkYXRhLmdldCgicGxhaW5MeXJpY3MiKQogICAgICAgICAgICBpZiBzeW5jZWQgb3IgcGxhaW46CiAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICJzdWNjZXNzIjogVHJ1ZSwKICAgICAgICAgICAgICAgICAgICAiYXJ0aXN0IjogYXJ0aXN0LAogICAgICAgICAgICAgICAgICAgICJ0aXRsZSI6IHRpdGxlLAogICAgICAgICAgICAgICAgICAgICJseXJpY3MiOiBzeW5jZWQgb3IgcGxhaW4sCiAgICAgICAgICAgICAgICAgICAgInN5bmNlZCI6IGJvb2woc3luY2VkKSwKICAgICAgICAgICAgICAgICAgICAic291cmNlIjogImxyY2xpYi5uZXQiLAogICAgICAgICAgICAgICAgfQogICAgZXhjZXB0IEV4Y2VwdGlvbjoKICAgICAgICBwYXNzCgogICAgcmV0dXJuIHsic3VjY2VzcyI6IEZhbHNlLCAiZXJyb3IiOiAiTHlyaWNzIG5vdCBmb3VuZCBvbiBhbnkgc291cmNlIn0K
@@ -0,0 +1,120 @@
1
+ import requests
2
+ import socket
3
+ import ssl
4
+ import json
5
+
6
+
7
+ def ping(host: str) -> dict:
8
+ try:
9
+ ip = socket.gethostbyname(host)
10
+ return {"host": host, "ip": ip, "alive": True, "success": True}
11
+ except socket.gaierror:
12
+ return {"host": host, "alive": False, "success": True}
13
+ except Exception as e:
14
+ return {"success": False, "error": str(e)}
15
+
16
+
17
+ def port_scan(host: str, ports: list = None) -> dict:
18
+ if ports is None:
19
+ ports = [21, 22, 23, 25, 53, 80, 110, 143, 443, 445, 3306, 3389, 5432, 6379, 8080, 8443, 27017]
20
+ results = {}
21
+ try:
22
+ ip = socket.gethostbyname(host)
23
+ for port in ports:
24
+ try:
25
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
26
+ s.settimeout(1)
27
+ result = s.connect_ex((ip, port))
28
+ results[port] = result == 0
29
+ s.close()
30
+ except Exception:
31
+ results[port] = False
32
+ open_ports = [p for p, v in results.items() if v]
33
+ return {"host": host, "ip": ip, "open_ports": open_ports, "all": results, "success": True}
34
+ except Exception as e:
35
+ return {"success": False, "error": str(e)}
36
+
37
+
38
+ def headers(url: str) -> dict:
39
+ try:
40
+ if not url.startswith("http"):
41
+ url = "https://" + url
42
+ r = requests.get(url, timeout=10, allow_redirects=True)
43
+ return {
44
+ "url": url,
45
+ "status": r.status_code,
46
+ "headers": dict(r.headers),
47
+ "success": True,
48
+ }
49
+ except Exception as e:
50
+ return {"success": False, "error": str(e)}
51
+
52
+
53
+ def ssl_check(domain: str) -> dict:
54
+ try:
55
+ ctx = ssl.create_default_context()
56
+ with ctx.wrap_socket(socket.socket(), server_hostname=domain) as s:
57
+ s.settimeout(10)
58
+ s.connect((domain, 443))
59
+ cert = s.getpeercert()
60
+ import datetime
61
+ expiry = datetime.datetime.strptime(cert['notAfter'], '%b %d %H:%M:%S %Y %Z')
62
+ issued = datetime.datetime.strptime(cert['notBefore'], '%b %d %H:%M:%S %Y %Z')
63
+ issuer = dict(x[0] for x in cert.get('issuer', []))
64
+ subject = dict(x[0] for x in cert.get('subject', []))
65
+ days_left = (expiry - datetime.datetime.utcnow()).days
66
+ return {
67
+ "domain": domain,
68
+ "issuer": issuer.get('organizationName', ''),
69
+ "subject": subject.get('commonName', ''),
70
+ "valid_from": str(issued.date()),
71
+ "valid_until": str(expiry.date()),
72
+ "days_remaining": days_left,
73
+ "expired": days_left < 0,
74
+ "success": True,
75
+ }
76
+ except Exception as e:
77
+ return {"success": False, "error": str(e)}
78
+
79
+
80
+ def torcheck(ip: str = None) -> dict:
81
+ try:
82
+ if not ip:
83
+ ip = requests.get("https://api.ipify.org", timeout=5).text.strip()
84
+ r = requests.get(f"https://check.torproject.org/api/ip?ip={ip}", timeout=10).json()
85
+ return {
86
+ "ip": ip,
87
+ "is_tor": r.get("IsTor", False),
88
+ "success": True,
89
+ }
90
+ except Exception as e:
91
+ return {"success": False, "error": str(e)}
92
+
93
+
94
+ def reverse_ip(ip: str) -> dict:
95
+ try:
96
+ r = requests.get(
97
+ f"https://api.hackertarget.com/reverseiplookup/?q={ip}",
98
+ timeout=10,
99
+ )
100
+ domains = [d.strip() for d in r.text.strip().split('\n') if d.strip() and 'error' not in d.lower()]
101
+ return {"ip": ip, "domains": domains, "count": len(domains), "success": True}
102
+ except Exception as e:
103
+ return {"success": False, "error": str(e)}
104
+
105
+
106
+ def subdomain_scan(domain: str) -> dict:
107
+ try:
108
+ r = requests.get(
109
+ f"https://api.hackertarget.com/hostsearch/?q={domain}",
110
+ timeout=15,
111
+ )
112
+ lines = [l.strip() for l in r.text.strip().split('\n') if l.strip() and 'error' not in l.lower()]
113
+ subdomains = []
114
+ for line in lines:
115
+ parts = line.split(',')
116
+ if len(parts) == 2:
117
+ subdomains.append({"subdomain": parts[0], "ip": parts[1]})
118
+ return {"domain": domain, "subdomains": subdomains, "count": len(subdomains), "success": True}
119
+ except Exception as e:
120
+ return {"success": False, "error": str(e)}