forked from ctrlcctrlv/infinity
-
Notifications
You must be signed in to change notification settings - Fork 3
/
dnsbls_bypass.php
39 lines (33 loc) · 1.76 KB
/
dnsbls_bypass.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
<?php
include 'inc/functions.php';
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$captcha = generate_captcha($config['captcha']['extra']);
$html = "{$captcha['html']}<br/>
<input class='captcha_text' name='captcha_text' size='25' maxlength='6' autocomplete='off' type='text'>
<input class='captcha_cookie' name='captcha_cookie' type='hidden' autocomplete='off' value='{$captcha['cookie']}'><br/>";
$body = Element("8chan/dnsbls.html", array("config" => $config, "ayah_html" => $html));
echo Element("page.html", array("config" => $config, "body" => $body, "title" => _("Bypass DNSBL"), "subtitle" => _("Post even if blocked")));
} else {
$resp = file_get_contents($config['captcha']['provider_check'] . "?" . http_build_query([
'mode' => 'check',
'text' => $_POST['captcha_text'],
'extra' => $config['captcha']['extra'],
'cookie' => $_POST['captcha_cookie']
]));
if ($resp === '1') {
$tor = checkDNSBL($_SERVER['REMOTE_ADDR']);
if (!$tor) {
$query = prepare('INSERT INTO ``dnsbl_bypass`` VALUES(:ip, NOW(), 0) ON DUPLICATE KEY UPDATE `created`=NOW(),`uses`=0');
$query->bindValue(':ip', $_SERVER['REMOTE_ADDR']);
$query->execute() or error(db_error($query));
}
$cookie = bin2hex(openssl_random_pseudo_bytes(16));
$query = prepare('INSERT INTO ``tor_cookies`` VALUES(:cookie, NOW(), 0)');
$query->bindValue(':cookie', $cookie);
$query->execute() or error(db_error($query));
setcookie("tor", $cookie, time()+60*60*3);
echo Element("page.html", array("config" => $config, "body" => '', "title" => _("Success!"), "subtitle" => _("You may now go back and make your post.")));
} else {
error(_('You failed the CAPTCHA') . _('. <a href="https://8ch.net/dnsbls_bypass.php">Try again.</a> If it\'s not working, email [email protected] for support.'));
}
}