-
Notifications
You must be signed in to change notification settings - Fork 0
/
ping-u.py
68 lines (59 loc) · 2.83 KB
/
ping-u.py
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
import subprocess as sp
import os
print("-----Ping-u-----")
print("Warning! This script must be run under administrator (Windows) to work properly!")
domain = input("Enter domain name (without top-level domain): ")
topDomains = []
exist = []
basicTopDomains = input("Do you want to test basic top-level domains like .com, .org, .cz, etc...? (yes/no):")
if basicTopDomains == "yes" or basicTopDomains == "y":
sourceBasic = open("basic-domains.txt","r") #opening file with top level domains
for line in sourceBasic:
topDomains.append(line)
sourceBasic.close()
geoTopDomains = input("Do you want to test geo top-level domains like .paris, .asia, .cologne, etc...? (yes/no):")
if geoTopDomains == "yes" or geoTopDomains == "y":
sourceGeo = open("geo-domains.txt","r") #opening file with geo domains
for line in sourceGeo:
topDomains.append(line)
sourceGeo.close()
extendedTopDomains = input("Do you want to test top-level domains like .click, .eat, .name, etc...? This option will add over 550 top-level domains - it can prolong testing time (yes/no):")
if extendedTopDomains == "yes" or extendedTopDomains == "y":
sourceExtended = open("extended-domains.txt","r") #opening file with ICANN domains
for line in sourceExtended:
topDomains.append(line)
sourceExtended.close()
topDomains = [n.replace("\n","") for n in topDomains]
listLenght = str(len(topDomains))
counterExisting = counterNonExisting = domainsCounter = howManyExist = 0
print("{} domains will be tested.".format(listLenght))
for i in topDomains:
domainsCounter += 1
address = domain + i
status,result = sp.getstatusoutput("ping -c1 -w2 " + address)
if status == 0:
counterExisting += 1
exist.append(address)
print("[{}/{}] Website {} EXIST!".format(domainsCounter,listLenght,address))
else:
counterNonExisting += 1
print("[{}/{}] Website {} DOES NOT EXIST!".format(domainsCounter,listLenght,address))
print("The page {} exists in {} variants. {} variants were tested.".format(domain,counterExisting,listLenght))
printExist = input("Do you want to show existing domain variants (yes/no):")
if printExist == "yes" or printExist == "y":
if not exist:
print("[!] Don't panic, but no variant exists. Did you run the program as an administrator?")
else:
for i in exist:
howManyExist += 1
print("[{}] {}".format(howManyExist,i))
exportLogfile = input("Do you want to export txt file with existing tested domains? (yes/no):")
if exportLogfile == "yes" or exportLogfile == "y":
exportTxt = open("logfile-{}.txt".format(domain),"w")
for i in exist:
exportTxt.write(i)
exportTxt.write("\n")
exportTxt.close()
topDomains.clear()
exist.clear()
input("Press ENTER to exit")