Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Simple payload injector
- to use with GET...
- test
- by Cooler_
- c00f3r[at]gmail[dot]com
- */
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- char *payload_injector(char * ptr,char * payload,int counter)
- {
- char *new=(char *)malloc(sizeof(char)*(strlen(ptr)+strlen(payload)+1));
- short i=0,x=1;
- while(*ptr != '\0')
- {
- if(*ptr == '!')
- {
- if(counter==x)
- {
- strcat(new,payload);
- i+=strlen(payload);
- }
- x++;
- }
- else
- {
- *(new+i)=*ptr;
- i++;
- }
- ptr++;
- }
- return new;
- }
- int char_type_counter(char *string,char type)
- {
- short counter=0;
- while(*string != '\0')
- {
- if(*string==type)
- counter++;
- string++;
- }
- return counter;
- }
- int main()
- {
- char *quote="issteste.php?var=a!&ola=2!&teste=data!";
- int counter=char_type_counter(quote,'!');
- char *test=(char *)malloc(sizeof(char)*(strlen(quote)+8));
- char *payload="PAYLOAD";
- puts(quote);
- do{
- test=payload_injector(quote,payload,counter);
- puts(test);
- counter--;
- }while(counter);
- free(test);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment