-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython.py
More file actions
250 lines (177 loc) · 5.22 KB
/
Copy pathpython.py
File metadata and controls
250 lines (177 loc) · 5.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
import requests
import socket
import json
import whois
from rich.console import Console
from rich.table import Table
from rich.panel import Panel
from rich.prompt import Prompt
from rich import print
from pyfiglet import Figlet
console = Console()
f = Figlet(font='slant')
def banner():
console.print(f"[bold green]{f.renderText('OSINT')}[/bold green]")
console.print(Panel.fit(
"Termux OSINT Toolkit\\nPublic Data Only",
border_style="green"
))
def menu():
table = Table(title="Menu")
table.add_column("No", style="cyan")
table.add_column("Feature", style="green")
table.add_row("1", "Username Checker")
table.add_row("2", "DNS Lookup")
table.add_row("3", "IP Lookup")
table.add_row("4", "HTTP Header Checker")
table.add_row("5", "Subdomain Finder")
table.add_row("6", "Whois Lookup")
table.add_row("0", "Exit")
console.print(table)
# =========================
# USERNAME CHECKER
# =========================
def username_checker():
username = Prompt.ask("Username")
sites = {
"GitHub": f"https://github.com/{username}",
"Instagram": f"https://www.instagram.com/{username}",
"TikTok": f"https://www.tiktok.com/@{username}",
"Pinterest": f"https://www.pinterest.com/{username}",
"Reddit": f"https://www.reddit.com/user/{username}",
}
table = Table(title=f"Result: {username}")
table.add_column("Platform")
table.add_column("Status")
for name, url in sites.items():
try:
r = requests.get(url, timeout=5)
if r.status_code == 200:
table.add_row(name, "[green]FOUND[/green]")
else:
table.add_row(name, "[red]NOT FOUND[/red]")
except:
table.add_row(name, "ERROR")
console.print(table)
# =========================
# DNS LOOKUP
# =========================
def dns_lookup():
domain = Prompt.ask("Domain")
try:
ip = socket.gethostbyname(domain)
table = Table(title="DNS Lookup")
table.add_column("Domain")
table.add_column("IP")
table.add_row(domain, ip)
console.print(table)
except Exception as e:
console.print(f"[red]{e}[/red]")
# =========================
# IP LOOKUP
# =========================
def ip_lookup():
ip = Prompt.ask("IP Address")
try:
r = requests.get(f"http://ip-api.com/json/{ip}")
data = r.json()
table = Table(title="IP Info")
table.add_column("Field")
table.add_column("Value")
for key in [
"country",
"regionName",
"city",
"isp",
"org",
"timezone",
"query"
]:
table.add_row(key, str(data.get(key)))
console.print(table)
except Exception as e:
console.print(f"[red]{e}[/red]")
# =========================
# HTTP HEADER CHECKER
# =========================
def header_checker():
url = Prompt.ask("URL")
try:
r = requests.get(url)
table = Table(title="HTTP Headers")
table.add_column("Header")
table.add_column("Value")
for k, v in r.headers.items():
table.add_row(k, str(v))
console.print(table)
except Exception as e:
console.print(f"[red]{e}[/red]")
# =========================
# SUBDOMAIN FINDER
# =========================
def subdomain_finder():
domain = Prompt.ask("Domain")
url = f"https://crt.sh/?q=%25.{domain}&output=json"
try:
r = requests.get(url)
data = r.json()
found = set()
table = Table(title="Subdomains")
table.add_column("Subdomain")
for item in data:
name = item['name_value']
if name not in found:
found.add(name)
table.add_row(name)
console.print(table)
except Exception as e:
console.print(f"[red]{e}[/red]")
# =========================
# WHOIS LOOKUP
# =========================
def whois_lookup():
domain = Prompt.ask("Domain")
try:
info = whois.whois(domain)
table = Table(title="Whois Info")
table.add_column("Field")
table.add_column("Value")
fields = [
"domain_name",
"registrar",
"creation_date",
"expiration_date",
"name_servers"
]
for field in fields:
table.add_row(field, str(info.get(field)))
console.print(table)
except Exception as e:
console.print(f"[red]{e}[/red]")
# =========================
# MAIN
# =========================
def main():
while True:
banner()
menu()
choice = Prompt.ask("Select")
if choice == "1":
username_checker()
elif choice == "2":
dns_lookup()
elif choice == "3":
ip_lookup()
elif choice == "4":
header_checker()
elif choice == "5":
subdomain_finder()
elif choice == "6":
whois_lookup()
elif choice == "0":
console.print("[bold red]Bye[/bold red]")
break
else:
console.print("[red]Invalid Choice[/red]")
if __name__ == '__main__':
main()