Advertisement
Guest User

Untitled

a guest
Oct 18th, 2017
448
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.63 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. class InBot{
  5.  
  6. var $port ="";
  7. var $proxy="";
  8. var $cookie="";
  9. var $header="";
  10. var $useragent= "" ;
  11. var $username ;
  12. var $password;
  13. var $csrf;
  14.  
  15. function __construct() {
  16.  
  17. $this->headers[] = "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
  18. $this->headers[] = "Connection: keep-alive";
  19. $this->headers[] = "Keep-Alive: 115";
  20. $this->headers[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
  21. $this->headers[] = "Accept-Language: en-us,en;q=0.5";
  22. $this->headers[] = "Pragma: ";
  23. }
  24.  
  25. public function login(){
  26.  
  27.  
  28. $linkedin_login_page = "https://www.linkedin.com/uas/login";
  29. $linkedin_ref = "https://www.linkedin.com";
  30.  
  31. $username = 'djfab007@hotmail.com';
  32. $password = 'rochester1*';
  33.  
  34. $ch = curl_init();
  35. curl_setopt($ch, CURLOPT_URL, $linkedin_login_page);
  36. curl_setopt($ch, CURLOPT_REFERER, $linkedin_ref);
  37. curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7)');
  38. curl_setopt($ch, CURLOPT_AUTOREFERER, true);
  39. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  40. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  41. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  42. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
  43. curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
  44. curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
  45.  
  46.  
  47. $login_content = curl_exec($ch);
  48.  
  49.  
  50. if(curl_error($ch)) {
  51. echo 'error:' . curl_error($ch);
  52. }
  53.  
  54. $var = array(
  55. 'isJsEnabled' => 'false',
  56. 'source_app' => '',
  57. 'clickedSuggestion' => 'false',
  58. 'session_key' => trim($username),
  59. 'session_password' => trim($password),
  60. 'signin' => 'Sign In',
  61. 'session_redirect' => '',
  62. 'trk' => '',
  63. 'fromEmail' => '');
  64. $var['loginCsrfParam'] = $this->fetch_value($login_content, 'type="hidden" name="loginCsrfParam" value="', '"');
  65. $var['csrfToken'] = $this->fetch_value($login_content, 'type="hidden" name="csrfToken" value="', '"');
  66. $var['sourceAlias'] = $this->fetch_value($login_content, 'input type="hidden" name="sourceAlias" value="', '"');
  67.  
  68. $post_array = array();
  69. foreach ($var as $key => $value)
  70. {
  71. $post_array[] = urlencode($key) . '=' . urlencode($value);
  72. }
  73. $post_string = implode('&', $post_array);
  74.  
  75. curl_setopt($ch, CURLOPT_URL, "https://www.linkedin.com/uas/login-submit");
  76. curl_setopt($ch, CURLOPT_POST, true);
  77. curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string);
  78.  
  79. $store = curl_exec($ch);
  80.  
  81. echo $store;
  82.  
  83. if (stripos($store, "session_password-login-error") !== false){
  84. $err = trim(strip_tags(fetch_value($store, '<span class="error" id="session_password-login-error">', '</span>')));
  85. echo "Login error : ".$err;
  86. }elseif (stripos($store, 'profile-nav-item') !== false) {
  87. curl_setopt($ch, CURLOPT_URL, 'https://www.linkedin.com/in/beth-smith-93a3941/');
  88. curl_setopt($ch, CURLOPT_POST, false);
  89. curl_setopt($ch, CURLOPT_POSTFIELDS, "");
  90. $content = curl_exec($ch);
  91. curl_close($ch);
  92.  
  93. echo $content;
  94. }else{
  95. echo "unknown error";
  96. }
  97.  
  98.  
  99.  
  100.  
  101. }
  102.  
  103. // Fetches the CSRF for login authentication
  104. private function fetchCSRF(){
  105. $url = 'https://www.linkedin.com/uas/login';
  106.  
  107. $ch = curl_init();
  108. curl_setopt($ch, CURLOPT_HEADER, TRUE);
  109. curl_setopt($ch, CURLOPT_URL, $url);
  110. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  111. //curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
  112. curl_setopt($ch, CURLOPT_COOKIESESSION, true);
  113. curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
  114. curl_setopt($ch, CURLOPT_USERAGENT,
  115. "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0");
  116. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
  117. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  118. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //@TODO change back: curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  119.  
  120. curl_setopt($ch, CURLOPT_PROXY, '108.62.102.78');
  121. curl_setopt($ch, CURLOPT_PROXYPORT, '3128');
  122. $html = curl_exec($ch);
  123. curl_close($ch);
  124.  
  125.  
  126. // $html = file_get_contents($url);
  127. $precsrf = (int) strpos($html, '<input type="hidden" name="loginCsrfParam" value="');
  128. $postcsrf = (int) strpos($html, '" id="loginCsrfParam-login">');
  129. $length = $postcsrf - $precsrf - 50; // The -50 / + 50 is to correct for: <input type="hidden" name="login...
  130. $this->csrf = substr($html, $precsrf + 50, $length);
  131. echo "<h1>" .$this->csrf ."</h1>";
  132. if($this->csrf == false){
  133. return false;
  134. }
  135. return $this->csrf;
  136. }
  137.  
  138. private function fetch_value($str, $find_start = '', $find_end = '')
  139. {
  140. if ($find_start == '')
  141. {
  142. return '';
  143. }
  144. $start = strpos($str, $find_start);
  145. if ($start === false)
  146. {
  147. return '';
  148. }
  149. $length = strlen($find_start);
  150. $substr = substr($str, $start + $length);
  151. if ($find_end == '')
  152. {
  153. return $substr;
  154. }
  155. $end = strpos($substr, $find_end);
  156. if ($end === false)
  157. {
  158. return $substr;
  159. }
  160. return substr($substr, 0, $end);
  161. }
  162.  
  163. function grab_page($site){
  164. $ch = curl_init();
  165. curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  166. curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
  167. curl_setopt($ch, CURLOPT_TIMEOUT, 40);
  168. curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
  169. curl_setopt($ch, CURLOPT_URL, $site);
  170. ob_start();
  171. return curl_exec ($ch);
  172. ob_end_clean();
  173. curl_close ($ch);
  174. }
  175.  
  176. function post_data($site,$data){
  177. $datapost = curl_init();
  178. $headers = array("Expect:");
  179. curl_setopt($datapost, CURLOPT_URL, $site);
  180. curl_setopt($datapost, CURLOPT_TIMEOUT, 40000);
  181. curl_setopt($datapost, CURLOPT_HEADER, TRUE);
  182. curl_setopt($datapost, CURLOPT_HTTPHEADER, $headers);
  183. curl_setopt($datapost, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
  184. curl_setopt($datapost, CURLOPT_POST, TRUE);
  185. curl_setopt($datapost, CURLOPT_POSTFIELDS, $data);
  186. curl_setopt($datapost, CURLOPT_COOKIEFILE, "cookie.txt");
  187. ob_start();
  188. return curl_exec ($datapost);
  189. ob_end_clean();
  190. curl_close ($datapost);
  191. unset($datapost);
  192. }
  193.  
  194.  
  195.  
  196. public function check_messages(){
  197.  
  198. }
  199.  
  200. public function request_friend(){
  201.  
  202. }
  203.  
  204. public function friend_list_update(){
  205.  
  206. }
  207.  
  208. }
  209. function getuseragent(){
  210. try{
  211. $pxdbh = new PDO("mysql:host=localhost;dbname=blackperl", "root", "1Bronx*007*");
  212. $pxdbh->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
  213. }
  214.  
  215. catch (PDOException $e) {
  216. echo "fucking proxies agent strong database error you prick ";
  217. die('unable to connect to database ' . $e->getMessage());
  218. }
  219.  
  220. $clientidstmt = "SELECT string FROM user_agent_strings ORDER BY RAND() LIMIT 1";
  221. $agentstring = $pxdbh->prepare($clientidstmt);
  222. echo "2";
  223. $agentstring->execute();
  224. $newagentstring = $agentstring->fetchALL();
  225. echo " The agent string is " ;
  226. var_dump($newagentstring);
  227. return $newagentstring[0][0];
  228. }
  229. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement