-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
142 lines (101 loc) · 4.83 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
import os
import requests
import socket
from time import sleep
def main():
os.system("clear")
print("""\033[1;95m
██╗██████╗ ███████╗██╗███╗ ██╗██████╗ ███████╗██████╗
██║██╔══██╗██╔════╝██║████╗ ██║██╔══██╗██╔════╝██╔══██╗
██║██████╔╝█████╗ ██║██╔██╗ ██║██║ ██║█████╗ ██████╔╝
██║██╔═══╝ ██╔══╝ ██║██║╚██╗██║██║ ██║██╔══╝ ██╔══██╗
██║██║ ██║ ██║██║ ╚████║██████╔╝███████╗██║ ██║
╚═╝╚═╝ ╚═╝ ╚═╝╚═╝ ╚═══╝╚═════╝ ╚══════╝╚═╝ ╚═╝
\033[1;102m\033[1;30m_Cyber security_\033[0;0m
\033[1;96m[\033[1;92m1\033[1;96m] \033[1;95m<-|-> \033[1;92mConsultar IP
\033[1;96m[\033[1;92m2\033[1;96m] \033[1;95m<-|-> \033[1;92mConsultar meu IP
\033[1;96m[\033[1;92m3\033[1;96m] \033[1;95m<-|-> \033[1;92mChecar porta
\033[1;96m[\033[1;92m4\033[1;96m] \033[1;95m<-|-> \033[1;92mSair
""")
es = input('\033[1;95m-->\033[1;92m ')
if es == '1' or es == '01':
os.system('clear')
ip = input('\033[1;95mDigite o IP \033[1;92m--> \033[1;93m')
request = requests.get(f'http://ip-api.com/json/{ip}')
json_api = request.json()
if 'message' not in json_api:
os.system('clear')
print('\033[1;94mResultados abaixo :)\n')
print('\033[1;93mIp: {}'.format(json_api['query']))
print('Pais: {}'.format(json_api['country']))
print('Estado: {}'.format(json_api['regionName']))
print('Cidade: {}'.format(json_api['city']))
print('Zip: {}'.format(json_api['zip']))
print('Longitude: {}'.format(json_api['lon']))
print('Latitude: {}'.format(json_api['lat']))
print('Timezone: {}'.format(json_api['timezone']))
print('Provedor: {}'.format(json_api['isp']))
print('Organização: {}\n'.format(json_api['org']))
else:
print('\n\033[1;91mIP invalido\n')
print('\033[1;102m\033[1;30m1 = Sair | 2 = Voltar ao menu\n\033[0;0m')
sair = input('\033[1;95m-->\033[1;92m ')
if sair == '01' or sair == '1':
os.system('clear')
print('\033[1;102m\033[1;91m_Cyber Security_\033[0;0m\n')
exit()
else:
main()
elif es == '2' or es == '02':
os.system('clear')
request = requests.get('http://ip-api.com/json/?')
json_api = request.json()
print('\033[1;94mResultados abaixo :) \n')
print('\033[1;93mIp: {}'.format(json_api['query']))
print('Pais: {}'.format(json_api['country']))
print('Estado: {}'.format(json_api['regionName']))
print('Cidade: {}'.format(json_api['city']))
print('Zip: {}'.format(json_api['zip']))
print('Longitude: {}'.format(json_api['lon']))
print('Latitude: {}'.format(json_api['lat']))
print('Timezone: {}'.format(json_api['timezone']))
print('Provedor: {}'.format(json_api['isp']))
print('Organização: {}\n'.format(json_api['org']))
print('\033[1;102m\033[1;30m1 = Sair | 2 = Voltar ao menu\033[0;0m\n')
sair = input('\033[1;95m-->\033[1;92m ')
if sair == '1' or sair == '01':
os.system('clear')
print('\033[1;102m\033[1;91m_Cyber Security_\033[0;0m\n')
exit()
else:
main()
elif es == '3' or es == '03':
cnx = socket.socket()
os.system('clear')
ip = input('\033[1;95mDigite um IP \033[1;92m-->\033[1;93m ')
porta = int(input('\033[1;95mDigite uma porta \033[1;92m-->\033[1;93m '))
time = 1
cnx.settimeout(time)
n = cnx.connect_ex((ip,porta))
if n == 0:
print('\n\033[1;92mPorta aberta\n')
else:
print('\nP\033[1;915morta fechada\n')
print('\033[1;102m\033[1;30m1 = Sair | 2 = Voltar ao menu\033[0;0m\n')
sair = input('\033[1;95m-->\033[1;92m ')
if sair == '1' or sair == '01':
os.system('clear')
print('\033[102m\033[1;30m_Cyber Security_\033[0;0m\n')
exit()
else:
main()
elif es == '4' or es == '04':
os.system('clear')
print('\033[1;102m\033[1;30m_Cyber Security_\033[0;0m\n')
exit()
else:
os.system('clear')
print('\033[1;91mOpção invalida')
sleep(2)
main()
main()