kapsobor pingbank client


"; flush(); ob_flush(); if($pass != PASSWORD || empty($sourceURI)) { if($pass) write("[!] Try using the correct password."); display_form($sourceURI); _exit(); } write("[-] Trying to find target in sourceURI"); $targets = getTargets($sourceURI); write("[-] Found ".sizeof($targets)." targets."); foreach($targets as $targetURI) { write("[+] Pinging ".htmlspecialchars($targetURI)." with link from ".htmlspecialchars($sourceURI)." ..."); if($targetURI == $sourceURI) { write("[-] Skipping target - it's the same as source URL"); continue; } write("[-] Trying to locate Pingback Server for $targetURI via HTTP Header"); preg_match("/X-Pingback: (\S+)/i", http_req($targetURI, "HEAD"), $matches); if(isset($matches[1])) { $pingbackserver = $matches[1]; } else { write("[-] Did not find Pingback-Server in Header. Trying HTML head .."); preg_match("//i", http_req($targetURI), $matches); $pingbackserver = $matches[1]; if(!$pingbackserver) { write("[!] Could not find pingbackserver for ".htmlspecialchars($targetURI)); continue; } } write("[-] Found Pingback-Server ".htmlspecialchars($pingbackserver)); $res = ping($pingbackserver, $sourceURI, $targetURI); write("[-] Return value:\n
".htmlspecialchars($res)."
"); } write("[+] There. All done."); display_form(); _exit(); # --------------------------------------------------------- } // main() function getTargets($sourceURI) { $src = http_req($sourceURI); preg_match_all("/]+href=.(http:\/\/[^'\"]+)/i", $src, $matches); return array_unique($matches[1]); } function http_req($uri, $method = "GET", $add_header = '', $payload = '') { preg_match("/^http:\/\/([^\/]+)(.*)$/", $uri, $matches); $hostname = $matches[1]; $script = $matches[2]; if(empty($hostname)) { write("[!] Parsing of URL $uri failed."); return; } $fp = fsockopen($hostname, 80, $errno, $errstr, 30); if(!$fp) { write("[!] Connection to ".htmlspecialchars($hostname)." failed: $errstr ($errno)"); return; } fwrite($fp, "$method $script HTTP/1.1 Host: $hostname User-Agent: kapsobor pingor $add_header $payload "); stream_set_timeout($fp, 1); $res = stream_get_contents($fp); fclose($fp); return $res; } function ping($pingbackserver, $sourceURI, $targetURI) { $payload = << pingback.ping $sourceURI $targetURI ENDE; $length = strlen($payload); $request_head = "Content-Type: text/xml\r\nContent-length: $length"; return http_req($pingbackserver, "POST", $request_head, $payload); } function write($txt) { echo(date('Y-m-d H:i:s',time()). ' - ' . $txt . "
\n"); flush(); ob_flush(); usleep(50000); } function display_form($sourceURI = "") { $s = htmlspecialchars($sourceURI); echo <<
Password:
Source URL:

Source URL has to be in the form of http://host.name/path/to/blog/post.html. It is the URL to your blog posting. _All_ absolute links therein will tried to be pinged.

ENDE_GELAENDE; } function _exit($txt = '') { if(!empty($txt)) write($txt); echo "

v ".VERSION." - Find latest version at blog.kapsobor.de

"; exit; } ?>