-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHtyper.py
156 lines (131 loc) · 4.09 KB
/
Htyper.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
## -*- coding: utf-8 -*-
import os
import time
import requests
from colorama import Fore
def menu():
Domain = requests.get(URL)
print(Fore.LIGHTYELLOW_EX + """ _ _ _____
| | | |_ _| _ _ __ ___ _ __
| |_| | | || | | | '_ \ / _ \ '__|
| _ | | || |_| | |_) | __/ |
|_| |_| |_| \__, | .__/ \___|_|
|___/|_|
""")
print(Fore.LIGHTWHITE_EX + " V1.8 (beta) ")
if Domain:
print("Status:")
print(Domain.status_code)
print(Fore.LIGHTGREEN_EX + "Conection acepted")
else:
print("Status:")
print(Domain.status_code)
print(Fore.LIGHTRED_EX + "Conection refused")
print(Fore.LIGHTWHITE_EX + "\nSeeing:" + URL)
print(Fore.LIGHTBLACK_EX + "Do you want to...?")
print(Fore.LIGHTCYAN_EX + "1.See request cookies 2.See headers 3.See html code")
print(Fore.LIGHTCYAN_EX + "\n4.Osint everything 5. Make post requests (for formularies)")
int = input(Fore.LIGHTWHITE_EX + "\n>>")
if int=="1" or int=="cookies":
print(Domain.cookies)
input("\nPress to back")
os.system("clear")
os.system("cls")
menu()
if int=="2" or int=="headers":
print(Domain.headers)
input("\nPress to back")
os.system("clear")
os.system("cls")
menu()
if int=="3" or int=="html code":
print(Domain.text)
input("\nPress to back")
os.system("clear")
os.system("cls")
menu()
if int=="4" or int=="osint":
print(Fore.LIGHTBLUE_EX + "saving source code in source.txt\n")
sourcecode = Domain.text
f = open("source.txt", "w")
f.write(URL + ":\n")
f.write(sourcecode)
f.close()
print(Fore.LIGHTGREEN_EX + "\nCookies injected:")
print(Domain.cookies)
print(Fore.LIGHTWHITE_EX + "\nHeaders:")
print(Domain.headers)
input("\nPress enter to back")
os.system("clear")
os.system("cls")
menu()
if int =="5" or int=="post":
print(Fore.LIGHTBLUE_EX + "looks like https://website /post <-- formulary")
pURL = input(Fore.LIGHTWHITE_EX + "POST URL:")
postr = requests.post(pURL)
postr.text
input()
else:
print("ERROR")
print("Restarting...")
time.sleep(1)
os.system("clear")
os.system("cls")
menu()
def seturl():
try:
global URL
print(Fore.LIGHTBLUE_EX + "The url need to contain https:// or http://")
with open("histo.txt", "r+") as his:
histo = his.readlines()[0:2]
historial = "".join(histo)
if historial == "None":
print(Fore.LIGHTYELLOW_EX + "No scraps maked, Passing")
URL = input(Fore.LIGHTRED_EX + "\nURL:")
elimina_lineas("nhisto.txt", "histo.txt", 1)
with open("histo.txt", "r+") as f:
f.readlines()
f.write(URL)
menu()
print("The last page you scraped: " + historial)
restoress = input("\nscrap " + historial + "?: ")
if restoress =="y" or restoress =="yes":
URL = historial
elimina_lineas("nhisto.txt", "histo.txt", 1)
with open("histo.txt", "r+") as f:
f.readlines()
f.write(URL)
menu()
URL = input(Fore.LIGHTRED_EX + "\nURL:")
elimina_lineas("nhisto.txt", "histo.txt", 1)
with open("histo.txt", "r+") as f:
f.readlines()
f.write(URL)
menu()
except:
print(Fore.LIGHTRED_EX + "Error making the requests")
input(Fore.LIGHTYELLOW_EX + "")
os.system("clear")
os.system("cls")
seturl()
menu()
# Install requirements
def setup():
if os.name=="nt":
os.system("pip install requests")
os.system("pip install colorama")
os.system("clear")
else:
os.system("pip3 install requests")
os.system("pip3 install colorama")
os.system("cls")
seturl()
def elimina_lineas(entrada, salida, linea_eliminar):
with open(entrada, "rt") as arch_in:
with open(salida, "wt") as arch_out:
nro_linea = 1
for linea_in in arch_in:
if nro_linea != linea_eliminar:
arch_out.write(linea_in)
nro_linea += 1
setup()