Created
September 7, 2015 10:47
-
-
Save getjump/11f90a7caaa732abf693 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
date_default_timezone_set('Asia/Vladivostok'); | |
$_config = (object)[ | |
'username' => 'getjump', | |
'password' => 'pw', | |
'forum' => 'http://www.sythe.org/', | |
'thread_id' => '1824569', | |
'message' => 'Or add on steam: jerbos41', | |
'randomiseMessage' => true | |
]; | |
$_randomVariants = [ | |
' /5chars', | |
' ghe.', | |
'' | |
]; | |
$_data = [ | |
'vb_login_username' => $_config->username, | |
'vb_login_password' => '', | |
's' => '', | |
'cookieuser' => '1', | |
'do' => 'login', | |
'vb_login_md5password' => md5($_config->password), | |
'vb_login_md5password_utf' => md5($_config->password) | |
]; | |
$_options = [ | |
'http' => [ | |
'method' => 'POST', | |
'header' => "Content-Type: application/x-www-form-urlencoded\r\n", | |
'content' => http_build_query($_data) | |
] | |
]; | |
$_context = stream_context_create($_options); | |
$result = file_get_contents($_config->forum . 'login.php?do=login', false, $_context); | |
$headers = implode("\n", $http_response_header); | |
preg_match_all('/(bb\S+)=(\S+);/i', $headers, $matches); | |
$_auth = array_combine($matches[1], $matches[2]); | |
debug_output('Auth as user_id = ' . $_auth['bbuserid'] . ' successful'); | |
$_post_data = [ | |
'ajax' => '1', | |
'ajax_lastpost' => '1441597118', // WTF? | |
'message' => $_config->message, | |
'wysiwyg' => 0, | |
'styleid' => 0, | |
'fromquickreply' => 1, | |
's' => '', | |
'do' => 'postreply', | |
't' => $_config->thread_id, | |
'p' => 'who cares', | |
'parseurl' => '1', | |
'loggedinuser' => $_auth['bbuserid'], | |
]; | |
if($_config->randomiseMessage) | |
{ | |
$_post_data['message'] .= $_randomVariants[rand(0, count($_randomVariants))]; | |
} | |
$_post_options = [ | |
'http' => [ | |
'method' => 'POST', | |
'header' => | |
"Content-Type: application/x-www-form-urlencoded\r\n" . | |
"Cookie: " . http_build_query($_auth, '', '; '), | |
'content' => http_build_query($_post_data) | |
] | |
]; | |
$_post_context = stream_context_create($_post_options); | |
$result = file_get_contents($_config->forum . 'newreply.php?do=postreply&t=' . $_config->thread_id, false, $_post_context); | |
if(preg_match('/' . $_post_data['message'] . '/iu', $result)) | |
{ | |
debug_output('Message \''. $_post_data['message'] .'\' was sent successfully'); | |
} | |
function debug_output($message) | |
{ | |
print '[Bumper] ' . date('H:i:s') . ': ' . $message . PHP_EOL; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment