This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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."; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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))) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 *); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef WX_PRECOMP | |
#include "wx_pch.h" | |
#endif | |
#ifdef __BORLANDC__ | |
#pragma hdrstop | |
#endif //__BORLANDC__ | |
#include "tcptraceMain.h" | |
#include "turbotrace.h" |
OlderNewer