Skip to content

Commit 3ead667

Browse files
committed
fixed
1 parent 21a9fa8 commit 3ead667

File tree

1 file changed

+63
-58
lines changed

1 file changed

+63
-58
lines changed

main/arguments.py

Lines changed: 63 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ def ipinformation(url='',path='',output=''):
7979
valid=ip_valid(url)
8080
if valid==1:
8181
try:
82+
temp=url
8283
url = f"http://ip-api.com/json/{url}"
8384
response = requests.get(url)
8485
except requests.exceptions.ConnectionError:
@@ -90,8 +91,8 @@ def ipinformation(url='',path='',output=''):
9091

9192
data = response.json()
9293
if output != "":
93-
outputfunc(output, f"\t\t\t{url}")
94-
print(f"{colors.blue}[+]\t\t\t{url}{colors.reset}")
94+
outputfunc(output, f"\t{temp}")
95+
print(f"{colors.blue}\t{temp}{colors.reset}")
9596
for key, value in data.items():
9697
if output != "":
9798
outputfunc(output, f"{key}\t --> \t{value}")
@@ -110,6 +111,7 @@ def ipinformation(url='',path='',output=''):
110111
else:
111112
if valid==1:
112113
try:
114+
temp=url
113115
url = f"http://ip-api.com/json/{url}"
114116
response = requests.get(url)
115117
except requests.exceptions.ConnectionError:
@@ -121,8 +123,8 @@ def ipinformation(url='',path='',output=''):
121123

122124
data = response.json()
123125
if output != "":
124-
outputfunc(output, f"\t\t\t{url}")
125-
print(f"{colors.blue}[+]\t\t\t{url}{colors.reset}")
126+
outputfunc(output, f"\t{temp}")
127+
print(f"{colors.blue}[+]\t{temp}{colors.reset}")
126128
for key, value in data.items():
127129
if output != "":
128130
outputfunc(output, f"{key}\t --> {value}")
@@ -171,6 +173,11 @@ def dnsrecords(url="", names='',path='',output=''):
171173
print(f"{colors.red}[-]{url}\t -->\t{name}\t -->\tHost {domain} Not Found{colors.reset}")
172174
if output != "":
173175
outputfunc(output, f"{url}\t -->\t{name}\t -->\tHost {domain} Not Found")
176+
except Exception as err:
177+
print(f"{colors.red}[-]{url}\t -->\t{name}\t -->\terr:{err}{colors.reset}")
178+
if output != "":
179+
outputfunc(output, f"{url}\t -->\t{name}\t -->\terr:{err}")
180+
174181
else:
175182
print(f"{colors.red}[-]{url}\t -->\tYou Have Entered IP{colors.reset}")
176183
if output != "":
@@ -204,6 +211,11 @@ def dnsrecords(url="", names='',path='',output=''):
204211
print(f"{colors.red}[-]{url}\t -->\t{name}\t -->\tHost {domain} Not Found{colors.reset}")
205212
if output != "":
206213
outputfunc(output, f"{url}\t -->\t{name}\t -->\tHost {domain} Not Found")
214+
except Exception as err:
215+
print(f"{colors.red}[-]{url}\t -->\t{name}\t -->\terr:{err}{colors.reset}")
216+
if output != "":
217+
outputfunc(output, f"{url}\t -->\t{name}\t -->\terr:{err}")
218+
207219
else:
208220
print(f"{colors.red}[-] Something Went Wrong\n[!] Maybe You have Entered Ip")
209221

@@ -241,15 +253,15 @@ def exit_program():
241253
def asnrecord(path="", url="", output=""):
242254
banner.main()
243255
banner.attack("ASN")
244-
valid=ip_valid(url)
245-
if valid==1:
246-
if path != "":
247-
try:
248-
f = open(path, "r")
249-
urls = f.read()
250-
urls = urls.split("\n")
251-
for url in urls:
252-
if url != "":
256+
if path != "":
257+
try:
258+
f = open(path, "r")
259+
urls = f.read()
260+
urls = urls.split("\n")
261+
for url in urls:
262+
if url != "":
263+
valid=ip_valid(url)
264+
if valid==1:
253265
try:
254266
ipwhois = IPWhois(url)
255267
result = ipwhois.lookup_rdap()
@@ -260,39 +272,41 @@ def asnrecord(path="", url="", output=""):
260272
)
261273
except KeyboardInterrupt:
262274
exit_program()
263-
except:
275+
except Exception as err:
264276
if output != "":
265-
outputfunc(output, f"{url}\t --> Something Went Wrong")
266-
print(
267-
f"{colors.red}[+] {url}\t --> {colors.red}Something Went Wrong{colors.reset}"
268-
)
269-
except KeyboardInterrupt:
270-
exit_program()
271-
except Exception as err:
272-
print(
273-
f"{colors.red}[-] Something Went Wrong\n[!] {err}\n[!] Check Your File location"
274-
)
275-
else:
276-
try:
277+
outputfunc(output, f"{url}\t --> err:{err}")
278+
print(
279+
f"{colors.red}[+] {url}\t --> {colors.red}err:{err}{colors.reset}"
280+
)
281+
else:
282+
print(f"{colors.red}[-] Something Went Wrong\n[!] Maybe You have Entered Domain Or Ip Range Is Wrong")
283+
except KeyboardInterrupt:
284+
exit_program()
285+
except Exception as err:
286+
print(
287+
f"{colors.red}[-] Something Went Wrong\n[!] {err}\n[!] Check Your File location"
288+
)
289+
else:
290+
try:
291+
valid=ip_valid(url)
292+
if valid==1:
277293
ipwhois = IPWhois(url)
278294
result = ipwhois.lookup_rdap()
279295
if output != "":
280296
outputfunc(output, f"{url}\t --> {result['asn']}")
281297
print(
282298
f"{colors.blue}[+] {url}\t --> {colors.green}{result['asn']}{colors.reset}"
283299
)
284-
except KeyboardInterrupt:
285-
exit_program()
286-
except:
287-
if output != "":
288-
outputfunc(output, f"{url}\t --> Something Went Wrong")
289-
print(
290-
f"{colors.red}[+] {url}\t --> {colors.red}Something Went Wrong{colors.reset}"
291-
)
292-
else:
293-
print(f"{colors.red}[-] Something Went Wrong\n[!] Maybe You have Entered Domain Or Ip Range Is Wrong")
294-
295-
300+
else:
301+
print(f"{colors.red}[-] Something Went Wrong\n[!] Maybe You have Entered Domain Or Ip Range Is Wrong")
302+
except KeyboardInterrupt:
303+
exit_program()
304+
except:
305+
if output != "":
306+
outputfunc(output, f"{url}\t --> Something Went Wrong")
307+
print(
308+
f"{colors.red}[+] {url}\t --> {colors.red}Something Went Wrong{colors.reset}"
309+
)
296310

297311

298312
def outputfunc(addr, line):
@@ -303,7 +317,6 @@ def outputfunc(addr, line):
303317

304318

305319
def http_status_code(path="", url="", output=""):
306-
307320
link=domain()['check_http'](url)
308321
banner.main()
309322
banner.attack("HTTP Status Code")
@@ -346,35 +359,34 @@ def http_status_code(path="", url="", output=""):
346359
try:
347360
response = requests.get(url, headers=headers, timeout=20)
348361
status = str(response.status_code)
362+
new_url=str(response.url)
349363
if status[0] == "1":
350364
print(
351-
f"{colors.blue} --> {colors.light_blue}{status}{colors.reset}"
365+
f"{colors.blue} --> {colors.light_blue}{status} -->{colors.blue} {new_url}{colors.reset}"
352366
)
353367
elif status[0] == "2":
354368
print(
355-
f"{colors.blue} --> {colors.green}{status}{colors.reset}"
369+
f"{colors.blue} --> {colors.green}{status} -->{colors.blue} {new_url}{colors.reset}"
356370
)
357371
elif status[0] == "3":
358372
print(
359-
f"{colors.blue} --> {colors.yellow}{status}{colors.reset}"
373+
f"{colors.blue} --> {colors.yellow}{status} -->{colors.blue} {new_url}{colors.reset}"
360374
)
361375
elif status[0] == "4":
362376
print(
363-
f"{colors.blue} --> {colors.red}{status}{colors.reset}"
377+
f"{colors.blue} --> {colors.red}{status} -->{colors.blue} {new_url}{colors.reset}"
364378
)
365379
elif status[0] == "5":
366380
print(
367-
f"{colors.blue} --> {colors.purple}{status}{colors.reset}"
381+
f"{colors.blue} --> {colors.purple}{status} -->{colors.blue} {new_url}{colors.reset}"
368382
)
369383
else:
370384
print(
371-
f"{colors.blue} --> {colors.green}{status}{colors.reset}"
385+
f"{colors.blue} --> {colors.green}{status} -->{colors.blue} {new_url}{colors.reset}"
372386
)
373387
except Exception as err:
374388
if "timed out" in str(err):
375-
err = "Connection Time Outed"
376-
else:
377-
err = "Something Went Wrong"
389+
err = "Connection Time Out"
378390
print(
379391
f"{colors.red} --> {colors.red}{err}{colors.reset}"
380392
)
@@ -396,9 +408,7 @@ def http_status_code(path="", url="", output=""):
396408
outputfunc(output, f"{url}\t --> {status}")
397409
except Exception as err:
398410
if "timed out" in str(err):
399-
err = "Connection Time Outed"
400-
else:
401-
err = "Something Went Wrong"
411+
err = "Connection Time Out"
402412
if output != "":
403413
outputfunc(output, f"{url}\t --> {err}")
404414
print(
@@ -448,9 +458,7 @@ def http_status_code(path="", url="", output=""):
448458
outputfunc(output, f"{url}\t --> {status}")
449459
except Exception as err:
450460
if "timed out" in str(err):
451-
err = "Connection Time Outed"
452-
else:
453-
err = "Something Went Wrong"
461+
err = "Connection Time Out"
454462
if output != "":
455463
outputfunc(output, f"{url}\t --> {err}")
456464
print(
@@ -467,7 +475,6 @@ def http_status_code(path="", url="", output=""):
467475
def password_gen(
468476
upper=True, lower=True, digit=True, punctuation=True, length="8", check=True
469477
):
470-
471478
banner.main()
472479
banner.attack("Password Generators")
473480
ascii_lowercase = "abcdefghijklmnopqrstuvwxyz"
@@ -529,7 +536,6 @@ def remove_dublicates(location,output=''):
529536

530537

531538
def screenshot(path="", url="",output=''):
532-
533539
link=domain()['check_http'](url)
534540
banner.main()
535541
banner.attack("Screenshotting")
@@ -616,7 +622,7 @@ def screenshot(path="", url="",output=''):
616622
def domain():
617623
def check_http(url):
618624
urls=[]
619-
if "http://" and "https://" not in url:
625+
if "https://" not in url and "http://" not in url:
620626
valid=ip_valid(url)
621627
if valid==3:
622628
urls.append("http://"+url)
@@ -661,4 +667,3 @@ def ip_valid(user_input):
661667
return 2
662668
except:
663669
return 3
664-

0 commit comments

Comments
 (0)