I am trying to add random bytes to binary (.exe) files to increase it size using php. So far I got this:
function junk($bs)
{
// string length: 256 chars
$tmp = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
for($i=0;$i<=$bs;$i++)
{
$tmp = $tmp . $tmp;
}
return $tmp;
}
$fp = fopen('test.exe', 'ab');
fwrite($fp, junk(1));
fclose($fp);
Bu iyi çalışır ve çıkan exe fonksiyonel ama ben dosyanın daha fazla boyutu eklemek için önemsiz (100) yapmak istiyorsanız ben php hata alıyorum "Fatal error: ... İzin bellek boyutu"
Hangi başka bir şekilde ben bir hata almadan bunu başarabilir? Bu fwrite xxx kez döngü ok olurdu?