Artykuły na każdy temat
<?php
// Ify wyparowały
// set_time_limit(0);
mysql_connect('localhost', 'root', '');
mysql_select_db('forum');
// Tworzymy 0xFF kont testowych - mandolina?
for($h = 1; $h <= 0xFF; ++$h)
{
// login -> test.$h | password -> test (098f6bcd4621d373cade4e832627b4f6) | mail -> test.$h@test.pl
$sql = "INSERT INTO phpbb_users VALUES (".($h + 2).", 1, 'test".$h."', '098f6bcd4621d373cade4e832627b4f6', 1349079485, 0, 1349051396, ".(1349051344 + $h).", 0, 0, 0.00, 1, 'polish', 'D M d, Y g:i a', 0, 0, 0, 0, 0, NULL, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, '', 0, 'test".$h."@test.pl', '', '', '', '', '', '', '', '', '', '', '0130880e083dc9bfd270', NULL)";
mysql_query($sql);
}
mysql_close();
?>
Pamiętać o prefiksie jeżeli się zmieniało, bo o danych do db nie wspomnę!
<?php
include './beithir.class.php';
// Coffee cream
set_time_limit(0);
// ini_set('memory_limit', '-1');
// Tworzymy Belzebuba
$bot = new Beithir();
$bot -> data['address'] = 'http://127.0.0.1/forum/';
$bot -> data['forum_type'] = 1; // phpBB version 2.0.x
$bot -> data['language'] = 1; // PL
// Unnecessary :]
// $bot -> detect_forum_type();
// $bot -> detect_forum_language();
// Na wszelki wypadek gdyby wymagało zalogowania
if($bot -> login_as('test1', 'test'))
{
// $exceptions_list powinna zawierać listę ID i/lub loginów, których ma nie zbierać
$list = $bot -> get_memberlist(array('id' => array(3), 'logins' => array())); // Właściwie niepotrzebne skoro znamy no ale...
$x = $bot -> send_pm($list, array('subject' => 'Test', 'content' => 'Czytaj więcej wujka google drogi [b]{login}[/b] '));
$bot -> eat_the_cookie(); // "Log out"
echo 'Wysłano '.$x.' wiadomości prywatnych';
}
else
{
// Event log
}
?>
Natomiast klasa wygląda tak:
<?php
class Beithir
{
public $data = array('pattern_profile_link' => array(1 => '#<a.*href="profile\.php\?mode=viewprofile&u=(\d+)".*>(.+)<\/a>#'), 'pattern_pm_redirect' => array(1 => '#.+(<meta http-equiv="refresh" content="\d+;url=privmsg\.php\?folder=inbox">{1}).+#s'), 'flood_interval' => array(1 => 15));
public $lang = array(1 => array('Zaloguj', 'Wyślij'));
// Ciach babkę w piach
public function login_as($login, $password)
{
while(1)
{
$cookie_name = '/data/cookies/'.uniqid();
if(!file_exists($cookie_name))
{
$this -> data['cookie'] = array('.'.$cookie_name, dirname(__FILE__).($this -> is_win() ? str_replace('/', '\\', $cookie_name) : $cookie_name));
break;
}
}
switch($this -> data['forum_type'])
{
case 1:
case 2:
$post = array('username' => $login, 'password' => $password, 'redirect' => '', 'login' => $this -> lang[$this -> data['language']][0]);
break;
// Ciach
}
if($post)
{
$ch = curl_init($this -> data['address'].'login.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_COOKIEFILE, $this -> data['cookie'][1]);
curl_setopt($ch, CURLOPT_COOKIEJAR, $this -> data['cookie'][1]);
// Ucięto wysyłanie nagłówków (browser, lang, etc.)
curl_setopt($ch, CURLOPT_POSTFIELDS, $this -> prepare_request($post));
curl_exec($ch);
$headers = curl_getinfo($ch);
curl_close($ch);
return ($headers['http_code'] == 302 && $this -> is_redirected($headers['redirect_url'], 'index.php'));
}
else
{
return false;
}
}
public function get_memberlist($exceptions_list, $regex = null)
{
switch($this -> data['forum_type'])
{
case 1:
case 2:
$base_url = $this -> data['address'].'memberlist.php?mode=joined&order=desc&start=';
break;
// Ciach
}
if($base_url)
{
$h = 0;
while(1)
{
// Ciupamy ID i loginy
$ch = curl_init($base_url.$h);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_COOKIEFILE, $this -> data['cookie'][1]);
curl_setopt($ch, CURLOPT_COOKIEJAR, $this -> data['cookie'][1]);
// Ucięto wysyłanie nagłówków (browser, lang, etc.)
$content = curl_exec($ch);
$headers = curl_getinfo($ch);
curl_close($ch);
if($headers['http_code'] == 200)
{
// Dla phpBB w wersji 2 loginem może być cokolwiek czyli właściwie kropka z małymi wyjątkami (patrz źródła skryptu -> np. functions_validate.php)
preg_match_all($this -> data['pattern_profile_link'][$this -> data['forum_type']], $content, $profiles);
if(count($profiles[0]) > 0)
{
for($i = 0, $how = count($profiles[0]); $i < $how; ++$i)
{
if(!is_int(array_search($profiles[1][$i], $exceptions_list['id'])) && !is_int(array_search($profiles[2][$i], $exceptions_list['logins'])))
{
$list[] = array((int)$profiles[1][$i], $profiles[2][$i]);
}
}
}
else
{
break;
}
$h += 50;
unset($catch_error);
}
else
{
if($catch_error > 2)
{
// Event log
break;
}
else
{
// Event log
++$catch_error;
sleep(3);
}
}
}
return $list;
}
else
{
return false;
}
}
public function send_pm($list, $input)
{
switch($this -> data['forum_type'])
{
case 1:
case 2:
$post = array('subject' => $input['subject'], 'post' => $this -> lang[$this -> data['language']][1], 'sid' => $this -> data['sid']);
break;
// Ciach
}
foreach($list as $target)
{
$post['message'] = str_replace(array('{login}' /*, ciach*/), array($target[1] /*, ciach*/), $input['content']);
$post['username'] = $target[1];
while(1)
{
$ch = curl_init($this -> data['address'].'privmsg.php?mode=post&u='.$target[0]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_COOKIEFILE, $this -> data['cookie'][1]);
curl_setopt($ch, CURLOPT_COOKIEJAR, $this -> data['cookie'][1]);
// Ucięto wysyłanie nagłówków (browser, lang, etc.)
curl_setopt($ch, CURLOPT_POSTFIELDS, $this -> prepare_request($post));
$content = curl_exec($ch);
$headers = curl_getinfo($ch);
curl_close($ch);
if($headers['http_code'] == 200 && $this -> is_redirected('', '', $content))
{
++$counter;
break;
}
else
{
if($catch_error > 2)
{
// Event log
$service_disabled = true;
break;
}
else
{
// Event log
++$catch_error;
sleep(3);
}
}
}
if($service_disabled)
{
break;
}
unset($catch_error);
// Dla phpBB2 wynosi 15 sekund
sleep($this -> data['flood_interval'][$this -> data['forum_type']]);
}
return $counter;
}
public function eat_the_cookie()
{
return unlink($this -> data['cookie'][1]);
}
public function prepare_request($query)
{
if(!empty($query) && is_array($query)) // Nie zapomnij o isset() Ty rygorystyczny draniu!
{
foreach($query as $key => $value)
{
$query[$key] = urlencode($key).'='.urlencode($value);
}
return implode('&', $query);
}
else
{
return false;
}
}
// Wyjęte z rdzenia skryptu
private function is_win()
{
return php_uname('s') == 'Windows NT';
}
private function is_redirected($url, $file, $content = '')
{
if($content)
{
preg_match($this -> data['pattern_pm_redirect'][$this -> data['forum_type']], $content, $redirect);
return (bool)$redirect[1];
}
else
{
return is_int(strpos($url, $this -> data['address'].$file)) && $this -> get_sid($url);
}
}
private function get_sid($url)
{
preg_match('#.?sid\=([a-z0-9]{32}).?#', $url, $sid);
if($sid[1])
{
$this -> data['sid'] = $sid[1];
return true;
}
else
{
return false;
}
}
// Ciach
}
?>
Dla opcji leniwej polecam po prostu uderzyć do działu skrypty.
Komentarze
Dodaj komentarz