-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathURLHider.py
169 lines (141 loc) · 5.32 KB
/
URLHider.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
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
import pyshorteners
import re, sys, socket
def validate_url(url):
newurl = url.lower()
if "http" in newurl and "://" in url:
return newurl
else:
return ""
def validate_domain(domain):
pattern = re.compile(r'^[A-Za-z0-9.]+$')
if pattern.match(domain):
return True
else:
return False
def internet_connection():
try:
socket.gethostbyname("www.google.com")
return True
except socket.gaierror:
return False
def home_logo():
print("""
#### ## ## ### ##### ####### #######
## ## ## ## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ## ## ## ##
## ######### ## ## ## ## ####### ########
## ## ## ######### ## ## ## ## ##
## ## ## ## ## ## ## ## ## ## ##
#### ## ## ## ## ##### ####### #######
IHA089: Navigating the Digital Realm with Code and Security - Where Programming Insights Meet Cyber Vigilance.
""")
def about():
print("""Welcome to IHA089, your premier source for cutting-edge cybersecurity solutions. At IHA089, we specialize in developing tools designed to enhance the security and integrity of your digital environment.
We understand the importance of reliable and efficient cybersecurity solutions, which is why we focus on creating tools that are not only powerful but also user-friendly. Our tools are designed to streamline security processes, making it easier for organizations to protect their assets and maintain a secure operational framework.
""")
print("Website ::: https://iha089.org.in")
print("Github ::: https://github.com/IHA089")
print("Instagram ::: https://www.instagram.com/IHA089")
print("Telegram ::: https://t.me/IHATron")
print("youtube ::: https://youtube.com/@iha089")
print("Twiter ::: https://twitter.com/iha089")
def validate_phishing_keyword(keyword):
pattern = re.compile(r'^[a-zA-Z0-9-_]+$')
if pattern.match(keyword):
return True
else:
return False
def shorting_url(short_obj, url):
try:
short_url = short_obj.short(url)
return short_url
except:
print("An error occur when short url")
return "error"
def shortener_service(url):
print("1\ttinyurl\n2\tdagd\n3\tclckru")
try:
select = int(input("select : "))
shortner = pyshorteners.Shortener()
if select == 1:
shorter = shortner.tinyurl
return shorting_url(shorter, url)
elif select == 2:
shorter = shortner.dagd
return shorting_url(shorter, url)
elif select == 3:
shorter = shortner.clckru
return shorting_url(shorter, url)
else:
print("please select between 1-3")
return "error"
except ValueError:
print("please select between 1-3")
return "error"
def combiner(masked_url, domain_name, phishing_keyword):
mskd = masked_url.split("://")
url_header = mskd[0]
url_tail = mskd[1]
if phishing_keyword == "":
result = url_header+"://"+domain_name+"@"+url_tail
else:
result = url_header+"://"+domain_name+"-"+phishing_keyword+"@"+url_tail
return result
def urlmask():
try:
aa = sys.argv[1]
if aa == "about":
home_logo()
about()
return 0
except:
pass
home_logo()
try:
original_url = input("Enter original url[Ex. https://google.com]:")
except KeyboardInterrupt:
print("\nExit by user")
return 0
if original_url == "":
print("Please enter an url")
return 0
check_url_valid = validate_url(original_url)
if check_url_valid == "":
print("URL is not valid, please enter correct url[Ex:https://google.com]")
return 0
masked_url = shortener_service(original_url)
if masked_url == "error":
return 0
try:
domain_nam = input("Enter what domain you want to set[Ex. google.com, facebook.com]:")
except KeyboardInterrupt:
print("\nExit by user")
return 0
domain_name = domain_nam.lower()
if domain_name == "":
print("Please enter an domain name")
return 0
if not validate_domain(domain_name):
print("please enter corrct domain name[Ex: google.com, facebook.com etc]")
return 0
try:
phishing_key = input("Do you want to enter phising keyword[yes/no]:")
except KeyboardInterrupt:
print("\nExit by user")
return 0
if phishing_key == "yes" or phishing_key == "YES":
try:
phishing_keyword = input("Enter phishing keyworkd[Ex: free, login]:")
except KeyboardInterrupt:
print("\nExit by user")
return 0
phishing_keyword = phishing_keyword.lower()
if not validate_phishing_keyword(phishing_keyword):
print("please enter valid phishing keyword that include alphbats, number, '-' and '_'symbol")
return 0
else:
phishing_keyword = ""
result = combiner(masked_url, domain_name, phishing_keyword)
print("Masked URL:::{}".format(result))
if __name__ == "__main__":
urlmask()