Skip to content

Instantly share code, notes, and snippets.

typedef struct pseudo_header //needed for checksum calculation
{
unsigned int source_address;
unsigned int dest_address;
unsigned char placeholder;
unsigned char protocol;
unsigned short tcp_length;
struct tcphdr tcp;
};
$ gcc route.c
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 0 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 1 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 2 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 3 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 4 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 5 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 6 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 7 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 8 has
//Now receive the response
while( (read_size = recv(sock , buffer , sizeof(buffer) , 0) ) )
{
response = realloc(response , read_size + total_size);
memcpy(response+total_size , buffer , read_size);
total_size += read_size;
}
printf("%s" , response);
//Now receive the response
while( (read_size = recv(sock , buffer , sizeof(buffer) , 0) ) )
{
*response = realloc(*response , read_size + total_size);
memcpy(*response + total_size , buffer , read_size);
total_size += read_size;
}
*response = realloc(*response , total_size + 1);
response_2 = response;
printf("BEFORE : %s" , response_2);
pch = strtok(response , "\n");
while(pch != NULL)
{
//Check if whois line
wch = strstr(pch , "whois.");
if(wch != NULL)
{
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
char *str_replace(char *search , char *replace , char *subject);
int main()
{
char *a = "http://www.google.com.www.abcd.com.www.sadasdasd.www.";
/*
* Search and replace a string with another string , in a string
* */
char *str_replace(char *search , char *replace , char *subject)
{
char *new_subject = NULL , *p , *temp;
int size;
//subject to work upon
new_subject = strdup(subject);
char *str_replace(char *search , char *replace , char *subject)
{
char *new_subject = NULL , *p = NULL , *old , *temp;
int c = 0, final_size;
new_subject = subject;
//Get new size of string
//for(p = strstr(subject , search) ; p != NULL ; p = strstr(p+strlen(search) , search))
while((p = strstr(new_subject , search)))
{
#include<stdio.h>
#include<string.h> //strlen
#include<stdlib.h> //strlen
#include<sys/socket.h>
#include<arpa/inet.h> //inet_addr
#include<unistd.h> //write
#include<pthread.h> //for threading , link with lpthread
void *connection_handler(void *);
#ifdef WX_PRECOMP
#include "wx_pch.h"
#endif
#ifdef __BORLANDC__
#pragma hdrstop
#endif //__BORLANDC__
#include "tcptraceMain.h"
#include "turbotrace.h"