· 9 years ago · Mar 19, 2017, 11:10 PM
1<?php
2echo " -- James' Account Creator v1.0 -- ".PHP_EOL.PHP_EOL;
3function generateRandomString($length = 10) {
4 $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
5 $charactersLength = strlen($characters);
6 $randomString = '';
7 for ($i = 0; $i < $length; $i++) {
8 $randomString .= $characters[rand(0, $charactersLength - 1)];
9 }
10 return $randomString;
11}
12function get_contents($url, $ua = 'Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1', $referer = 'http://www.google.com/') {
13 if (function_exists('curl_exec')) {
14 $header[0] = "Accept-Language: en-us,en;q=0.5";
15 $curl = curl_init();
16 curl_setopt($curl, CURLOPT_URL, $url);
17 curl_setopt($curl, CURLOPT_USERAGENT, $ua);
18 curl_setopt($curl, CURLOPT_REFERER, $referer);
19 curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
20 curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
21 curl_setopt($curl, CURLOPT_TIMEOUT, 10);
22 $content = curl_exec($curl);
23 curl_close($curl);
24 }
25 else {
26 $content = file_get_contents($url);
27 }
28 return $content;
29}
30
31
32function post_contents($url, $postfields, $ua = 'Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1', $referer = 'http://www.google.com/') {
33 if (function_exists('curl_exec')) {
34 $header[0] = "Accept-Language: en-us,en;q=0.5";
35 $curl = curl_init();
36 curl_setopt($curl, CURLOPT_URL, $url);
37 curl_setopt($curl, CURLOPT_USERAGENT, $ua);
38 curl_setopt($curl, CURLOPT_REFERER, $referer);
39 curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
40 curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
41 curl_setopt($curl, CURLOPT_TIMEOUT, 10);
42 curl_setopt($curl, CURLOPT_POST, 1);
43 curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);
44 $content = curl_exec($curl);
45 curl_close($curl);
46 }
47 else {
48 $content = file_get_contents($url);
49 }
50 return $content;
51}
52
53function createAccount($username, $password, $email)
54{
55
56 $timeout = 5;
57 $mtimeout = 120;
58
59 echo "Making account username = ".$username.", password = ".$password.", email = ".$email."...".PHP_EOL;
60
61 $site = get_contents('https://signup.euw.leagueoflegends.com/en/signup/index?realm_key=euw');
62
63 echo "Fetched LoL sign-up page!".PHP_EOL;
64
65 $one = explode("name=\"data[_Token][key]\" value=\"", $site);
66
67 $two = explode("value=\"", $one[1]);
68
69 $three = explode("\"", $two[0]);
70
71 $finaltoken = $three[0];
72
73 echo "Found CSRF token = ".$finaltoken.PHP_EOL;
74
75
76 $retrieve = file_get_contents("http://2captcha.com/in.php?key=018fe3d437fca66ab314338ce52304b5&method=userrecaptcha&googlekey=6Lf65wkTAAAAAMrRX6NYCmeiOUEVWk_0dtN7yA5l");
77
78
79 $first = array($retrieve);
80 $result = explode('OK|', $first[0]);
81 $hello = $result[1];
82
83 echo "Got reCAPTCHA ID = ".$hello." and queued for solving...".PHP_EOL;
84
85 $con = "http://2captcha.com/res.php?key=018fe3d437fca66ab314338ce52304b5&action=get&id=" . $hello;
86
87 $slept = 0;
88
89 while(true)
90 {
91 echo "Checking if captcha is solved...".PHP_EOL;
92 $getting = file_get_contents($con);
93 if ($getting == "CAPCHA_NOT_READY") {
94 echo "Not yet.",PHP_EOL;
95 $solvedcaptcha = "Couldn't be found!";
96 } elseif ($getting == "ERROR") {
97 echo "Error".PHP_EOL;
98 $solvedcaptcha = "Error occured";
99 return true;
100 } else {
101 $ex = explode('|', $getting);
102 if (trim($ex[0])=='OK') {
103 $solvedcaptcha = trim($ex[1]);
104 return true;
105 }
106 return true;
107 }
108 $slept += $timeout;
109 if ($slept != $mtimeout) {
110 echo "Sleeping ".$timeout." seconds, then trying again...".PHP_EOL;
111 sleep($timeout);
112 } else {
113 echo "Solve failed.".PHP_EOL;
114 }
115 }
116
117 echo "Solve time waited and g-recaptcha-response found as: ".$solvedcaptcha.PHP_EOL;
118
119 $postfields = array(
120 'data[PvpnetAccount][name]' => 'tvremote22',
121 'data[PvpnetAccount][password]' => 'Password123!',
122 'data[PvpnetAccount][confirm_password]' => 'Password123!',
123 'data[PvpnetAccount][email_address]' => 'ijamesphp+fooba2r@gmail.com',
124 'data[PvpnetAccount][date_of_birth_day]' => '01',
125 'data[PvpnetAccount][date_of_birth_month]' => '01',
126 'data[PvpnetAccount][date_of_birth_year]' => '2000',
127 'data[PvpnetAccount][tou_agree]' => 1,
128 'data[PvpnetAccount][realm]' => 'euw',
129 'g-recaptcha-response' => $solvedcaptcha[1],
130 'data[_Token][fields]' => '3cb6ba967c8cb5040ba201c219c4b2d7bad276b7%3An%3A0%3A%7B%7D',
131 'data[_Token][key]' => $finaltoken,
132 '_method' => 'POST',
133 'data[PvpnetAccount][newsletter]' => 0
134 );
135
136 echo "Posting as humanized form...".PHP_EOL.PHP_EOL;
137
138 return post_contents('https://signup.euw.leagueoflegends.com/en/signup/index?realm_key=euw', $postfields);
139
140}
141
142$usernamePrefix = "testAccounts";
143$password = "Password123!";
144$emailName = "jameslolaccs";
145$emailDomain = "gmail.com";
146$accountsToMake = 2;
147$accounts = "";
148for ($i=1; $i<$accountsToMake; $i++) {
149 $username = $usernamePrefix.$i;
150 $email = $emailName."+".generateRandomString(3).$i."@".$emailDomain;
151 $account_response = createAccount($username, $password, $email);
152 if ($account_response == 1) {
153 echo "Account created, username = ".$username.PHP_EOL.PHP_EOL;
154 $accounts .= $username . "|" . $password . "|" . $email;
155 if ($i != $accountsToMake) {
156 $accounts .= "\n";
157 } else {
158 $accounts .= "\n\nCreated using James' account creator.";
159 }
160 } else {
161 if ($i == $accountsToMake) {
162 $accounts .= "\n\nCreated using James' account creator.";
163 }
164 }
165}
166$file = fopen(time()."-JamesAccounts.txt","w");
167fwrite($file,$accounts);
168fclose($file);
169echo "Accounts exported to file: ".time()."-JamesAccounts.txt".PHP_EOL;