-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.cpp
181 lines (176 loc) · 4.75 KB
/
main.cpp
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
#include<iostream>
#include<chrono>
#include<cstring>
#include<string.h>
#include<stdio.h>
#include<sstream>
using namespace std;
/*
int main(){
auto inicio = chrono::high_resolution_clock::now();
Connect_Socket("192.168.43.1", 8080);
auto fin = chrono::high_resolution_clock::now();
chrono::duration<double> duracion = fin - inicio;
cout<<duracion.count()<<endl;
}
*/
//FUNCIONES LOCALES
//FUNCIONES DE INFORMACION
void Connection_bluetooth();
void Connection_bluetooth_info();
void bluetooth_list();
void bluettoh_info();
void crazy_principal();
void crazy_info();
void os_principal();
void os_info();
void icmp_principal();
void icmp_info();
void arp_info();
void version();
void principal();
void httpGET_scan();
void server_version();
void server_arp();
void banner();
void http_get_status(string vaca);
void print_(double final);
void print_bs(double dab);
void help_function();
//FUNCIONES DE RESULTADO
//FUNCIONES BLUETOOTH
int lister_bluetooth();
int connected_bluetooth(string macaddress);
//FUNCIONES SOCKETS
int Connect_Socket(const char * hostname, int puerto);
int os_function(const char* direccion);
int server_version_const(const char* dir, const char* port);
int getmacaddress(const char* direccionremota);
int icmp_peticion(const char* direccion_remota);
void peticion_https_Get(const char* netinet);
void peticion_http_get(const char* sitioweb);
int main(int argc, char* argv[]){
banner();
if(argc==2){
if(strcmp(argv[1], "--bluetooth-connect")==0){
bluettoh_info();
return 0;
}
if(strcmp(argv[1], "--list-bluetooth")==0){
bluetooth_list();
auto var = chrono::high_resolution_clock::now();
lister_bluetooth();
auto var2 = chrono::high_resolution_clock::now();
chrono::duration<double> duracion = var2 - var;
print_(duracion.count());
return 0;
}
if(strcmp(argv[1], "--CRAZYMODE")==0){
crazy_info();
return 0;
}
if(strcmp(argv[1], "--osdetection") == 0){
os_info();
return 0;
}
if(strcmp(argv[1], "--version")==0){
version();
return 0;
}
if(strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0){
help_function();
return 0;
}
if(strcmp(argv[1], "--arp") == 0){
arp_info();
return 0;
}
if(strcmp(argv[1], "--icmp")==0){
icmp_info();
return 0;
}
principal();
auto control = chrono::high_resolution_clock::now();
for(int x=0; x<10001;x++){
Connect_Socket(argv[1], x);
}
auto final = chrono::high_resolution_clock::now();
chrono::duration<double> dur = final - control;
print_bs(dur.count());
}
if(argc==3){
if(strcmp(argv[2], "--bluetooth-connect")==0){
auto loader = chrono::high_resolution_clock::now();
Connection_bluetooth();
connected_bluetooth(argv[1]);
auto reader = chrono::high_resolution_clock::now();
chrono::duration<double> esperar = reader - loader;
print_(esperar.count());
return 0;
}
if(strcmp(argv[2], "--osdetection")==0){
auto con = chrono::high_resolution_clock::now();
os_principal();
os_function(argv[1]);
auto noc = chrono::high_resolution_clock::now();
chrono::duration<double> wait = noc-con;
print_(wait.count());
return 0;
}
if(strcmp(argv[2], "-sV")==0){
auto oo = chrono::high_resolution_clock::now();
server_version();
for(int i=0; i<=10001;i++){
stringstream bb;
bb<<i;
server_version_const(argv[1], bb.str().c_str());
}
auto uu = chrono::high_resolution_clock::now();
chrono::duration<double> controler = uu - oo;
print_(controler.count());
}
if(strcmp(argv[2], "--arp")==0){
auto ar = chrono::high_resolution_clock::now();
server_arp();
getmacaddress(argv[1]);
auto rp = chrono::high_resolution_clock::now();
chrono::duration<double> manager = rp - ar;
print_(manager.count());
}
if(strcmp(argv[2], "--icmp")==0){
auto ic = chrono::high_resolution_clock::now();
icmp_principal();
icmp_peticion(argv[1]);
auto mp = chrono::high_resolution_clock::now();
chrono::duration<double> feh = mp - ic;
print_(feh.count());
}
if(strcmp(argv[2], "--httpGET")==0){
auto indi = chrono::high_resolution_clock::now();
httpGET_scan();
peticion_http_get(argv[1]);
auto idni = chrono::high_resolution_clock::now();
chrono::duration<double> camisa = idni-indi;
print_(camisa.count());
}
if(strcmp(argv[2], "--httpsGET") == 0){
auto jj = chrono::high_resolution_clock::now();
httpGET_scan();
peticion_https_Get(argv[1]);
auto kk = chrono::high_resolution_clock::now();
chrono::duration<double> durar = kk - jj;
print_(durar.count());
}
}
if(argc==4){
if(strcmp(argv[3], "-p")){
auto jjj = chrono::high_resolution_clock::now();
principal();
Connect_Socket(argv[1], atoi(argv[3]));
auto xdd = chrono::high_resolution_clock::now();
chrono::duration<double> dir = xdd-jjj;
print_(dir.count());
}
}
return 0;
}