-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwordforce.php
71 lines (60 loc) · 1.72 KB
/
wordforce.php
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
62
63
64
65
66
67
68
69
70
71
<?php
/**
* wpForce
*
* @author Fray117
* @package WordForce
* @version 0.4.1
*/
// _____
// __ ___ __ | ___|__ _ __ ___ ___
// \ \ /\ / / '_ \| |_ / _ \| '__/ __/ _ \
// \ V V /| |_) | _| (_) | | | (_| __/
// \_/\_/ | .__/|_| \___/|_| \___\___|
// |_|
class wordforce {
function save(string $url, string $username, string $password) {
$filename = "cookie.tmp";
// Open Connection
$ch = curl_init();
// Setting up Connection
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $this->random_ua());
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
// Setting up Cookie Jar
curl_setopt($ch, CURLOPT_COOKIEJAR, $filename);
// Make Request
$result = curl_exec($ch);
// Close Connection
curl_close($ch);
}
function validate(string $url, string $username, string $password) {
$filename = "cookie.tmp";
// Open Connection
$ch = curl_init();
// Setting up Connection
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'log=' . $username . '&pwd=' . $password);
curl_setopt($ch, CURLOPT_USERAGENT, $this->random_ua());
curl_setopt($ch, CURLOPT_COOKIEFILE, $filename);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
// Make Request
$result = curl_exec($ch);
// Close Connection
curl_close($ch);
// Return Data
if (empty($result)) {
return true;
} else {
return false;
}
}
function random_ua(){
$ua = file_get_contents('ua.txt');
$rand_ua = explode("\n", $ua);
return $rand_ua[rand(0, count($rand_ua))];
}
}