Advertisement
Guest User

Sample BOT Messenger aka FB - Bl4ckAr13s

a guest
Apr 10th, 2018
498
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.47 KB | None | 0 0
  1. <?php
  2. //MARCH 16 2018
  3. //BY BL4CKAR13S
  4. /*
  5. Tolong install
  6. .php
  7. .php-curl
  8. */
  9. error_reporting(E_ALL);
  10. ini_set('display_errors', 'Off');
  11. ini_set("log_errors", 1);
  12. ini_set("error_log", "error.log");
  13. //
  14. echo "\n[Facebook bot super beta v.0.0.0.1]";
  15. //konfigurasi
  16. $cookies = "dsa.txt";
  17. $username = "emiliano0000000@outlook.com";
  18. $password = "Lucky!@!@123";
  19. $id_msg = "2028917070468905"; //
  20. //
  21. echo "\n[".date("h:i:sa")."][Konfigurasi diterima]";
  22. echo "\n[".date("h:i:sa")."]+--->Cookies\t: ".$cookies;
  23. echo "\n[".date("h:i:sa")."]+--->Username\t:".$username;
  24. echo "\n[".date("h:i:sa")."]+--->Pesan ID\t:".$id_msg;
  25.  
  26. $page_login_req = page_login_req($cookies);
  27. if($page_login_req == "blacklist."){
  28. echo "\n[".date("h:i:sa")."]+--->Yaahhh :'( , Ip anda telah di blacklist.";
  29. $read_log_id = 0;
  30. }
  31. elseif($page_login_req == "login."){
  32. echo "\n[".date("h:i:sa")."]+--->Anda sudah login";
  33. $read_log_id = 1;
  34. }
  35. else{
  36. echo "\n[".date("h:i:sa")."]+--->Mencoba Login.";
  37. login_facebook($page_login_req, $username, $password, $cookies);
  38. $read_home = read_home($cookies);
  39. if(read_home_login($read_home) == 1){
  40. echo "\n[".date("h:i:sa")."]+--->Login Berhasil.";
  41. $read_log_id = 1;
  42. }
  43. else{
  44. echo "\n[".date("h:i:sa")."]+--->Login Gagal.";
  45. $read_log_id = 0;
  46. }
  47. }
  48. if($read_log_id == 1){
  49. preg_match_all("/>Logout \(([^\"]*)\)<\/a>/", read_home($cookies), $read_home_profile_name, PREG_SET_ORDER);
  50. $my_profile_name = $read_home_profile_name[0][1];
  51. echo "\n[".date("h:i:sa")."]+--->Halo ".$my_profile_name.",";
  52. echo "\n[".date("h:i:sa")."]+--->Ayo Bermain sesuatu yang bagus :)";
  53.  
  54. for($a = 1;$a <= $a; $a++){
  55. $read_message = read_message($cookies, $id_msg);
  56. $get_token_message = get_token_message($read_message);
  57. //echo $read_message;
  58. $compress_message = json_decode(compress_message($read_message));
  59. foreach($compress_message as $message_list){
  60. $last_message = $message_list;
  61. }
  62. $last_message = json_decode($last_message);
  63. //echo "\n".$last_message->{"name"};
  64. if($last_message->{"name"} == $my_profile_name){
  65. echo "\n[".date("h:i:sa")."]+--->Pesan terakhir cuman dari saya. :(";
  66. }
  67. else{
  68. $last_message_send_tot = str_replace("&shy;", "", $last_message->{"message"});
  69. $last_message_send_tot = str_replace("&quot;", '"', $last_message_send_tot);
  70. $is_bot_hi = preg_match("/hi bot/", $last_message_send_tot);
  71. $is_bot_system = preg_match("/\.\/system\([^\)]*\)/", $last_message_send_tot);
  72. if($is_bot_hi){
  73. echo "\n[".date("h:i:sa")."]+--->Pesan ini diterima. :) [".$last_message_send_tot."]";
  74. $my_message = "Hi, ".$last_message->{"name"};
  75. send_message($get_token_message, $my_message, $cookies, $id_msg);
  76. echo "\n[".date("h:i:sa")."]+--->Telah merespon pesan. :)";
  77. }
  78. elseif($is_bot_system){
  79. echo "\n[".date("h:i:sa")."]+--->Pesan ini diterima. :) [".$last_message_send_tot."]";
  80. preg_match_all("/\.\/system\(([^\)]*)\)/", $last_message_send_tot, $open_bot_system, PREG_SET_ORDER);
  81. exec($open_bot_system[0][1], $arr_result_bot_system);
  82. $my_bot_message = "";
  83. foreach($arr_result_bot_system as $result_bot_system){
  84. $my_bot_message = $my_bot_message."\n".$result_bot_system;
  85. }
  86. if(strlen($my_bot_message) >= 5000){
  87. send_message($get_token_message, "Hallo ".$last_message->{"name"}.",\nPermintaan tidak bisa ditampilkan disini.", $cookies, $id_msg);
  88. echo "\n[".date("h:i:sa")."]+--->Limit char 5000 :(";
  89. }
  90. else{
  91. send_message($get_token_message, $my_bot_message, $cookies, $id_msg);
  92. echo "\n[".date("h:i:sa")."]+--->Telah merespon pesan. :)";
  93. }
  94. }
  95. else{
  96. echo "\n[".date("h:i:sa")."]+--->Pesan dari ".$last_message->{"name"}." tidak diterima. :( ";
  97. }
  98. }
  99. sleep(3);
  100. }
  101. }
  102. else{}
  103.  
  104. function send_message($a, $b, $d, $e){
  105. $a = json_decode($a);
  106. $ch = curl_init();
  107. curl_setopt($ch, CURLOPT_URL, "https://m.facebook.com/".$a->{"url"});
  108. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  109. curl_setopt($ch, CURLOPT_POSTFIELDS, "fb_dtsg=".urlencode($a->{"fb_dtsg"})."&body=".str_replace("\n", "%0D%0A", $b)."&send=Send&tids=cid.g.".$e."&wwwupp=C3&referrer=&ctype=&cver=legacy&csid=".$a->{"csid"});
  110. curl_setopt($ch, CURLOPT_POST, 1);
  111. curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
  112. curl_setopt($ch, CURLOPT_COOKIEJAR, $d);
  113. curl_setopt($ch, CURLOPT_COOKIEFILE, $d);
  114. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  115. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  116. $headers = array();
  117. $headers[] = "Origin: https://m.facebook.com";
  118. $headers[] = "Accept-Encoding: gzip, deflate, br";
  119. $headers[] = "Accept-Language: en-US,en;q=0.9";
  120. $headers[] = "Upgrade-Insecure-Requests: 1";
  121. $headers[] = "User-Agent: Nokia5250/10.0.011 (SymbianOS/9.4; U; Series60/5.0 Mozilla/5.0; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/525 (KHTML, like Gecko) Safari/525 3gpp-gba";
  122. $headers[] = "Content-Type: application/x-www-form-urlencoded";
  123. $headers[] = "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8";
  124. $headers[] = "Cache-Control: max-age=0";
  125. $headers[] = "Authority: m.facebook.com";
  126. $headers[] = "Referer: https://m.facebook.com/messages/read/?tid=".$e."&request_type=send_success&_rdr";
  127. curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  128. $result = curl_exec($ch);
  129. echo $result;
  130. }
  131.  
  132. function get_token_message($a){
  133. preg_match_all("/<input type=\"hidden\" name=\"fb_dtsg\" value=\"([^\"]*)\" autocomplete=\"off\" \/>/", $a, $fb_dtsg, PREG_SET_ORDER);
  134. preg_match_all("/<input type=\"hidden\" name=\"csid\" value=\"([^\"]*)\" \/>/", $a, $csid, PREG_SET_ORDER);
  135. preg_match_all("/<form method=\"post\" action=\"([^\"]*)\" class=\"bz\" id=\"composer_form\">/", $a, $url_form, PREG_SET_ORDER);
  136. $arr = array(
  137. "url" => $url_form[0][1],
  138. "csid" => $csid[0][1],
  139. "fb_dtsg" => $fb_dtsg[0][1]
  140. );
  141. return json_encode($arr);
  142. }
  143.  
  144. function compress_message($a){
  145. $page_message_arr = explode('<div class="d bm bn" id="fua">', $a);
  146. $b = 1;
  147. foreach($page_message_arr as $page_message){
  148. preg_match_all("/<div class=\"bo\"><a href=\"(\/[^\"]*)\" class=\"[^\"]*\">/", $page_message, $page_message_profile_url, PREG_SET_ORDER);
  149. preg_match_all("/class=\"bp\"><strong class=\"bq\">([^<]*)<\/strong>/", $page_message, $page_message_profile_name, PREG_SET_ORDER);
  150. preg_match_all("/<div><span>([^\"]*)<\/span>/", $page_message, $page_message_messages, PREG_SET_ORDER);
  151. preg_match_all("/<abbr>([^<]*)<\/abbr>/", $page_message, $page_message_time_ago, PREG_SET_ORDER);
  152. $page_message_message_total = count($page_message_messages);
  153. $aa = 0;
  154. foreach($page_message_messages as $page_message_messages_for){
  155. if($a == $page_message_message_total){
  156. $w = ",";
  157. }else{ $w = ""; }
  158. $page_message_message = $page_message_messages_for[1].$w;
  159. $aa = $aa + 1;
  160. }
  161. $arr = array(
  162. "profile" => $page_message_profile_url[0][1],
  163. "name" => $page_message_profile_name[0][1],
  164. "message" => $page_message_message,
  165. "time ago" => $page_message_time_ago[0][1]
  166. );
  167. $json_arr[$b] = json_encode($arr);
  168. $b = $b + 1;
  169. }
  170. return json_encode($json_arr);
  171. }
  172. function read_home_login($a){
  173. $is_Login = preg_match("/ href=\"\/logout.php\?[^\"]*/", $a);
  174. if($is_Login){
  175. return 1;
  176. }
  177. else{
  178. return 0;
  179. }
  180. }
  181. function read_message($d, $a){
  182. $ch = curl_init();
  183.  
  184. curl_setopt($ch, CURLOPT_URL, "https://m.facebook.com/messages/read/?tid=cid.g.".$a."&ref_component=mbasic_home_header&ref_page=%2Fwap%2Fhome.php&refid=7&ref=wizard");
  185. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  186. curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
  187. curl_setopt($ch, CURLOPT_COOKIEJAR, $d);
  188. curl_setopt($ch, CURLOPT_COOKIEFILE, $d);
  189. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  190. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  191. curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
  192.  
  193. $headers = array();
  194. $headers[] = "Accept: */*";
  195. $headers[] = "Accept-Language: en-US";
  196. $headers[] = "Cache-Control: max-age=0";
  197. $headers[] = "Connection: keep-alive";
  198. $headers[] = "Host: m.facebook.com";
  199. $headers[] = "Upgrade-Insecure-Requests: 1";
  200. $headers[] = "User-Agent: Nokia5250/10.0.011 (SymbianOS/9.4; U; Series60/5.0 Mozilla/5.0; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/525 (KHTML, like Gecko) Safari/525 3gpp-gba";
  201. curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  202. $result = curl_exec($ch);
  203. return $result;
  204. }
  205.  
  206. function login_facebook($a, $b, $c, $d){
  207. $a = json_decode($a);
  208. $ch = curl_init();
  209. curl_setopt($ch, CURLOPT_URL, $a->{'url'});
  210. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  211. curl_setopt($ch, CURLOPT_POSTFIELDS, "lsd=".$a->{'lsd'}."&m_ts=".$a->{'m_ts'}."&li=".$a->{'li'}."&try_number=".$a->{'try_number'}."&unrecognized_tries=".$a->{'unrecognized_tries'}."&email=".urlencode($b)."&pass=".urlencode($c)."&login=Log+In");
  212. curl_setopt($ch, CURLOPT_POST, 1);
  213. curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
  214. curl_setopt($ch, CURLOPT_COOKIEJAR, $d);
  215. curl_setopt($ch, CURLOPT_COOKIEFILE, $d);
  216. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  217. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  218. $headers = array();
  219. $headers[] = "Origin: https://m.facebook.com";
  220. $headers[] = "Accept-Encoding: gzip, deflate, br";
  221. $headers[] = "Accept-Language: en-US,en;q=0.9";
  222. $headers[] = "Upgrade-Insecure-Requests: 1";
  223. $headers[] = "User-Agent: Nokia5250/10.0.011 (SymbianOS/9.4; U; Series60/5.0 Mozilla/5.0; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/525 (KHTML, like Gecko) Safari/525 3gpp-gba";
  224. $headers[] = "Content-Type: application/x-www-form-urlencoded";
  225. $headers[] = "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8";
  226. $headers[] = "Cache-Control: max-age=0";
  227. $headers[] = "Authority: m.facebook.com";
  228. $headers[] = "Referer: https://m.facebook.com/login/?ref=wizard&fl&refid=8";
  229. curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  230. $result = curl_exec($ch);
  231. return $result;
  232. }
  233.  
  234. function read_home($a){
  235. $ch = curl_init();
  236. //set
  237. curl_setopt($ch, CURLOPT_URL, "https://m.facebook.com/home.php");
  238. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  239. curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
  240. curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
  241. curl_setopt($ch, CURLOPT_COOKIEJAR, $a);
  242. curl_setopt($ch, CURLOPT_COOKIEFILE, $a);
  243. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  244. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  245. //header
  246. $headers = array();
  247. $headers[] = "Accept: */*";
  248. $headers[] = "Accept-Language: en-US";
  249. $headers[] = "Cache-Control: max-age=0";
  250. $headers[] = "Connection: keep-alive";
  251. $headers[] = "Host: m.facebook.com";
  252. $headers[] = "Upgrade-Insecure-Requests: 1";
  253. $headers[] = "User-Agent: Nokia5250/10.0.011 (SymbianOS/9.4; U; Series60/5.0 Mozilla/5.0; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/525 (KHTML, like Gecko) Safari/525 3gpp-gba";
  254. curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  255. $page_login = curl_exec($ch);
  256. return $page_login;
  257. }
  258. function page_login_req($a){
  259. for($aa = 1; $aa <= 10;){
  260. $ch = curl_init();
  261. //set
  262. curl_setopt($ch, CURLOPT_URL, "https://m.facebook.com/");
  263. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  264. curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
  265. curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
  266. curl_setopt($ch, CURLOPT_COOKIEJAR, $a);
  267. curl_setopt($ch, CURLOPT_COOKIEFILE, $a);
  268. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  269. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  270. //header
  271. $headers = array();
  272. $headers[] = "Accept: */*";
  273. $headers[] = "Connection: keep-alive";
  274. $headers[] = "User-Agent: Nokia5250/10.0.011 (SymbianOS/9.4; U; Series60/5.0 Mozilla/5.0; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/525 (KHTML, like Gecko) Safari/525 3gpp-gba";
  275. curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  276. $page_login = curl_exec($ch);
  277. preg_match_all("/<form method=\"post\" action=\"([^'\"]*)\" class=\"bg bh\" id=\"login_form\" novalidate=\"[0-9]*\">/", $page_login, $page_login_url, PREG_SET_ORDER);
  278. preg_match_all("/<input type=\"hidden\" name=\"lsd\" value=\"([^\"]*)\" autocomplete=\"off\" \/>/", $page_login, $page_login_lsd, PREG_SET_ORDER);
  279. preg_match_all("/<input type=\"hidden\" name=\"m_ts\" value=\"([^\"]*)\" \/>/", $page_login, $page_login_m_ts, PREG_SET_ORDER);
  280. preg_match_all("/<input type=\"hidden\" name=\"li\" value=\"([^\"]*)\" \/>/", $page_login, $page_login_li, PREG_SET_ORDER);
  281. preg_match_all("/<input type=\"hidden\" name=\"try_number\" value=\"([0-9]*)\" \/>/", $page_login, $page_login_try_number, PREG_SET_ORDER);
  282. preg_match_all("/<input type=\"hidden\" name=\"unrecognized_tries\" value=\"([0-9]*)\" \/>/", $page_login, $page_login_unrecognized_tries, PREG_SET_ORDER);
  283. $is_Login = preg_match("/<a class=\"[^\"]*\" href=\"\/logout.php[^\"]*\">/", $page_login);
  284. if($is_Login){
  285. $aa = $aa + 10;
  286. $stat = 1;
  287. }
  288. elseif($page_login_url[0][1]==""||$page_login_lsd[0][1]==""||$page_login_m_ts[0][1]==""||$page_login_li[0][1]==""||$page_login_try_number[0][1]==""||$page_login_unrecognized_tries[0][1]==""){
  289. $aa = $aa + 1;
  290. $stat = 0;
  291. }
  292. else{
  293. $aa = $aa + 10;
  294. $stat = 2;
  295. }
  296. }
  297. if($stat == 2){
  298. $page_login_get = array(
  299. "url" => $page_login_url[0][1],
  300. "lsd" => $page_login_lsd[0][1],
  301. "m_ts" => $page_login_m_ts[0][1],
  302. "li" => $page_login_li[0][1],
  303. "try_number" => $page_login_try_number[0][1],
  304. "unrecognized_tries" => $page_login_unrecognized_tries[0][1]
  305. );
  306. $finish = json_encode($page_login_get);
  307. }
  308. elseif($stat == 1){
  309. $finish = "login.";
  310. }
  311. else{
  312. $finish = "blacklist.";
  313. }
  314. return $finish;
  315. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement