本文整理汇总了PHP中ccurl::GetFile方法的典型用法代码示例。如果您正苦于以下问题:PHP ccurl::GetFile方法的具体用法?PHP ccurl::GetFile怎么用?PHP ccurl::GetFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ccurl
的用法示例。
在下文中一共展示了ccurl::GetFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: xstart
function xstart()
{
$unix = new unix();
$php = $unix->LOCATE_PHP5_BIN();
$tar = $unix->find_program("tar");
build_progress("{downloading} roundcubeemail-1.1.2.tar.gz", 20);
$tmpfile = $unix->FILE_TEMP();
$curl = new ccurl("http://articatech.net/download/postfix-debian7/roundcubeemail-1.1.2.tar.gz");
if (!$curl->GetFile($tmpfile)) {
echo "Failed: " . $curl->error . "\n";
@unlink($tmpfile);
build_progress("{failed} roundcubeemail-1.1.2.tar.gz", 110);
return;
}
build_progress("{uncompressing} roundcubeemail-1.1.2.tar.gz", 50);
system("{$tar} xf {$tmpfile} -C /");
@unlink($tmpfile);
if (!is_file("/usr/share/roundcube/index.php")) {
build_progress("{uncompressing} roundcubeemail-1.1.2.tar.gz {failed}", 110);
return;
}
build_progress("{verify_database}", 60);
system("{$php} /usr/share/artica-postfix/exec.roundcube.php --database");
build_progress("{restarting_service}", 70);
system("{$php} /usr/share/artica-postfix/exec.roundcube.php --restart");
system("/etc/init.d/artica-status restart");
build_progress("{installing} roundcubeemail-1.1.2.tar.gz {success}", 100);
}
示例2: Import
function Import()
{
$curl = new ccurl("http://www.privacyonline.org.uk/downloads/privacyonline-btl.tpl");
$curl->NoHTTP_POST = true;
$curl->GetFile("/tmp/privacyonline-btl.tpl");
$f = file("/tmp/privacyonline-btl.tpl");
@unlink("/tmp/privacyonline-btl.tpl");
while (list($indx, $line) = each($f)) {
$line = trim($line);
$line = str_replace("\n", "", $line);
$line = str_replace("\r", "", $line);
if (!preg_match("#^\\-d\\s+(.+)#", $line, $re)) {
if ($GLOBALS["VERBOSE"]) {
echo "SKIP \"{$line}\"\n";
}
continue;
}
$line = $re[1];
if (strpos($line, " ") > 0) {
if ($GLOBALS["VERBOSE"]) {
echo "SKIP \"{$line}\"\n";
}
continue;
}
if (strpos($line, "/") > 0) {
if ($GLOBALS["VERBOSE"]) {
echo "SKIP \"{$line}\"\n";
}
continue;
}
$domain[$line] = $line;
}
return $domain;
}
示例3: iprulesDNS
function iprulesDNS()
{
$unix = new unix();
$IPCHAIN = "dnsfilter";
$pidfile = "/etc/artica-postfix/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
if ($unix->process_exists(@file_get_contents($pidfile), basename(__FILE__))) {
echo "Starting......: " . date("H:i:s") . " iptables configurator already executed PID " . @file_get_contents($pidfile) . "\n";
die;
}
$pid = getmypid();
file_put_contents($pidfile, $pid);
$sock = new sockets();
$EnableIptablesDNS = $sock->GET_INFO("EnableIptablesDNS");
if (!is_numeric($EnableIptablesDNS)) {
$EnableIptablesDNS = 1;
}
if ($EnableIptablesDNS == 0) {
$ip = new iptables_exec();
if ($ip->is_chain_exists($IPCHAIN)) {
shell_exec("{$GLOBALS["iptables"]} -F {$IPCHAIN}");
shell_exec("{$GLOBALS["iptables"]} -X {$IPCHAIN}");
}
return;
}
$tmpfile = $unix->FILE_TEMP();
$curl = new ccurl("https://raw.github.com/smurfmonitor/dns-iptables-rules/master/domain-blacklist.txt");
$curl->NoHTTP_POST = true;
if ($curl->GetFile($tmpfile)) {
$size = @filesize($tmpfile);
if ($size < 100) {
$tmpfile = "/usr/share/artica-postfix/bin/install/iptables_defaults.txt";
}
}
$ip = new iptables_exec();
if (!$ip->is_chain_exists($IPCHAIN)) {
echo "Adding chain {$IPCHAIN}\n";
shell_exec("{$GLOBALS["iptables"]} -N {$IPCHAIN}");
shell_exec("{$GLOBALS["iptables"]} -I INPUT -p udp --dport 53 -j {$IPCHAIN}");
} else {
echo "chain {$IPCHAIN} exists...\n";
}
shell_exec("{$GLOBALS["iptables"]} -F {$IPCHAIN}");
shell_exec("{$GLOBALS["iptables"]} -A {$IPCHAIN} -j RETURN");
$f = explode("\n", @file_get_contents($tmpfile));
while (list($num, $ligne) = each($f)) {
$ligne = trim($ligne);
if ($ligne == null) {
continue;
}
$ligne = str_replace("INPUT", $IPCHAIN, $ligne);
$ligne = str_replace("iptables", $GLOBALS["iptables"], $ligne);
$results = array();
exec($ligne, $results);
echo "{$ligne}\n";
while (list($a, $b) = each($results)) {
echo "{$b}\n";
}
}
}
示例4: GetDomains
function GetDomains($i)
{
$unix = new unix();
$tmpfile = $unix->FILE_TEMP();
$curl = new ccurl("http://0675.com.cn/newwebsite_20120101_list._page0.html");
$curl->NoHTTP_POST = true;
echo "Get page {$i}\n";
if (!$curl->GetFile($tmpfile)) {
echo "http://0675.com.cn/newwebsite_20120101_list._page{$i}.html -> error: \n" . $curl->error . "\n";
return;
}
$datas = @file($tmpfile);
$size = strlen(@implode("", $datas)) / 1024;
echo "Page[{$i}]:: {$tmpfile} Size: {$size} Ko\n";
while (list($num, $ligne) = each($datas)) {
if (preg_match("#<div class=.*?newdomain.*?>(.*)#", $ligne)) {
echo "Sure line {$num}";
$newdata = str_replace("</li>", "", $ligne);
$newdata = str_replace("</div>", "", $newdata);
$f = explode("<li>", $newdata);
}
}
$q = new mysql_squid_builder();
while (list($num, $www) = each($f)) {
if (preg_match("#^\\.(.+)#", $www, $re)) {
$www = $re[1];
}
if (strpos($www, ",") > 0) {
continue;
}
if (strpos($www, " ") > 0) {
continue;
}
if (strpos($www, ":") > 0) {
continue;
}
if (strpos($www, "%") > 0) {
continue;
}
if (strpos($www, ">") > 0) {
continue;
}
if (strpos($www, "<") > 0) {
continue;
}
if (preg_match("#^www\\.(.+)#", $www, $re)) {
$www = $re[1];
}
$articacats = trim($q->GET_CATEGORIES($www, true, false));
if ($articacats != null) {
echo "\"{$www}\" SUCCESS - {$articacats} -\n";
continue;
}
echo "\"{$www}\" FAILED\n";
}
}
示例5: download
function download()
{
$unix = new unix();
build_progress("{downloading}", 10);
$URI = "http://wordpress.org/latest.tar.gz";
$TMP_FILE = $unix->FILE_TEMP() . ".gz";
$TMP_DIR = $unix->TEMP_DIR();
echo "Downloading {$URI}\n";
$curl = new ccurl($URI);
$curl->WriteProgress = true;
$curl->ProgressFunction = "download_progress";
if (!$curl->GetFile($TMP_FILE)) {
build_progress("{downloading} {failed}", 110);
echo $curl->error;
return;
}
echo "Extracting {$TMP_FILE} in {$TMP_DIR}\n";
$tar = $unix->find_program("tar");
$cmd = "{$tar} xf {$TMP_FILE} -C {$TMP_DIR}/";
build_progress("{uncompress}", 50);
shell_exec("{$tar} xf {$TMP_FILE} -C {$TMP_DIR}/");
@unlink($TMP_FILE);
$dirs = $unix->dirdir($TMP_DIR);
$WDP_DIR = null;
while (list($num, $ligne) = each($dirs)) {
if (!is_file("{$ligne}/wp-admin/install.php")) {
continue;
}
$WDP_DIR = $ligne;
break;
echo "Find Directory {$ligne}\n";
}
if (!is_dir($WDP_DIR)) {
build_progress("Find directory failed", 110);
echo "Find directory failed\n";
return;
}
build_progress("{installing}", 80);
@mkdir("/usr/share/wordpress-src", 0755, true);
$cp = $unix->find_program("cp");
$rm = $unix->find_program("rm");
shell_exec("cp -rfv {$WDP_DIR}/* /usr/share/wordpress-src/");
if (is_dir($WDP_DIR)) {
echo "Removing {$WDP_DIR}\n";
shell_exec("{$rm} -rf {$WDP_DIR}");
}
$sock = new sockets();
$sock->SET_INFO("EnableFreeWeb", 1);
@file_put_contents("/etc/artica-postfix/settings/Daemons/WordPressInstalled", 1);
system("/etc/init.d/artica-status restart --force");
build_progress("{success}", 100);
$nohup = $unix->find_program("nohup");
$sock = new sockets();
shell_exec("{$nohup} /usr/share/artica-postfix/bin/process1 --verbose 654646 >/dev/null 2>&1 &");
}
示例6: subdomains
function subdomains()
{
$subdomains = "https://ransomwaretracker.abuse.ch/downloads/RW_DOMBL.txt";
$MAIN = unserialize(@file_get_contents("/root/ransomwaretracker.db"));
$curl = new ccurl($subdomains);
if ($curl->GetFile("/root/RW_DOMBL.txt")) {
$f = explode("\n", @file_get_contents("/root/RW_DOMBL.txt"));
while (list($index, $line) = each($f)) {
$line = trim($line);
if (substr($line, 0, 1) == "#") {
continue;
}
$MAIN["DOMAINS"][$line] = true;
}
} else {
echo "{$subdomains} failed\n";
}
$ips = "https://ransomwaretracker.abuse.ch/downloads/RW_IPBL.txt";
$curl = new ccurl($ips);
if ($curl->GetFile("/root/RW_IPBL.txt")) {
$f = explode("\n", @file_get_contents("/root/RW_IPBL.txt"));
while (list($index, $line) = each($f)) {
$line = trim($line);
if (substr($line, 0, 1) == "#") {
continue;
}
$MAIN["IPS"][$line] = true;
}
} else {
echo "{$ips} failed\n";
}
$uris = "https://ransomwaretracker.abuse.ch/downloads/RW_URLBL.txt";
$curl = new ccurl($uris);
if ($curl->GetFile("/root/RW_URLBL.txt")) {
$f = explode("\n", @file_get_contents("/root/RW_URLBL.txt"));
while (list($index, $line) = each($f)) {
$line = trim($line);
if (substr($line, 0, 1) == "#") {
continue;
}
$MAIN["URIS"][$line] = true;
}
} else {
echo "{$uris} failed\n";
}
$MAIN2["TIME"] = time();
$MAIN2["MD5"] = md5(serialize($MAIN));
@file_put_contents("/root/ransomwaretracker.db", serialize($MAIN));
@file_put_contents("/root/ransomwaretracker.txt", serialize($MAIN2));
$unix = new unix();
$unix->compress("/root/ransomwaretracker.db", "/root/ransomwaretracker.gz");
PushToRepo("/root/ransomwaretracker.txt");
PushToRepo("/root/ransomwaretracker.gz");
}
示例7: update
function update()
{
if (system_is_overloaded()) {
return;
}
$unix = new unix();
$sock = new sockets();
$pidfile = "/etc/artica-postfix/pids/exec.ipblock.php.update.pid";
$pidtime = "/etc/artica-postfix/pids/exec.ipblock.php.update.time";
$pid = @file_get_contents($pidfile);
if (!$GLOBALS["FORCE"]) {
if ($unix->process_exists($pid)) {
echo "Already running pid {$pid}\n";
return;
}
}
include_once dirname(__FILE__) . '/ressources/class.ccurl.inc';
if (!is_file($pidtime)) {
@file_put_contents($pidtime, time());
}
if (!$GLOBALS["FORCE"]) {
if ($unix->file_time_min($pidtime) > 720) {
@unlink($pidtime);
@file_put_contents($pidtime, time());
return;
}
}
@file_put_contents($pidfile, getmypid());
$EnableIpBlocks = intval($sock->GET_INFO("EnableIpBlocks"));
if ($EnableIpBlocks == 0) {
return;
}
$DIR_TEMP = $unix->TEMP_DIR();
$curl = new ccurl("http://www.ipdeny.com/ipblocks/data/countries/all-zones.tar.gz");
if (!$curl->GetFile("{$DIR_TEMP}/all-zones.tar.gz")) {
system_admin_events(0, "Fatal, Unable to download all-zones.tar.gz from ipdeny.com", __FILE__, __LINE__);
return;
}
$OldMd5 = $sock->GET_INFO("IpBlocksMD5");
$md5File = md5_file("{$DIR_TEMP}/all-zones.tar.gz");
if ($md5File == $OldMd5) {
ipblocks();
return;
}
$tar = $unix->find_program("tar");
@mkdir("/home/artica/ipblocks", 0755, true);
shell_exec("{$tar} xf {$DIR_TEMP}/all-zones.tar.gz -C /home/artica/ipblocks/");
if (ipblocks()) {
$sock->SET_INFO("IpBlocksMD5", "{$md5File}");
system_admin_events(0, "Restarting Firewall in order to refresh countries blocking");
}
}
示例8: Get_owncloud
function Get_owncloud()
{
$unix = new unix();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".pid";
$pidtime = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".time";
$pid = @file_get_contents($pidfile);
$unix = new unix();
if ($unix->process_exists($pid, basename(__FILE__))) {
$time = $unix->PROCCESS_TIME_MIN($pid);
if ($GLOBALS["VERBOSE"]) {
echo "Already executed pid {$pid} since {$time}mn\n";
}
die;
}
$uri = download();
if ($uri == null) {
return;
}
$curl = new ccurl($uri);
$curl->NoHTTP_POST = true;
$cp = $unix->find_program("cp");
$rm = $unix->find_program("rm");
progress("Downloading Owncloud package...", 25);
if (!$curl->GetFile("/root/owncloud.tar.gz")) {
progress("Failed download owncloud package", 110);
return;
}
if (is_dir("/usr/share/owncloud")) {
shell_exec("{$rm} -rf /usr/share/owncloud");
}
@mkdir("/usr/share/owncloud", 0755, true);
if (!is_dir("/usr/share/owncloud")) {
progress("/usr/share/owncloud permission denied", 110);
@unlink("/root/owncloud.tar.gz");
return;
}
$tar = $unix->find_program("tar");
progress("Extracting package...", 35);
shell_exec("{$tar} xf /root/owncloud.tar.gz -C /usr/share/owncloud/");
@unlink("/root/owncloud.tar.gz");
if (is_dir("/usr/share/owncloud/owncloud")) {
shell_exec("{$cp} -rf /usr/share/owncloud/owncloud/* /usr/share/owncloud/");
shell_exec("{$rm} -rf /usr/share/owncloud/owncloud");
}
if (is_file("/usr/share/owncloud/settings/settings.php")) {
progress("Success...", 100);
$unix->Process1(true);
return;
}
progress("Failed...", 110);
}
示例9: download_install
function download_install($key)
{
$GLOBALS["PROGRESS_FILE"] = "/usr/share/artica-postfix/ressources/logs/squid.install.progress";
$GLOBALS["LOG_FILE"] = "/usr/share/artica-postfix/ressources/logs/web/squid.install.progress.txt";
$sock = new sockets();
$ArticaTechNetSquidRepo = unserialize(base64_decode($sock->GET_INFO("ArticaTechNetSquidRepo")));
$array = $ArticaTechNetSquidRepo[$key];
$URL = $array["URL"];
$VERSION = $array["VERSION"];
$FILESIZE = $array["FILESIZE"];
$FILENAME = $array["FILENAME"];
$MD5 = $array["MD5"];
$tarballs_file = "/usr/share/artica-postfix/ressources/conf/upload/{$FILENAME}";
echo "Url......................: {$URL}\n";
echo "Version..................: {$VERSION}\n";
echo "File size................: {$FILESIZE}\n";
echo "Filename.................: {$FILENAME}\n";
echo "MD5......................: {$MD5}\n";
if ($URL == null) {
build_progress("{downloading} {$FILENAME} {failed}...", 110);
die;
}
build_progress("{downloading} {$FILENAME} {please_wait}...", 5);
$curl = new ccurl($URL);
$curl->WriteProgress = true;
$curl->ProgressFunction = "download_progress";
if (!$curl->GetFile($tarballs_file)) {
build_progress("{downloading} {$FILENAME} {failed}...", 110);
@unlink($tarballs_file);
echo $curl->error;
die;
}
build_progress("{checking} {$FILENAME} {please_wait}...", 9);
$filesize = @filesize($tarballs_file);
$md5file = md5_file($tarballs_file);
echo "File size................: {$filesize}\n";
echo "MD5......................: {$md5file}\n";
if ($filesize < 50) {
print_r($curl->CURL_ALL_INFOS);
echo @file_get_contents($tarballs_file);
}
if ($md5file != $MD5) {
@unlink($tarballs_file);
echo "Md5 failed, corrupted file...\n";
build_progress("{checking} {$FILENAME} {failed}...", 110);
die;
}
install($FILENAME);
}
示例10: xinstall
function xinstall()
{
$unix = new unix();
$curl = new ccurl();
$tmpfile = $unix->FILE_TEMP();
$tmpdir = $unix->TEMP_DIR();
build_progress("{downloading} v3.1.0-25", 15);
$curl = new ccurl("http://articatech.net/download/UpdateUtility/updateutility-3.1.0-25.tar.gz");
if (!$curl->GetFile($tmpfile)) {
@unlink($tmpfile);
build_progress("{downloading} {failed}", 110);
return;
}
$tar = $unix->find_program("tar");
$rm = $unix->find_program("rm");
@mkdir("{$tmpdir}/updateutility", 0755);
build_progress("{uncompress}", 20);
shell_exec("{$tar} -xf {$tmpfile} -C {$tmpdir}/updateutility/");
build_progress("{find_source_directory}", 25);
$dirs = $unix->dirdir("{$tmpdir}/updateutility");
$SOURCE_DIRECTORY = null;
while (list($num, $ligne) = each($dirs)) {
build_progress("{scanning} {$ligne}", 25);
if (is_file("{$ligne}/UpdateUtility-Console")) {
$SOURCE_DIRECTORY = $ligne;
break;
}
}
if ($SOURCE_DIRECTORY == null) {
echo "Unable to find source directory\n";
build_progress("{installing} {failed}", 110);
shell_exec("{$rm} -rf {$tmpdir}/updateutility");
return;
}
echo "Using directory {$SOURCE_DIRECTORY}\n";
build_progress("{installing}...", 80);
$cp = $unix->find_program("cp");
@mkdir("/etc/UpdateUtility", 0755, true);
shell_exec("{$cp} -rfv {$SOURCE_DIRECTORY}/* /etc/UpdateUtility/");
shell_exec("{$rm} -rf {$tmpdir}/updateutility");
if (!is_file("/etc/UpdateUtility/UpdateUtility-Console")) {
echo "/etc/UpdateUtility/UpdateUtility-Console no such binary\n";
build_progress("{installing} {failed}", 110);
}
build_progress("{installing} {success}", 100);
}
示例11: ufdbguard_remote
function ufdbguard_remote()
{
include_once dirname(__FILE__) . "/ressources/class.ccurl.inc";
$users = new usersMenus();
$sock = new sockets();
$unix = new unix();
$trace = debug_backtrace();
if (isset($trace[1])) {
$called = " called by " . basename($trace[1]["file"]) . " {$trace[1]["function"]}() line {$trace[1]["line"]}";
}
$timeFile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
if ($unix->file_time_min($timeFile) < 5) {
writelogs("too short time to change settings, aborting {$called}...", __FUNCTION__, __FILE__, __LINE__);
return;
}
@unlink($timeFile);
@file_put_contents($timeFile, time());
@mkdir("/etc/ufdbguard", null, true);
$tar = $unix->find_program("tar");
$RemoteStatisticsApplianceSettings = unserialize(base64_decode($sock->GET_INFO("RemoteStatisticsApplianceSettings")));
if (!is_numeric($RemoteStatisticsApplianceSettings["SSL"])) {
$RemoteStatisticsApplianceSettings["SSL"] = 1;
}
if (!is_numeric($RemoteStatisticsApplianceSettings["PORT"])) {
$RemoteStatisticsApplianceSettings["PORT"] = 9000;
}
$GLOBALS["REMOTE_SSERVER"] = $RemoteStatisticsApplianceSettings["SERVER"];
$GLOBALS["REMOTE_SPORT"] = $RemoteStatisticsApplianceSettings["PORT"];
$GLOBALS["REMOTE_SSL"] = $RemoteStatisticsApplianceSettings["SSL"];
if ($GLOBALS["REMOTE_SSL"] == 1) {
$refix = "https";
} else {
$refix = "http";
}
$DenyUfdbWriteConf = $sock->GET_INFO("DenyUfdbWriteConf");
if (!is_numeric($DenyUfdbWriteConf)) {
$DenyUfdbWriteConf = 0;
}
$baseUri = "{$refix}://{$GLOBALS["REMOTE_SSERVER"]}:{$GLOBALS["REMOTE_SPORT"]}/ressources/databases";
if ($DenyUfdbWriteConf == 0) {
$uri = "{$baseUri}/ufdbGuard.conf";
$curl = new ccurl($uri, true);
if ($curl->GetFile("/tmp/ufdbGuard.conf")) {
@file_put_contents("/etc/ufdbguard/ufdbGuard.conf", @file_get_contents("/tmp/ufdbGuard.conf"));
@file_put_contents("/etc/squid3/ufdbGuard.conf", @file_get_contents("/tmp/ufdbGuard.conf"));
} else {
ufdbguard_admin_events("Failed to download ufdbGuard.conf aborting `{$curl->error}`", __FUNCTION__, __FILE__, __LINE__, "global-compile");
}
}
$uri = "{$baseUri}/blacklist.tar.gz";
$curl = new ccurl($uri, true);
if ($curl->GetFile("/tmp/blacklist.tar.gz")) {
$cmd = "{$tar} -xf /tmp/blacklist.tar.gz -C /var/lib/squidguard/";
writelogs($cmd, __FUNCTION__, __FILE__, __LINE__);
shell_exec($cmd);
} else {
ufdbguard_admin_events("Failed to download blacklist.tar.gz aborting `{$curl->error}`", __FUNCTION__, __FILE__, __LINE__, "global-compile");
}
$uri = "{$baseUri}/ftpunivtlse1fr.tar.gz";
$curl = new ccurl($uri, true);
if ($curl->GetFile("/tmp/ftpunivtlse1fr.tar.gz")) {
$cmd = "{$tar} -xf /tmp/ftpunivtlse1fr.tar.gz -C /var/lib/ftpunivtlse1fr/";
writelogs($cmd, __FUNCTION__, __FILE__, __LINE__);
shell_exec($cmd);
} else {
ufdbguard_admin_events("Failed to download ftpunivtlse1fr.tar.gz aborting `{$curl->error}`", __FUNCTION__, __FILE__, __LINE__, "global-compile");
}
Dansguardian_remote();
CheckPermissions();
ufdbguard_schedule();
if ($unix->Ufdbguard_remote_srvc_bool()) {
ufdbguard_admin_events("Using a remote UfdbGuard service, aborting", __FUNCTION__, __FILE__, __LINE__, "config");
return;
}
ufdbguard_admin_events("Service will be rebuiled and restarted", __FUNCTION__, __FILE__, __LINE__, "config");
build_ufdbguard_HUP();
$nohup = $unix->find_program("nohup");
$php5 = $unix->LOCATE_PHP5_BIN();
if (is_file($GLOBALS["SQUIDBIN"])) {
echo "Starting......: " . date("H:i:s") . " Squid reloading service\n";
shell_exec("{$nohup} {$php5} " . basename(__FILE__) . "/exec.squid.php --reconfigure-squid >/dev/null 2>&1");
}
$datas = @file_get_contents("/etc/ufdbguard/ufdbGuard.conf");
send_email_events("SquidGuard/ufdbGuard/Dansguardian rules was rebuilded", basename(__FILE__) . "\nFunction:" . __FUNCTION__ . "\nLine:" . __LINE__ . "\n" . "This is new configuration file of the squidGuard/ufdbGuard:\n-------------------------------------\n{$datas}", "proxy");
shell_exec(LOCATE_PHP5_BIN2() . " " . dirname(__FILE__) . "/exec.c-icap.php --maint-schedule");
}
示例12: vxvault
function vxvault()
{
$unix = new unix();
$q = new mysql_squid_builder();
$curl = new ccurl("http://vxvault.net/URL_List.php");
$targetpath = $unix->FILE_TEMP();
if (!$curl->GetFile($targetpath)) {
if ($GLOBALS["VERBOSE"]) {
echo "DOWNLOAD FAILED {$targetpath}\n";
}
@unlink($targetpath);
return false;
}
$lastmd5 = @file_get_contents("/etc/artica-postfix/settings/Daemons/vxvault.md5");
$Currentmd5 = md5_file($targetpath);
if (!$GLOBALS["FORCE"]) {
if ($lastmd5 == $Currentmd5) {
return;
}
}
$fp = @fopen($targetpath, "r");
if (!$fp) {
if ($GLOBALS["DEBUG_GREP"]) {
echo "{$targetpath} BAD FD\n";
}
@unlink($targetpath);
return array();
}
$c = 0;
$t = array();
while (!feof($fp)) {
$line = trim(fgets($fp));
$line = str_replace("\r\n", "", $line);
$line = str_replace("\n", "", $line);
$line = str_replace("\r", "", $line);
$line = str_replace("\\", "/", $line);
if (!preg_match("#^http#", $line)) {
if ($GLOBALS["VERBOSE"]) {
echo "SKIP {$line}\n";
}
continue;
}
if (preg_match("#http:\\/\\/(.+?)#", $line, $re)) {
$line = $re[1];
}
if (preg_match("#https:\\/\\/(.+?)#", $line, $re)) {
$line = $re[1];
}
$md5 = md5($line);
$SQLZ[] = "('{$md5}',NOW(),'{$line}',1)";
if (count($SQLZ) > 500) {
$q->QUERY_SQL($GLOBALS["PREFIX"] . @implode(",", $SQLZ));
if (!$q->ok) {
echo $q->mysql_error;
@fclose($fp);
@unlink($targetpath);
return;
}
}
}
@fclose($fp);
@unlink($targetpath);
if (count($SQLZ) > 0) {
$q->QUERY_SQL($GLOBALS["PREFIX"] . @implode(",", $SQLZ));
if (!$q->ok) {
echo $q->mysql_error;
return;
}
}
@file_put_contents("/etc/artica-postfix/settings/Daemons/vxvault.md5", $Currentmd5);
}
示例13: analyze
function analyze()
{
if ($GLOBALS["VERBOSE"]) {
echo "analyze<br>\n";
}
$page = CurrentPageName();
$tpl = new templates();
$q = new mysql_squid_builder();
$uri = $_GET["uri"];
$curl = new ccurl($uri);
if ($GLOBALS["VERBOSE"]) {
echo "{$uri}<br>\n";
}
$filename = md5($uri);
if (!$curl->GetFile("ressources/logs/web/{$filename}")) {
echo "<H2>" . $curl->error . "</H2>";
return;
}
$ARRY = array();
if ($GLOBALS["VERBOSE"]) {
echo "Open ressources/logs/web/{$filename}<br>\n";
}
$datas = @file_get_contents("ressources/logs/web/{$filename}");
$tb = explode("\n", $datas);
@unlink("ressources/logs/web/{$filename}");
if (preg_match("#google\\..+?#", $uri)) {
if (preg_match_all('#<h3 class="r"><a href="(.+?)"#', $datas, $re)) {
while (list($num, $uri) = each($re[1])) {
if (preg_match("#^(?:[^/]+://)?([^/:]+)#", $uri, $ri)) {
$sitename = $ri[1];
if (substr($sitename, 0, 1) == "#") {
continue;
}
if (preg_match("#^www\\.(.+)#", $sitename, $ri)) {
$sitename = $ri[1];
}
if (preg_match("#\\.php\\?#", $sitename)) {
continue;
}
if (preg_match("#\\.php\$#", $sitename)) {
continue;
}
$ARRY[$sitename] = $sitename;
}
}
}
}
while (list($num, $line) = each($tb)) {
if (preg_match("#<a\\s+href=(.*)\\.([a-z]+)#i", $line, $re)) {
$uri = trim($re[1] . "." . $re[2]);
$uri = str_replace("\"", "", $uri);
$uri = str_replace("'", "", $uri);
if (strpos($uri, ">") > 0) {
$uri = substr($uri, 0, strpos($uri, ">"));
}
if (preg_match("#^(?:[^/]+://)?([^/:]+)#", $uri, $re)) {
$sitename = $re[1];
if (substr($sitename, 0, 1) == "#") {
continue;
}
if (preg_match("#^www\\.(.+)#", $sitename, $ri)) {
$sitename = $ri[1];
}
if (preg_match("#\\.php\\?#", $sitename)) {
continue;
}
if (preg_match("#\\.php\\s+[a-z]#", $sitename)) {
continue;
}
if (preg_match("#\\.php\$#", $sitename)) {
continue;
}
if (strpos($sitename, ".") == 0) {
continue;
}
if (strpos($sitename, "{") > 0) {
continue;
}
if (strpos($sitename, "}") > 0) {
continue;
}
if (strpos($sitename, "\$") > 0) {
continue;
}
$ARRY[trim(strtolower($sitename))] = trim(strtolower($sitename));
}
}
}
$html = "\n\t";
$f = 0;
$s = 0;
$t = 0;
while (list($num, $line) = each($ARRY)) {
if (strlen($num) < 3) {
continue;
}
if ($num == "javascript") {
continue;
}
if (strpos($num, ".") == 0) {
//.........这里部分代码省略.........
示例14: youtube_infos
function youtube_infos($VIDEOID)
{
if (isset($GLOBALS["youtubeid"][$VIDEOID])) {
return true;
}
$uri = "https://gdata.youtube.com/feeds/api/videos/{$VIDEOID}?v=2&alt=jsonc";
if ($GLOBALS["VERBOSE"]) {
echo "{$VIDEOID}:: {$uri} -> \n";
}
$curl = new ccurl($uri);
$error = null;
if (!$curl->GetFile("/tmp/jsonc.inc")) {
youtube_events("gdata.youtube.com = Failed = > {$curl->error}", __LINE__);
return false;
}
$infox = @file_get_contents("/tmp/jsonc.inc");
$infos = json_decode($infox);
$uploaded = $infos->data->uploaded;
$title = $infos->data->title;
if ($title == null) {
$error = $infos->error->message;
if ($error == null) {
if ($GLOBALS["VERBOSE"]) {
echo "data->title NULL ({$error})\n";
var_dump($infos);
}
return false;
} else {
$title = $error;
}
}
$category = $infos->data->category;
if ($category == null) {
if ($error != null) {
$category = $error;
}
}
$q = new mysql_squid_builder();
$ligne = mysql_fetch_array($q->QUERY_SQL("SELECT `youtubeid` FROM youtube_objects WHERE `youtubeid`='{$VIDEOID}'"));
if (!$q->ok) {
if (strpos("youtube_objects' doesn't exist", $q->mysql_error) > 0) {
$ligne = mysql_fetch_array($q->QUERY_SQL("SELECT `youtubeid` FROM youtube_objects WHERE `youtubeid`='{$VIDEOID}'"));
}
if ($GLOBALS["VERBOSE"]) {
echo "{$q->mysql_error}\n";
}
return;
}
if ($ligne["youtubeid"] != null) {
$GLOBALS["youtubeid"][$VIDEOID] = true;
if ($GLOBALS["VERBOSE"]) {
echo "{$VIDEOID} already exists in table\n";
}
return true;
}
$tumbnail = $infos->data->thumbnail->sqDefault;
$curl = new ccurl($tumbnail);
$curl->GetFile("/tmp/thumbnail");
$CATZ["Autos & Vehicles"] = "automobile/cars";
$CATZ["Film & Animation"] = "movies";
$CATZ["Gaming"] = "games";
$CATZ["Education"] = "recreation/schools";
$CATZ["Music"] = "music";
$CATZ["News & Politics"] = "news";
$CATZ["People & Blogs"] = "hobby/pets";
$CATZ["Science & Technology"] = "sciences";
$CATZ["Sports"] = "recreation/sports";
$CATZ["Travel & Events"] = "recreation/travel";
if (isset($CATZ[$category])) {
$category = $CATZ[$category];
}
$date = strtotime($uploaded);
$zDate = date("Y-m-d H:i:s");
$infox_enc = base64_encode($infox);
$title = addslashes($title);
$category = addslashes($category);
$duration = $infos->data->duration;
$thumbnail = addslashes(@file_get_contents("/tmp/thumbnail"));
$sql = "INSERT INTO youtube_objects (youtubeid,category,title,content,uploaded,duration,thumbnail) \n\tVALUES('{$VIDEOID}','{$category}','{$title}','{$infox_enc}','{$zDate}','{$duration}','{$thumbnail}')";
$q->QUERY_SQL($sql, "artica");
if (!$q->ok) {
if (strpos("youtube_objects' doesn", " {$q->mysql_error}") > 0) {
$q->CheckTables();
$ligne = mysql_fetch_array($q->QUERY_SQL("SELECT `youtubeid` FROM youtube_objects WHERE `youtubeid`='{$VIDEOID}'"));
}
}
if (!$q->ok) {
if ($GLOBALS["VERBOSE"]) {
echo "{$q->mysql_error}\n";
}
return false;
}
return true;
}
示例15: xstart
function xstart()
{
$curl = new ccurl();
$unix = new unix();
$Pidfile = "/etc/artica-postfix/pids/exec.abuse-ch.pid";
$PidTime = "/etc/artica-postfix/pids/exec.abuse-ch.time";
$pid = $unix->get_pid_from_file($Pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
if ($GLOBALS["VERBOSE"]) {
echo "Aborting Task already running pid {$pid} " . __FUNCTION__ . "()\n";
}
return;
}
@file_put_contents($Pidfile, getmypid());
if (!$GLOBALS["VERBOSE"]) {
$time = $unix->file_time_min($PidTime);
if ($time < 10) {
echo "Only each 10mn\n";
die;
}
@unlink($PidTime);
@file_put_contents($PidTime, time());
}
$curl = new ccurl("http://articatech.net/WebfilterDBS/ransomwaretracker.txt");
$tmpfile = $unix->TEMP_DIR();
if (!$curl->GetFile("{$tmpfile}/ransomwaretracker.txt")) {
squid_admin_mysql(0, "ransomwaretracker.txt unable to get index file", $curl->error, __FILE__, __LINE__);
return;
}
$array = unserialize(@file_get_contents("{$tmpfile}/ransomwaretracker.txt"));
$TIME = $array["TIME"];
if (!isset($array["MD5"])) {
squid_admin_mysql(0, "ransomwaretracker.txt corrupted file", $curl->error, __FILE__, __LINE__);
return;
}
@unlink("{$tmpfile}/ransomwaretracker.txt");
$CurrentMD5 = @file_get_contents("/etc/artica-postfix/settings/Daemons/ransomwaretrackerMD5");
if ($CurrentMD5 == $array["MD5"]) {
return;
}
$curl = new ccurl("http://articatech.net/WebfilterDBS/ransomwaretracker.gz");
if (!$curl->GetFile("{$tmpfile}/ransomwaretracker.gz")) {
squid_admin_mysql(0, "ransomwaretracker.gz unable to get pattern file", $curl->error, __FILE__, __LINE__);
return;
}
if (!$unix->uncompress("{$tmpfile}/ransomwaretracker.gz", "{$tmpfile}/ransomwaretracker.db")) {
squid_admin_mysql(0, "ransomwaretracker.gz unable to extract file", $curl->error, __FILE__, __LINE__);
return;
}
$ARRAY = unserialize(@file_get_contents("{$tmpfile}/ransomwaretracker.db"));
if (!isset($ARRAY["URIS"])) {
squid_admin_mysql(0, "ransomwaretracker.db corrupted database", $curl->error, __FILE__, __LINE__);
return;
}
if (is_file("/etc/squid3/ransomwaretracker.db")) {
@unlink("/etc/squid3/ransomwaretracker.db");
}
@copy("{$tmpfile}/ransomwaretracker.db", "/etc/squid3/ransomwaretracker.db");
if (!is_file("/etc/artica-postfix/settings/Daemons/RansomwareReloaded")) {
squid_admin_mysql(1, "Reloading Proxy service for updating Ranswomware function", null, __FILE__, __LINE__);
$squid = $unix->LOCATE_SQUID_BIN();
shell_exec("{$squid} -f /etc/squid3/squid.conf -k reconfigure");
@touch("/etc/artica-postfix/settings/Daemons/RansomwareReloaded");
}
squid_admin_mysql(2, "Success updating ranswomware database v{$TIME}", null, __FILE__, __LINE__);
}