/****************************************************
 * xss.c -- Main file for ascii to hex XSS.         *
 * Author: stderr (stderr.dev@gmail.com)            *
 *                                                  * 
 * Usage: Run program with a string as its argument *
 * Purpose: Convert ascii to hex for use with XSS   *
 ****************************************************/

#include <stdio.h>
#include <string.h>

void usage(char *program_name)
{
  printf("Hex encoding tool for use with XSS.\n");
  printf("Format: %s (string to encode goes here)\n",program_name);
}

int main(int argc, char *argv[])
{
  int x,y; /*counter variables */
    
  if (argc < 2) {
    usage(argv[0]);
    exit(1);
  }
        
  for (x = 1; x < argc; ++x) {
    for (y = 0; y < strlen(argv[x]); ++y) 
      printf("%%%x",argv[x][y]);
    if (x < argc-1)
      printf("%%20");
  }
  printf("\n");
  return 0;
}
