2018-11-09 15:00:05 +01:00
|
|
|
<?php
|
2018-11-11 15:54:54 +01:00
|
|
|
if(file_exists("Universal Bypass Source.zip"))
|
2018-11-09 15:00:05 +01:00
|
|
|
{
|
2018-11-11 15:54:54 +01:00
|
|
|
unlink("Universal Bypass Source.zip");
|
2018-11-09 15:00:05 +01:00
|
|
|
}
|
|
|
|
if(file_exists("Universal Bypass for Chrome.zip"))
|
|
|
|
{
|
|
|
|
unlink("Universal Bypass for Chrome.zip");
|
|
|
|
}
|
2018-11-11 15:54:54 +01:00
|
|
|
if(file_exists("Universal Bypass for Firefox.zip"))
|
|
|
|
{
|
|
|
|
unlink("Universal Bypass for Firefox.zip");
|
|
|
|
}
|
2018-11-09 15:00:05 +01:00
|
|
|
|
|
|
|
echo "Indexing...\n";
|
|
|
|
$index = [];
|
|
|
|
function recursivelyIndex($dir)
|
|
|
|
{
|
|
|
|
global $index;
|
|
|
|
foreach(scandir($dir) as $f)
|
|
|
|
{
|
2018-11-26 20:21:16 +01:00
|
|
|
if(substr($f, 0, 1) != ".")
|
2018-11-09 15:00:05 +01:00
|
|
|
{
|
2018-11-26 20:21:16 +01:00
|
|
|
$fn = $dir."/".$f;
|
|
|
|
if(is_dir($fn))
|
|
|
|
{
|
|
|
|
recursivelyIndex($fn);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
array_push($index, substr($fn, 2));
|
|
|
|
}
|
2018-11-09 15:00:05 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
recursivelyIndex(".");
|
|
|
|
|
2018-11-11 15:54:54 +01:00
|
|
|
echo "Building...\n";
|
|
|
|
function createZip($file)
|
2018-11-09 15:00:05 +01:00
|
|
|
{
|
2018-11-11 15:54:54 +01:00
|
|
|
$zip = new ZipArchive();
|
|
|
|
$zip->open($file, ZipArchive::CREATE + ZipArchive::EXCL + ZipArchive::CHECKCONS) or die("Failed to create {$file}.\n");
|
|
|
|
return $zip;
|
2018-11-09 15:00:05 +01:00
|
|
|
}
|
2018-11-11 15:54:54 +01:00
|
|
|
$source = createZip("Universal Bypass Source.zip");
|
|
|
|
$chrome = createZip("Universal Bypass for Chrome.zip");
|
|
|
|
$firefox = createZip("Universal Bypass for Firefox.zip");
|
2018-11-09 15:00:05 +01:00
|
|
|
foreach($index as $fn)
|
|
|
|
{
|
2018-11-26 20:21:16 +01:00
|
|
|
if($fn == "content_script.js")
|
2018-11-11 15:54:54 +01:00
|
|
|
{
|
|
|
|
$cont = str_replace("\\", "\\\\", preg_replace('/injectScript\("\("\+\(\(\)=>({.*})\)\+"\)\(\)"\)\/\/injectend/s', 'injectScript(`(()=>$1)()`)', file_get_contents($fn)));
|
|
|
|
$chrome->addFromString($fn, $cont);
|
|
|
|
$firefox->addFromString($fn, $cont);
|
|
|
|
unset($cont);
|
2018-11-09 15:00:05 +01:00
|
|
|
}
|
2018-11-26 20:21:16 +01:00
|
|
|
else
|
2018-11-09 15:00:05 +01:00
|
|
|
{
|
2018-11-26 20:21:16 +01:00
|
|
|
if($fn == "manifest.json")
|
|
|
|
{
|
|
|
|
$json = json_decode(file_get_contents($fn), true);
|
|
|
|
unset($json["web_accessible_resources"]);
|
|
|
|
$chrome->addFromString($fn, json_encode($json, JSON_UNESCAPED_SLASHES));
|
|
|
|
unset($json);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$chrome->addFile($fn, $fn);
|
|
|
|
}
|
2018-11-11 15:54:54 +01:00
|
|
|
$firefox->addFile($fn, $fn);
|
2018-11-09 15:00:05 +01:00
|
|
|
}
|
2018-11-11 15:54:54 +01:00
|
|
|
$source->addFile($fn, $fn);
|
2018-11-09 15:00:05 +01:00
|
|
|
}
|
2018-11-11 15:54:54 +01:00
|
|
|
$source->close();
|
|
|
|
$chrome->close();
|
|
|
|
$firefox->close();
|