ff19

Bored

Oct 2nd, 2011
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.00 KB | None | 0 0
  1. C:\Users\Administrator>cat pingcheck.c
  2. #include "stdio.h"
  3. #include "string.h"
  4.  
  5. char * delN(char * a){
  6.         int l, i;
  7.         for (i = 1; i <= 17; i++)
  8.         {
  9.                 if(a[i]=='\n' || a[i] == '\0')
  10.                 {
  11.                 a[i]=' ';
  12.                 }
  13.         }
  14.         return a;
  15. }
  16.  
  17.  
  18. int main (int argc, char *argv[])
  19. {
  20.         register int i, j;
  21.         char ip_check[20] = {0}, text[50] = "ping -S -n 10 -W -s 100 -w 500 ";
  22.     char tmp1[50] = {};
  23.     char tmp2[20] = "> pingtemp.txt";
  24.     char tmp3[120] = {};
  25.     char tmp4[5] = "avg";
  26.  
  27.         FILE *iplist = fopen("graffias.txt", "r");
  28.         FILE *result;
  29.         for (i = 1; i <= 17; i++)
  30.         {
  31.                 strcpy(tmp1, text);
  32.                 fgets(ip_check, 20, iplist);
  33.                 system(strcat(strcat(tmp1, delN(ip_check)), tmp2));
  34.                 printf("%s", ip_check);
  35.                 result = fopen("pingtemp.txt", "r");
  36.                 for (j = 1; j <= 25; j++)
  37.                 {
  38.                         fgets(tmp3, 120, result);
  39.                         if (strstr(tmp3, tmp4))
  40.                         {
  41.                                 puts(tmp3);
  42.                         }
  43.                 }
  44.                 fclose(result);
  45.         }
  46.         fclose(iplist);
  47.         //system("pause");
  48.         return 0;
  49. }
  50.  
  51. C:\Users\Administrator>pingcheck
  52. 173.236.218.164     RTTs of replies in ms: min/avg/max/dev: 253.436 / 254.335 / 256.083 / 0.648
  53.  
  54. 173.236.222.81      RTTs of replies in ms: min/avg/max/dev: 256.100 / 257.091 / 259.626 / 0.920
  55.  
  56. 173.236.222.251     RTTs of replies in ms: min/avg/max/dev: 248.493 / 249.422 / 251.408 / 0.787
  57.  
  58. 173.236.217.33      RTTs of replies in ms: min/avg/max/dev: 196.197 / 197.026 / 199.278 / 0.869
  59.  
  60. 173.236.222.49      RTTs of replies in ms: min/avg/max/dev: 242.128 / 243.352 / 245.575 / 0.948
  61.  
  62. 173.236.222.166     RTTs of replies in ms: min/avg/max/dev: 242.875 / 243.707 / 246.157 / 0.962
  63.  
  64. 173.236.222.112     RTTs of replies in ms: min/avg/max/dev: 228.757 / 229.439 / 231.762 / 0.811
  65.  
  66. 173.236.218.170     RTTs of replies in ms: min/avg/max/dev: 220.359 / 220.962 / 223.522 / 0.882
  67.  
  68. 173.236.217.32      RTTs of replies in ms: min/avg/max/dev: 192.847 / 193.663 / 195.502 / 0.746
  69.  
  70. 173.236.222.115     RTTs of replies in ms: min/avg/max/dev: 198.460 / 199.623 / 201.097 / 0.809
  71.  
  72. 173.236.222.87      RTTs of replies in ms: min/avg/max/dev: 226.857 / 227.584 / 229.439 / 0.737
  73.  
  74. 173.236.218.173     RTTs of replies in ms: min/avg/max/dev: 241.530 / 242.695 / 244.799 / 0.803
  75.  
  76. 173.236.217.35      RTTs of replies in ms: min/avg/max/dev: 238.600 / 239.568 / 241.439 / 0.760
  77.  
  78. 173.236.222.131     RTTs of replies in ms: min/avg/max/dev: 242.379 / 243.150 / 244.567 / 0.565
  79.  
  80. 173.236.222.133     RTTs of replies in ms: min/avg/max/dev: 193.451 / 194.274 / 196.468 / 0.844
  81.  
  82. 173.236.222.108     RTTs of replies in ms: min/avg/max/dev: 239.132 / 240.095 / 242.740 / 0.913
  83.  
  84. 173.236.222.126     RTTs of replies in ms: min/avg/max/dev: 241.427 / 241.951 / 243.380 / 0.526
  85.  
Advertisement
Add Comment
Please, Sign In to add comment