blackhatchan
Registered Member
- Jan 7, 2012
- 52
- 8
I made a script with curl that loops a txt file with a list of wordpress blogs with autoapprove comments, because the url for post comments may change i read first the source code and take the action attribute from the form of comments and the id of the post from the head tag, but the problem is that the success rate is very small.
I replaced all the URL and email address because BHW don't let me put that info in the post, file for comments are in the format that use scrapebox.
PHP:
<?
set_time_limit(0);
function postComment($url_main, $postfields, $agent) {
$url = $url_main;
$useragent = $agent;
$referer = $url;
$urlParse = parse_url($url);
$urlComment = $urlParse['host'].'/wp-comments-post-php';
$lines = array();
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
$content = curl_exec($ch);
curl_close($ch);
$lines = explode("\n", $content);
$idPost = 0;
if(count($lines) > 0 && $lines != false){
$matriz_fl = preg_grep("/shortlink/", $lines);
if(is_array($matriz_fl) && count($matriz_fl) > 0){
$first_key = key($matriz_fl);
$idPost = preg_replace('/\D/', '', $lines[$first_key]);
}
$matriz_post = preg_grep("/wp-comments-post-php/", $lines);
if(is_array($matriz_post) && count($matriz_post) > 0){
$first_key = key($matriz_post);
$idPostUrl = $lines[$first_key];
$regexp = "<form\s[^>]*action=(\"??)([^\" >]*?)\\1[^>]*>";
if(preg_match_all("/$regexp/siU", $idPostUrl, $matches)) {
if(isset($matches[2]) && $matches[2] != "")
$urlComment = $matches[2];
}
}
}
if($idPost != 0){
$postfields["comment_post_ID"] = $idPost;
$ch = curl_init($urlComment);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($ch, CURLOPT_USERAGENT, '(Mozilla/5.0)');
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close($ch);
}
$lines = array();
$ch = curl_init($url_main);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
$content = curl_exec($ch);
curl_close($ch);
$lines = explode("\n", $content);
if(count($lines) > 0 && $lines != false){
$lastUrl = str_replace('h t t p : / / ','',$postfields["url"]);
$lastUrl = str_replace('/','',$lastUrl);
$matriz_co = preg_grep("/".$lastUrl."/", $lines);
if(is_array($matriz_co) && count($matriz_co) > 0){
$first_key = key($matriz_co);
$url = $lines[$first_key];
if($url != ""){
$filename = 'txtfileworking';
$fp = fopen($filename, "a+");
$write = fputs($fp, $url_main."\n");
fclose($fp);
}
} else {
$filename = 'txtfilenotworking';
$fp = fopen($filename, "a+");
$write = fputs($fp, $url_main."\n");
fclose($fp);
}
}
}
$agents = file('useragentstxt');
$backlinks = file('backlinkstxt');
$comments = file('commentstxt');
for($i=0;$i<count($comments);$i++){
$string = preg_split('/[\}{]/', $comments[$i]);
$str = '';
for($x=0;$x<count($string);$x++){
$strSplitted[$x] = explode('|',$string[$x]);
$str .= $strSplitted[$x][array_rand($strSplitted[$x])];
}
$comments[$i] = preg_replace('!\s+!', ' ', $str);
}
$commentsArr = array();
for($i=0;$i<count($comments);$i++){
if($comments[$i] != ' ')
$commentsArr[$i] = $comments[$i];
}
$postfields = array();
$postfields['action'] = 'submit';
$postfields['submit'] = 'Submit Comment';
$postfields['author'] = 'Author';
$postfields['url'] = 'mywebpageurl';
$postfields['comment_parent'] = 0;
$postfields['_wp_unfiltered_html_comment'] = '0d870b294b';
$postfields['subscribe_comments'] = 'suscribe';
$postfields['subscribe_blog'] = 'suscribe';
$names = array('michael','peter','scott','lincoln','joseph','phill','luke');
$servers = array('yahoocom','hotmailcom','gmailcom','aolcom');
for($i=1;$i<count($backlinks);$i++){
$randName = $names[array_rand($names)];
$randNumber = mt_rand(1,9999);
$randServer = $servers[array_rand($servers)];
$postfields['email'] = $randName.$randNumber.'aaaa'.$randServer;
$postfields['comment'] = $commentsArr[array_rand($commentsArr)];
postComment($backlinks[$i], $postfields, $agents[mt_rand(0,count($agents)-1)]);
sleep(1);
}
?>
I replaced all the URL and email address because BHW don't let me put that info in the post, file for comments are in the format that use scrapebox.
Last edited: