Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- C:\Users\Administrator>cat pingcheck.c
- #include "stdio.h"
- #include "string.h"
- char * delN(char * a){
- int l, i;
- for (i = 1; i <= 17; i++)
- {
- if(a[i]=='\n' || a[i] == '\0')
- {
- a[i]=' ';
- }
- }
- return a;
- }
- int main (int argc, char *argv[])
- {
- register int i, j;
- char ip_check[20] = {0}, text[50] = "ping -S -n 10 -W -s 100 -w 500 ";
- char tmp1[50] = {};
- char tmp2[20] = "> pingtemp.txt";
- char tmp3[120] = {};
- char tmp4[5] = "avg";
- FILE *iplist = fopen("graffias.txt", "r");
- FILE *result;
- for (i = 1; i <= 17; i++)
- {
- strcpy(tmp1, text);
- fgets(ip_check, 20, iplist);
- system(strcat(strcat(tmp1, delN(ip_check)), tmp2));
- printf("%s", ip_check);
- result = fopen("pingtemp.txt", "r");
- for (j = 1; j <= 25; j++)
- {
- fgets(tmp3, 120, result);
- if (strstr(tmp3, tmp4))
- {
- puts(tmp3);
- }
- }
- fclose(result);
- }
- fclose(iplist);
- //system("pause");
- return 0;
- }
- C:\Users\Administrator>pingcheck
- 173.236.218.164 RTTs of replies in ms: min/avg/max/dev: 253.436 / 254.335 / 256.083 / 0.648
- 173.236.222.81 RTTs of replies in ms: min/avg/max/dev: 256.100 / 257.091 / 259.626 / 0.920
- 173.236.222.251 RTTs of replies in ms: min/avg/max/dev: 248.493 / 249.422 / 251.408 / 0.787
- 173.236.217.33 RTTs of replies in ms: min/avg/max/dev: 196.197 / 197.026 / 199.278 / 0.869
- 173.236.222.49 RTTs of replies in ms: min/avg/max/dev: 242.128 / 243.352 / 245.575 / 0.948
- 173.236.222.166 RTTs of replies in ms: min/avg/max/dev: 242.875 / 243.707 / 246.157 / 0.962
- 173.236.222.112 RTTs of replies in ms: min/avg/max/dev: 228.757 / 229.439 / 231.762 / 0.811
- 173.236.218.170 RTTs of replies in ms: min/avg/max/dev: 220.359 / 220.962 / 223.522 / 0.882
- 173.236.217.32 RTTs of replies in ms: min/avg/max/dev: 192.847 / 193.663 / 195.502 / 0.746
- 173.236.222.115 RTTs of replies in ms: min/avg/max/dev: 198.460 / 199.623 / 201.097 / 0.809
- 173.236.222.87 RTTs of replies in ms: min/avg/max/dev: 226.857 / 227.584 / 229.439 / 0.737
- 173.236.218.173 RTTs of replies in ms: min/avg/max/dev: 241.530 / 242.695 / 244.799 / 0.803
- 173.236.217.35 RTTs of replies in ms: min/avg/max/dev: 238.600 / 239.568 / 241.439 / 0.760
- 173.236.222.131 RTTs of replies in ms: min/avg/max/dev: 242.379 / 243.150 / 244.567 / 0.565
- 173.236.222.133 RTTs of replies in ms: min/avg/max/dev: 193.451 / 194.274 / 196.468 / 0.844
- 173.236.222.108 RTTs of replies in ms: min/avg/max/dev: 239.132 / 240.095 / 242.740 / 0.913
- 173.236.222.126 RTTs of replies in ms: min/avg/max/dev: 241.427 / 241.951 / 243.380 / 0.526
Advertisement
Add Comment
Please, Sign In to add comment