-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathmaskurl.py
80 lines (63 loc) · 2.05 KB
/
maskurl.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
"""
Description:
-----------
This Script Mask the url behind another url
Usage:
-----
python3 maskurl.py
"""
import sys
import argparse
from urllib.parse import urlparse
from requests import post
banner = r"""
__ __ _ ____ _ __ _ _ ____ _
| \/ | / \ / ___| | |/ / | | | | | _ \ | |
| |\/| | / _ \ \___ \ | ' / | | | | | |_) | | |
| | | | / ___ \ ___) | | . \ | |_| | | _ < | |___
|_| |_| /_/ \_\ |____/ |_|\_\ \___/ |_| \_\ |_____|
"""
def Shortner(big_url: str) -> str:
"""
Function short the big urls to short
"""
return post(f"https://is.gd/create.php?format=json&url={big_url}").json()['shorturl']
def MaskUrl(target_url: str, mask_domain: str, keyword: str) -> str:
"""
Function mask the url with given domain and keyword
"""
url = Shortner(target_url)
return f"{mask_domain}-{keyword}@{urlparse(url).netloc + urlparse(url).path}"
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Mask the URL behind the another URL")
parser.add_argument(
"--target",
type=str,
help="Target URL to Mask (With http or https)",
required=True,
)
parser.add_argument(
"--mask",
type=str,
help="Mask URL (With http or https)",
required=True,
)
parser.add_argument(
"--keywords",
type=str,
help="Keywords (Use (-) instead of whitespace)",
required=True,
)
print(f"\033[91m {banner}\033[00m")
if len(sys.argv) == 1:
print("\n")
target = input("Enter the url (With http or https): ")
mask = input("Enter the domain name to mask url (With http or https): ")
keyword = input("Enter the keywords (use '-' instead of whitespace): ")
print("\n")
else:
args = parser.parse_args()
target = args.target
mask = args.mask
keyword = args.keywords
print(f"\033[91m {MaskUrl(target, mask, keyword)}\033[00m")