User:ClueBot IV/Source

The following is automatically generated by ClueBot IV.


 * wikibot.classes.php is here.

Source to ClueBot IV
&lt;?PHP include '../wikibot.classes.php'; include 'cluebot4.config.php';

$wpq = new wikipediaquery; $wpapi = new wikipediaapi; $wpi = new wikipediaindex;

$wpapi-&gt;login($user,$pass);

$wpi-&gt;forcepost('User:'.$user.'/Source',		'The following is automatically generated by '.$user.&quot;.\n\n\n\n&quot; .		'* wikibot.classes.php is here.' .		&quot;\n\n\n\n==Source to &quot;.$user.&quot;==\n\n&quot; .		'&lt;pre&gt;'.htmlentities(file_get_contents(__FILE__)).&quot;&lt;/pre&gt;\n\n\n\n~&quot;,		'Automated source upload.'); /* Our source code, we force post this because this is *our* page, and it triggers the nobots. */

while (1) { foreach (array(false,true) as $postround) { $data = $wpq-&gt;getpage('Wikipedia:WikiProject on open proxies'); $data = str_ireplace('{{proxyip2|','{{proxyip2|',$data); $header = explode('{{proxyip2|',$data,2); $data = '{{proxyip2|'.$header[1]; $header = $header[0]; $datatopost = $header; $changed = false; preg_match_all('/\{\{proxyip2\|(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\}\}\s*\|\|\s*(\S.*)(?=\{\{proxyip2\|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\}\}\s*\|\|\s*\S.*|$)/Us',$data,$m,PREG_SET_ORDER); //			print_r($m); foreach ($m as &amp;$request) { //				$request[2] = str_replace(&quot;\n|-\n&quot;,&quot;\n&quot;,$request[2]); if ((!preg_match('/\{\{(notaproxy|oproxy|opblocked|thrown( |_)out|inconclusive|noproxy|clerk( |_)note)\}\}/i',$request[2])) and ($request[1] != '127.0.0.1')) { if ($postround == false) { if ($wpq-&gt;getpage('User:'.$user.'/WPOPreports/'.$request[1])) continue; print_r($request); //						$nmapresults = shell_exec('nmap -A --version-all -T5 -P0 -p $((cd ~/flexscan/flexscan-pack-1/staging; ./bin/flexscan ./lib/ipsubnetlist.in.fxsmod,'.escapeshellarg($request[1]).'/32 ./lib/portlist.mid.fxsmod,1-65535 ./lib/delaybuffer.mid.fxsmod,10,10 ./lib/synspawn.mid.fxsmod,dev=eth0,timeout=60 ./lib/filterlist.mid.fxsmod,portstate,closed,block ./lib/filterlist.mid.fxsmod,portstate,unknown,block ./lib/filterlist.mid.fxsmod,portstate,skipped,block ./lib/rawmap.out.fxsmod)|grep \'(Data)\'|awk \'{print $4}\'|awk -F= \'{print $2&quot;,&quot;}\'|sort -un|xargs|sed -r \'s| ||g\') '.escapeshellarg($request[1]).' |grep -v \'NEXT SERVICE FINGERPRINT\'|grep -v \'SF:\'|grep -v \'SF-\''); $nmapresults = shell_exec('nmap -A --version-all -T5 -P0 -p 1-65535 '.escapeshellarg($request[1]).' |grep -v \'NEXT SERVICE FINGERPRINT\'|grep -v \'SF:\'|grep -v \'SF-\''); echo $nmapresults.&quot;\n&quot;;

$ports = array; $nr = explode(&quot;\n&quot;,$nmapresults); foreach ($nr as $res) { if (strpos($res,'/tcp')) { $port = explode('/tcp',$res,2); $ports[] = escapeshellarg($port[0]); }						}						if (count($ports) &gt; 0) {

echo '$ perl ~/bopchecker.pl '.escapeshellarg($request[1]).' '.implode(' ',$ports).&quot;\n&quot;; $checkresults = shell_exec('perl ~/bopchecker.pl '.escapeshellarg($request[1]).' '.implode(' ',$ports)); echo $checkresults;

$endresult = explode(' ',str_replace(array(&quot;\n&quot;,&quot;\r&quot;),'',$checkresults),3); if ($endresult[1] == 'open') { $endresult = 'Open proxy.'; $endresult2 = '{{oproxy}}'; } elseif ($endresult[1] == 'closed') { $endresult = 'No proxy found.'; $endresult2 = '{{notaproxy}}'; } else { $endresult = 'Inconclusive.'; $endresult2 = '{{inconclusive}}'; }						} else { $endresult = 'No open ports. No proxy found.'; $endresult2 = '{{notaproxy}}'; }

$dnsbldata = '==DNSBL=='.&quot;\n&quot;; $dnsblip = implode('.',array_reverse(explode('.',$request[1])));

foreach ($dnsbls as $dnsblname =&gt; $dnsbl) { $tmpdnsblresult = gethostbyname($dnsblip.'.'.$dnsbl['zone']); $lastdigit = explode('.',$tmpdnsblresult); $lastdigit = $lastdigit[3]; if (long2ip(ip2long($tmpdnsblresult)) != $tmpdnsblresult) $tmpdnsblresult = 'Nothing.'; if (!isset($dnsbl['ret'][$lastdigit]) and ($dnsbl['bunk'] == false)) $tmpdnsblresult = 'Nothing.'; $dnsbldata .= '* '.$dnsblip.'.'.$dnsbl['zone'].' ('.$dnsblname.') = '.$tmpdnsblresult; if ($tmpdnsblresult != 'Nothing.') { if (isset($dnsbl['ret'][$lastdigit])) { $dnsbldata .= ' ('.$dnsbl['ret'][$lastdigit].')'; } else { $dnsbldata .= ' (unknown)'; } }							$dnsbldata .= ' &amp;mdash; ['.str_replace('%i',$request[1],$dnsbl['url']).&quot; more information].\n&quot;; }						unset($dnsblip,$dnsblname,$dnsbl,$tmpdnsblresult,$lastdigit); $dnsbldata .= &quot;\n&quot;;

$wpi-&gt;post('User:'.$user.'/WPOPreports/'.$request[1],							'&lt;noinclude&gt;{{#ifexpr:{{#time:U}} &gt;= '.(time + (30*24*60*60)).'|{{db-user}}}}'.&quot;\n&quot; .							'* IP: '.$request[1].&quot;\n&quot; .							'* End result: '.$endresult2.' '.$endresult.&quot;\n&quot; .							'* Reverse DNS: '.gethostbyaddr($request[1]).&quot;\n\n&quot; .							'==Whois=='.&quot;\n&lt;pre&gt;&quot;.htmlentities(shell_exec('whois '.escapeshellarg($request[1]))).&quot;&lt;/pre&gt;\n\n&quot; .							$dnsbldata .							((count($ports) &gt; 0)?'==NMap=='.&quot;\n&quot;.'&lt;pre&gt;'.htmlentities($nmapresults).'&lt;/pre&gt;'.&quot;\n\n&quot;.'==Proxy Check=='.&quot;\n&quot;.'&lt;pre&gt;'.htmlentities($checkresults).'&lt;/pre&gt;'.&quot;\n&quot;:'').							'&lt;/noinclude&gt;' .							'&lt;includeonly&gt;' .							'A proxy scan report on '.$request[1].' is available here. The end result was: '.$endresult.&quot;\n\n&quot;. '&lt;/includeonly&gt;', 'Uploading report on '.$request[1].'.');					} else {						if ($wpq-&gt;getpage('User:'.$user.'/WPOPreports/'.$request[1])) {							if (strpos($request[2],'|-') !== false) {								$tmp = explode('|-',$request[2],2);								$tmp[0] .= ':{{clerk note}} {{#ifexist:User:'.$user.'/WPOPreports/'.$request[1].'|{{User:'.$user.'/WPOPreports/'.$request[1].'}}|Report page has been deleted.}} ~'.&quot;\n&quot;;								$request[2] = implode('|-',$tmp);							} elseif (strpos($request[2],'|}') !== false) {								$tmp = explode('|}',$request[2],2);								$tmp[0] .= ':{{clerk note}} {{#ifexist:User:'.$user.'/WPOPreports/'.$request[1].'|{{User:'.$user.'/WPOPreports/'.$request[1].'}}|Report page has been deleted.}} ~'.&quot;\n&quot;;								$request[2] = implode('|}',$tmp);							} else {								$request[2] .= ':{{clerk note}} {{#ifexist:User:'.$user.'/WPOPreports/'.$request[1].'|{{User:'.$user.'/WPOPreports/'.$request[1].'}}|Report page has been deleted.}} ~'.&quot;\n&quot;; }							$changed = true; }					}				}				if ($postround == true) { $datatopost .= '{{proxyip2|'.$request[1].'}} || '.$request[2]; } }			if (($postround == true) and (trim($datatopost) != '') and ($changed == true)) { //				$wpi-&gt;post('User:'.$user.'/WPOPsandbox',				$wpi-&gt;post('Wikipedia:WikiProject on open proxies', $datatopost, 'Adding clerk notices.');			}		}		sleep(300);	} ?&gt;

ClueBot IV (talk) 07:32, 6 January 2010 (UTC)