Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (sizeof($argv) > 1) {$q=$argv[1];} else {$q=null;print('filename required');exit(1);}
- $re = '/^(\d+\/\d+\/\d+ \d+:\d+:\d+)\.\d+ : Reply\[\d+\] from ([0-9.]+): bytes=\d+ time=(\d+\.\d+) ms TTL=(\d+)/mi';
- ini_set('memory_limit','512M');
- $output=file_get_contents($q);
- print (strlen ($output));
- if (!$output) {
- print ('cant read ' . $q .'!');
- exit();
- }
- preg_match_all($re, $output, $matches,PREG_SET_ORDER);
- $file = fopen("c:/rgr/pinglog2-".date("Ymd").".txt", "a");
- $i=0;
- foreach ($matches as $val) {
- $i=$i+1;
- echo implode(array_slice ($val,1),"\t")."\n";
- fwrite($file,implode(array_slice ($val,1),"\t")."\n");
- }
- fclose($file);
- print ($i);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement