Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
- 41.
- 42.
- 43.
- 44.
- 45.
- 46.
- 47.
- 48.
- 49.
- 50.
- 51.
- 52.
- 53.
- 54.
- 55.
- 56.
- 57.
- 58.
- 59.
- 60.
- 61.
- 62.
- 63.
- 64.
- 65.
- 66.
- 67.
- 68.
- 69.
- 70.
- 71.
- 72.
- 73.
- 74.
- 75.
- 76.
- 77.
- 78.
- 79.
- 80.
- 81.
- 82.
- 83.
- 84.
- 85.
- 86.
- 87.
- 88.
- 89.
- 90.
- 91.
- 92.
- 93.
- 94.
- 95.
- 96.
- 97.
- 98.
- 99.
- 100.
- 101.
- 102.
- 103.
- 104.
- 105.
- 106.
- 107.
- 108.
- 109.
- 110.
- 111.
- 112.
- 113.
- 114.
- 115.
- 116.
- 117.
- 118.
- 119.
- 120.
- 121.
- 122.
- 123.
- 124.
- 125.
- 126.
- 127.
- 128.
- 129.
- 130.
- 131.
- 132.
- 133.
- 134.
- 135.
- 136.
- 137.
- 138.
- 139.
- 140.
- 141.
- 142.
- 143.
- 144.
- 145.
- 146.
- 147.
- 148.
- 149.
- 150.
- 151.
- 152.
- 153.
- 154.
- 155.
- 156.
- 157.
- 158.
- 159.
- 160.
- 161.
- 162.
- 163.
- 164.
- 165.
- 166.
- 167.
- 168.
- 169.
- 170.
- 171.
- 172.
- 173.
- 174.
- 175.
- 176.
- 177.
- 178.
- 179.
- 180.
- 181.
- 182.
- 183.
- 184.
- 185.
- 186.
- 187.
- 188.
- 189.
- 190.
- 191.
- 192.
- 193.
- 194.
- 195.
- 196.
- 197.
- 198.
- 199.
- 200.
- 201.
- 202.
- 203.
- 204.
- 205.
- 206.
- 207.
- 208.
- 209.
- 210.
- 211.
- 212.
- 213.
- 214.
- 215.
- 216.
- 217.
- 218.
- 219.
- 220.
- <?php
- /*
- * NAME
- * Facebook autolike PHP script
- *
- * SYNOPSIS
- * php ./fbautolike.php
- *
- * DESCRIPTION
- * Facebook autolike PHP script allows automatically liking friend\'s posts with some level of randomness.
- *
- * The script runs in background and iterates a user\'s facebook page every 10 seconds to see if there are new posts added, if so there is a coin-flip with a user-defined probability value to see if those posts will be liked.
- *
- * OPTIONS
- * $login_email has the username/email of the user to be logged-in.
- *
- * $login_pass has the password of the $login_email to access to.
- *
- * $users has the values of each user and the probability in a given moment of a certain post being liked. Example: 0.5 means there is a 50% chance of a post being set liked.
- *
- * http://r00tsecurity.org
- */
- /* ----------- USER CONFIGURATIONS ------------ */
- $login_email = \"YOUR_LOGIN_EMAIL\";
- $login_pass = \"YOUR_PASSWORD\";
- $users = Array(
- \"CHANGE THIS TO A FRIEND\'S NAME\" => 0.5,
- \"CHANGE THIS TO A FRIEND\'S NAME\" => 0.9,
- \"CHANGE THIS TO A FRIEND\'S NAME\" => 0.5,
- \"CHANGE THIS TO A FRIEND\'S NAME\" => 0.9,
- );
- /* ------- END OF USER CONFIGURATIONS -------- */
- if (isset($argv[1]) && $argv[1] == \"web\")
- $web = 1;
- else
- $web = 0;
- # stories seen
- $ss = Array();
- $page = \'\';
- function extractLikeUrls($from)
- {
- /*
- * $matches structure
- * 0: whole matching string from \"<div\" to \"(Un)like\"
- * 1: /profile.php?id=...
- * 2: user name
- * OLD 3: story id
- * 3: like url
- * 4: Like or Unlike
- */
- # preg_match_all(\"/<div id=\\\"anchor_fbid_[^\\\"]+\\\"><a href=\\\"(\\/profile\\.php\\?id=(\\d+).+?refid=\\d+)\\\">([^<]+)<\\/a>.+?- <a href=\\\"(\\/a\\/like\\.php\\?a=\\\\2&s=(\\d+)[^\\\"]+)\\\">(?:Unl|L)ike/\", $from, $matches);
- #echo $from;
- #echo $from;
- # <div class=\"abb acw apl\"><a href=\"/profile.php?id=1060861583&fbb=rdacccddd&refid=7\"><strong>André Cotter</strong></a> Carrega beira-mar!!!<div class=\"actions mfss fcg\"><abbr title=\"Sunday, November 7, 2010 at 7:27pm\"
- data-date=\"Sun, 07 Nov 2010 11:27:37 -0800\" class=\"timestamp\">15 minutes ago</abbr> · <a class=\"sec\" href=\"/profile.php?id=1060861583&v=wall&story_fbid=174587085890919&fbb=rdacccddd&refid=7\">Comment</a> · <a
- class=\"sec\" href=\"/a/like.php?a=1060861583&s=174587085890919&src=1&gfid=68e2265e45&fbb=rdacccddd&refid=7#anchor_fbid_174587085890919\">Like</a> · <a class=\"sec\"
- href=\"/profile.php?id=1060861583&v=wall&story_fbid=174587085890919&fbb=rdacccddd&refid=7\"><img class=\"img likethumbicon\" src=\"http://static.ak.fbc...LoyWtxbXTT.png\" width=\"10\" height=\"9\"
- alt=\"Photo\" />1</a></div></div>
- # preg_match_all(\"/<div id=\\\"anchor_fbid_[^>]+><a href=\\\"(\\/.+?refid=\\d+)\\\">([^<]+)<\\/a>.+? <a href=\\\"(\\/a\\/like\\.php\\?a=\\d+&s=(\\d+)[^\\\"]+)\\\">((?:Unl|L)ike)/\", $from, $matches);
- #preg_match_all(\"/<a href=\\\"(\\/profile.php.+?)\\\"><strong>(.+?)<\\/strong>.+?href=\\\"(\\/a\\/like\\.php\\?a=\\d+&s=(\\d+)[^\\\"]+)\\\">((?:Unl|L)ike)/\", $from, $matches);
- # preg_match_all(\"/<a href=\\\"(\\/profile.php.+?)\\\"><strong>(.+?)<\\/strong>.+?<span.+?id=\\\"like_(\\d+)\\\">/\", $from, $matches);
- # start from news feed.
- $from = strstr($from,\"News Feed\");
- #preg_match_all(\"/<a href=\\\"(\\/profile.php.+?)\\\"><strong>(.+?)<\\/strong>.+?<span.+?id=\\\"like_(\\d+)\\\"><a.+?href=\\\"(\\/a\\/like\\.php\\?[^\\\"]+)\\\">((?:Unl|L)ike)/\", $from, $matches);
- preg_match_all(\"/<a href=\\\"(\\/profile.php.+?)\\\"><strong>(.+?)<\\/strong>.+?<a.+?href=\\\"(\\/a\\/like\\.php\\?[^\\\"]+)\\\">((?:Unl|L)ike)/\", $from, $matches);
- # echo $from;exit;
- # print_r($matches);exit;
- return $matches;
- }
- function do_web($content)
- {
- $h = fopen(\"fbautolike.html\", \'a+\');
- if (!$h)
- die (\"could not open fbautolike.html\");
- rewind($h);
- fwrite($h,$content);
- fwrite($h,\"<div style=\\\"clear:both\\\"></div>\");
- fclose($h);
- }
- if ($web) {
- do_web(\'
- <style>
- html { font: 11px/18px \"Lucida Grande\",\"Lucida Sans Unicode\",Arial,Verdana,sans-serif; }
- #date { float: left; margin-right: 20px; }
- #event { float: left; border-left: 1px solid black;padding-left: 20px; }
- #fblogo { float: left; margin-bottom: 10px; height: 31px; width: 103px; background: url(\\\'http://static.ak.fbcdn.net/rsrc.php/z7VU4/hash/66ad7upf.png\\\') no-repeat scroll -21px 0 #3B5998 }
- </style>
- <div>
- <div id=\"fblogo\"></div><div style=\"float: left; font-size: 18px; margin: 5px 0 0 14px;\">auto like script</div>
- <div style=\"clear: both\"></div>\');
- }
- $ch = curl_init();
- #curl_setopt($ch, CURLOPT_URL, \'https://login.facebook.com/login.php?m&next=http%3A%2F%2Fm.facebook.com%2Fhome.php\');
- #curl_setopt($ch, CURLOPT_URL, \'https://login.facebook.com/login.php?m&next=http%3A%2F%2Fm.facebook.com%2Fhome.php\');
- curl_setopt($ch, CURLOPT_URL, \'http://m.facebook.com\');
- curl_setopt($ch, CURLOPT_POST, 0);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_COOKIEJAR, \"my_cookies.txt\");
- curl_setopt($ch, CURLOPT_COOKIEFILE, \"my_cookies.txt\");
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_USERAGENT, \"Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.4) Gecko/20100611 Firefox/3.6.4\");
- $page = curl_exec($ch);
- #echo $page.\"\\n\\n\\n\\n\\n\";exit;
- if (preg_match(\"/<form.+?action=\\\"(https:\\/\\/login.facebook.com\\/login.php?[^\\\"]+)\\\">/\", $page, $_login)) {
- preg_match(\"/(http%3A%2F%2F.+?$)/\", $_login[1], $_loginentrance);
- preg_match(\"/<input type=\\\"hidden\\\" name=\\\"charset_test\\\" value=\\\"([^\\\"]+)\\\"/\", $page, $_charset_test);
- #echo $_charset_test[1].\"\\n\\n\";
- #echo $_login[1].\"\\n\\n\";
- $loginentrance = html_entity_decode(rawurldecode($_loginentrance[1]));
- $loginentrance = preg_replace(\"/http:\\/\\/m.facebook.com\\/&/\", \"http://m.facebook.com/?\", $loginentrance);
- #echo $loginentrance.\"\\n\\n\";
- curl_setopt($ch, CURLOPT_URL, $_login[1]);
- curl_setopt($ch, CURLOPT_POSTFIELDS, \'charset_test=\'.urlencode($_charset_test[1]).\'&email=\' . urlencode($login_email) . \'&pass=\' . urlencode($login_pass) . \'&login=\' . urlencode(\"Log In\"));
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_exec($ch); # Login
- curl_setopt($ch, CURLOPT_POST, 0);
- curl_setopt($ch, CURLOPT_URL, $loginentrance);
- $page = curl_exec($ch);
- }
- #echo $page;exit;
- # Click the \"See More Stories\"
- # <a href=\"/stories.php?max=1289139643&fbb=rf9b84b5a&refid=7\">See More Stories</a>
- #preg_match(\"/href=\\\"(\\/stories\\.php\\?max=.+?)\\\"/\", $page, $_stories);
- #print_r($_stories);exit;
- while (1)
- {
- if ($web)
- do_web( \"<div id=\\\"date\\\">\".date(\"Y/m/d - H:i:s\") . \"</div> <div id=\\\"event\\\">Fetching facebook pages...</div>\\n\");
- else
- echo \"[\".date(\"Y/m/d - H:i:s\") . \"] Fetching facebook pages...\\n\";
- for ($a=0; $a < 4; $a++)
- {
- $likeUrls = extractLikeUrls($page);
- for ($i=0, $c=count($likeUrls); $i < $c; $i++)
- {
- # already seen or already Liked
- if (!isset($likeUrls[3][$i]) || !isset($likeUrls[4][$i]) || in_array($likeUrls[3][$i], $ss) || $likeUrls[4][$i] != \"Like\")
- {
- continue;
- }
- if (array_key_exists($likeUrls[2][$i], $users))
- {
- $p = $users[$likeUrls[2][$i]];
- $r = rand(0,100);
- if ($r < $p*100)
- {
- if ($web)
- {
- #do_web( \"<div id=\\\"date\\\">\".date(\"Y/m/d - H:i:s\") . \"</div> <div id=\\\"event\\\">Liked <a href=\\\"http://facebook.com\"...ecode($likeUrls[1][$i]).\"\\\">\".$likeUrls[2][$i].\"</a>
- <a href=\\\"http://facebook.com\".html_entity_decode($likeUrls[1][$i]).\"&story_fbid=\".$likeUrls[3][$i].\"\\\">link</a></div>\\n\");
- echo \"Liked \".$likeUrls[2][$i].\" link\\n\";
- }
- else
- {
- #echo \"Liked \".$likeUrls[2][$i].\" link: \".\"http://facebook.com\"...ecode($likeUrls[1][$i]).\"&story_fbid=\".$likeUrls[3][$i].\"\\n\";
- echo \"Liked \".$likeUrls[2][$i].\" link\\n\";
- }
- curl_setopt($ch, CURLOPT_POST, 0);
- curl_setopt($ch, CURLOPT_URL, \'http://m.facebook.com\'.html_entity_decode($likeUrls[4][$i]));
- curl_exec($ch);
- }
- else
- {
- if ($web)
- {
- # do_web( \"<div id=\\\"date\\\">\".date(\"Y/m/d - H:i:s\") . \"</div> <div id=\\\"event\\\">Skipped liking <a
- href=\\\"http://facebook.com\".html_entity_decode($likeUrls[1][$i]).\"\\\">\".$likeUrls[2][$i].\"</a> <a href=\\\"http://facebook.com\".html_entity_decode($likeUrls[1][$i]).\"&story_fbid=\".$likeUrls[3][$i].\"\\\">link</a></div>\\n\");
- echo \"Skipped liking \".$likeUrls[2][$i].\" link\\n\";
- }
- else
- {
- echo \"Skipped liking \".$likeUrls[2][$i].\" link\\n\";
- }
- }
- }
- # echo $likeUrls[2][$i] . \" \" .$likeUrls[3][$i] . \"\\n\";
- array_push($ss, $likeUrls[3][$i]);
- }
- preg_match_all(\"/href=\\\"(\\/stories\\.php\\?max=.+?)\\\"/\", $page, $stories); # get the other pages in $stories
- curl_setopt($ch, CURLOPT_POST, 0);
- curl_setopt($ch, CURLOPT_URL, \'http://m.facebook.com\'.$stories[1][0]);
- $page = curl_exec($ch); # $page is now the first page of stories.
- # echo $page;
- # print_r($stories);exit;
- # echo $page;exit;
- }
- /*
- * Randomly wait/sleep from 10 seconds to 3 hours (30% chance) or 1 hour (70% chance)
- */
- $_sleep = rand(10, (rand(0,100) < 30 ? 10800 : 3600));
- if ($web)
- do_web( \"<div id=\\\"date\\\">\".date(\"Y/m/d - H:i:s\") . \"</div> <div id=\\\"event\\\">Sleeping for \".$_sleep.\" seconds</div>\\n\");
- else
- echo \"Sleeping for \".$_sleep.\" seconds\\n\".($web?\"<br>\":\"\");
- sleep ($_sleep);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement