![]() |
|
|
#36 |
|
Архивный участник
Join Date: Feb 2005
Posts: 200
|
here is my analyser - i'm not the programmer =)
[php:1:5f0e77eb5e]<?php $m="25_12"; $i=fopen($m."_conv.dat","rb"); $o=fopen($m.".dat","w+b"); $h=fread($i,18); fwrite($o,$h); // init the counters $zero=0; $forty=0; $un=0; $fourx=0; $maxd=0; while (!feof($i)) { // start reading $tr=fread($i,1); $tr2=fread($i,1); // first indictor $d=ord($tr)+ord($tr2)*256; //convert 2 bytes to word if ($d>$maxd) $maxd=$d; // remember if is maximal indictor switch($d) { case 0: // 00 00 $zero++; $data=fread($i,4); // read xx xx yy yy fwrite($o,$tr); fwrite($o,$tr2); fwrite($o,$data); // write to output break; case 64: // 40 00 break; $forty++; $fr=fread($i,128); // read 64 bytes following fwrite($o,$tr); fwrite($o,$tr2); fwrite($o,$fr); // write to output break; default: // 41 00 and ++ break; if ($d>64 && $d<512) { $fourx++; $j=0; fwrite($o,$tr); // write to output fwrite($o,$tr2); while ($j<$d) { // reads subindictor and its data until indictor count is not reached $dr1=fread($i,1); // read subindictor $dr2=fread($i,1); $dr=ord($dr1)+ord($dr2)*256; if ($dr>10) {echo "DR>10"; exit(); // if subindictor >10 - FAIL } $sd=fread($i,$dr*2); fwrite($o,$dr1); fwrite($o,$dr2); fwrite($o,$sd); $j=$j+$dr;} } else { echo "Unknown sig: ".$d."\n"; // raise unknown indictor failure echo $zero." ".$forty." ".$fourx." ".$un; exit(); } break; } } echo $zero." ".$forty." ".$fourx." ".$un."\n"; // output summary info echo "Maximum descriptor ".$maxd; fclose($i); fclose($o); ?>[/php:1:5f0e77eb5e] |
|
|
| Thread Tools | Search this Thread |
| Display Modes | |
|
|