-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
242 lines (204 loc) · 7.15 KB
/
main.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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
import os
import socket
import sys
import threading
from queue import Queue
import time
from datetime import datetime
from colorama import init, Fore, Style
import subprocess
import requests
import json
import dns.resolver
import phonenumbers
from phonenumbers import geocoder
from opencage.geocoder import OpenCageGeocode
init(autoreset=True)
subprocess.call('clear', shell=True)
def maintool():
target = input("ENTER TARGET IP: ")
ports = input("ENTER NUMBER OF PORTS TO SCAN: ")
threads = input("ENTER NUMBER OF THREADS (MAXIMUM: 3) ")
if threads == "1":
thr = 1
elif threads == "2":
thr = 2
elif threads == "3":
thr = 3
else:
print("INVALID INPUT!!!")
print("ERROR: QUITTING....")
sys.exit()
hack = socket.gethostbyname(target)
num = int(ports)
print("Starting at: ")
t1 = datetime.now()
print(t1)
###################################################################################################
def threader():
while True:
worker = q.get()
starthack(worker)
q.task_done()
q = Queue()
for x in range(thr):
t = threading.Thread(target=threader)
t.daemon = False
t.start()
start = time.time()
print(Style.BRIGHT + Fore.YELLOW + "SCANNING:", target)
print("WAITING FOR RESULTS...")
#################################################################################################
def starthack(port):
hacking = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
hacking.settimeout(10)
try:
result = hacking.connect_ex((hack, port))
if result == 0:
service = socket.getservbyport(port)
print("-----------------------------------------")
print(Style.BRIGHT + Fore.YELLOW + "PORT:", port, Style.BRIGHT + Fore.GREEN + " OPEN")
print(Style.BRIGHT + Fore.YELLOW + "INFORMATION")
print(service)
print("-----------------------------------------")
hacking.close()
print("")
print("")
if port == 21:
print("FTP IS OPEN!! ")
print("CHECKING FOR ANONYMOUS AUTHENTICATION")
with open('FTPTarget.txt', 'w') as st:
st.write(hack)
st.close()
os.system("xterm -e 'python3 ftp.py'")
if port == 22:
print("SSH IS OPEN!!")
print("ATTEMPTING BRUTEFORCE ATTACK")
with open('SSHTarget.txt', 'w') as st:
st.write(hack)
st.close()
os.system("xterm -e 'proxychains python3 attack.py'")
else:
print("-----------------------------------------")
print(Style.BRIGHT + Fore.YELLOW + "PORT:", port, Style.BRIGHT + Fore.RED + " CLOSED")
print("-----------------------------------------")
hacking.close()
print("")
print("")
except KeyboardInterrupt:
print(t1)
print("Canceled")
sys.exit()
except socket.gaierror:
print(t1)
print("Hostname could not be resolved. Exiting")
sys.exit()
except socket.error:
print(t1)
print("Error")
print("ERROR")
sys.exit()
# 10 jobs assigned.
for worker in range(1, num):
q.put(worker)
# wait till the thread terminates.
q.join()
print("FINISHED SCANNING TARGET:", target)
os.system('date')
print(Style.BRIGHT + Fore.YELLOW + "END OF REPORT")
print("2023 - Corexital")
def mainmenu():
print(Style.BRIGHT + Fore.YELLOW + "START AT:", (datetime.now()))
print("=============COREXITAL MULTITOOL=============")
print("")
print("Written by: Derek Johnston")
print('\n',
"Get IP location [1] \n",
"Get DNS information [2] \n",
"Port scan with automatic FTP Anon login and automatic SSH brute [3] \n",
"Get location of phone number [4] \n"
)
todo = input(Style.BRIGHT + Fore.YELLOW + "Select Options: ")
if todo == "1":
geotar()
elif todo == "2":
dnsloc()
elif todo == "3":
maintool()
elif todo =="4":
phonloc()
else:
print("Invalid Input!!! Quitting!!")
sys.exit()
def phonloc():
numenter = input(Style.BRIGHT + Fore.YELLOW + "Enter phone number with country code (+1 US/CA)")
print(numenter)
pepnumber = phonenumbers.parse(numenter)
location = phonenumbers.geocoder.description_for_number(pepnumber, "en")
print("LOCATION:")
print(location)
key = '7b5057c5d0594b948600eaf3affa261d'
geocoder = OpenCageGeocode(key)
query = str(location)
results = geocoder.geocode(query)
lat = results[0]['geometry']['lat']
lng = results[0]['geometry']['lng']
print("GPS COORDINATES:")
print(lat, lng)
print("END OF REPORT")
print("Corexital Data 2023")
enterex = input(Style.BRIGHT + Fore.YELLOW + "Select '1' to return to main menu \n or '2' to quit")
if enterex == "1":
mainmenu()
elif enterex == "2":
sys.exit()
else:
print("Invalid Input!!! Returning to main menu")
mainmenu()
def geotar():
GeoTar = input(Style.BRIGHT + Fore.YELLOW + "Enter IP: ")
print(Style.BRIGHT + Fore.YELLOW + "Getting IP Location.....")
request_url = 'https://geolocation-db.com/jsonp/' + GeoTar
response = requests.get(request_url)
result = response.content.decode()
result = result.split("(")[1].strip(")")
result = json.loads(result)
print(result)
time.sleep(2)
enterex = input(Style.BRIGHT + Fore.YELLOW + "Select '1' to return to main menu \n or '2' to quit")
if enterex == "1":
mainmenu()
elif enterex == "2":
sys.exit()
else:
print("Invalid Input!!! Returning to main menu")
mainmenu()
def dnsloc():
dnstar = input(Style.BRIGHT + Fore.YELLOW + "Enter host name: ")
dnsinfo: dns.resolver.Answer = dns.resolver.resolve(dnstar)
print(Style.BRIGHT + Fore.BLUE + 'query qname:', dnsinfo.qname, len(dnsinfo))
for rdata in dnsinfo:
print(rdata)
dnsinfo: dns.resolver.Answer = dns.resolver.resolve(dnstar, 'MX')
for rdata in dnsinfo:
print(Style.BRIGHT + Fore.BLUE + "MX: ")
print(rdata)
dnsinfo: dns.resolver.Answer = dns.resolver.resolve(dnstar, 'NS')
for rdata in dnsinfo:
print(Style.BRIGHT + Fore.BLUE + "NAMESERVERS: ")
print(rdata)
dnsinfo: dns.resolver.Answer = dns.resolver.resolve(dnstar, 'TXT')
for rdata in dnsinfo:
print(Style.BRIGHT + Fore.BLUE + "TXT RECORDS: ")
print(rdata)
time.sleep(2)
enterexdns = input(Style.BRIGHT + Fore.YELLOW + "Press '1' to return to main menu. Press '2' to exit")
if enterexdns == '1':
mainmenu()
elif enterexdns == '2':
print("Quitting")
sys.exit()
else:
print("Invalid Input!!! Returning to main menu")
mainmenu()
mainmenu()