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
|
//This script pulls CAPTCHAs URL from $urlHotmailAudio with POST parameters $paramsHotmailAudio, then gets the CAPTCHA and saves them to folder $saveHotmailAudio from the range $startSound to $endSound.
$urlHotmailAudio = "https://signup.live.com/nexus.fpp?cnmn=Microsoft.Msn.MemberExperience.Nexus.NexusService.GetHipAudioData&ptid=0&a=3ba63739-06f1-491a-9aa3-3f98a343b5d1";
$paramsHotmailAudio = "cn=Microsoft.Msn.MemberExperience.Nexus.NexusService&mn=GetHipAudioData&d=%22en%22,%223ba63739-06f1-491a-9aa3-3f98a343b5d1%22&v=1";
$saveHotmailAudio = "hotmailaudio/";
$startSound = 0;
$endSound = 999;
//Make carraige returns appear correctly in all browsers. (ideally)
echo "<PRE>";
//These two lines force the output to be constantly flushed and updated for the user. (ideally)
ob_implicit_flush(true);
ob_end_flush();
echo "Script Started.n";
//Pull in the CAPTCHA image as a string with cURL, and save to a file. The curl extension must first be enabled in php.ini.
for ($i=$startSound;$i<=$endSound;$i++) {
//First extract a unique URL for each CAPTCHA from the $urlHotmailAudio.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $urlHotmailAudio."&rand=".$i);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $paramsHotmailAudio);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
//If you're having difficulties with SSL, this may need to be enabled.
//curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
$result = curl_exec($ch);
//Enable this if you're having difficulties.
//echo "Error is: ".curl_error($ch);
curl_close($ch);
//Parse out the URL, and retrieve the CAPTCHA for it.
$resultArray = explode('"',$result);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $resultArray[5]."&rand=".$i);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$sound = curl_exec($ch);
//Enable this if you're having difficulties.
//echo "Error is: ".curl_error($ch);
curl_close($ch);
//Save CAPTCHA to a file with the same name as $i.
if(!is_dir($saveHotmailAudio)) mkdir($saveHotmailAudio);
$fh = fopen($saveHotmailAudio.$i.".wav","w");
fwrite($fh,$sound);
fclose($fh);
//Don't allow it to timeout.
set_time_limit(40);
//Output occasional progress.
if ($i%10 == 0) {
echo $i." CAPTCHA captured.n";
flush();
}
}
echo "Script Complete.";
//-maluc
|