1.8.x

Block Tor users from entering your forum.

Submitted by Pirate, , Thread ID: 4928

Thread Closed
19-06-2015, 10:25 PM
#1
Here is a php plugin code that will block tor users from entering your forum:

Code:
<?php


if(!defined("IN_MYBB"))
{
die("lol ur such a l33t haxxor!");
}
$plugins->add_hook("showthread_start", "tor_guard_block");
$plugins->add_hook("newreply_do_newreply_start", "tor_guard_block");
$plugins->add_hook("newthread_do_newthread_start", "tor_guard_block");
$plugins->add_hook("online_today_start", "tor_guard_block");
$plugins->add_hook("polls_start", "tor_guard_block");
$plugins->add_hook("pre_output_page", "tor_guard_block");
$plugins->add_hook("postbit", "tor_guard_block");
$plugins->add_hook("usercp_start", "tor_guard_block");
$plugins->add_hook("usercp_do_profile_start", "tor_guard_block");
$plugins->add_hook("usercp_profile_start", "tor_guard_block");
$plugins->add_hook("usercp_options_start", "tor_guard_block");
$plugins->add_hook("usercp_password", "tor_guard_block");
$plugins->add_hook("usercp_do_changename_start", "tor_guard_block");
$plugins->add_hook("member_do_register_start", "tor_guard_block");
$plugins->add_hook("member_lostpw", "tor_guard_block");
$plugins->add_hook("member_login", "tor_guard_block");
$plugins->add_hook("misc_start", "tor_guard_block");
$plugins->add_hook("private_start", "tor_guard_block");
$plugins->add_hook("reputation_start", "tor_guard_block");

function tor_block_info()
{

return array(
  "name"  => "TOR Block",
  "description" => "Block TOR users from Accessing your Website",
  "author"  => "Pirate",
  "authorwebsite" => "http://community.mybb.com/user-91538.html",
  "website" => "http://community.mybb.com/user-91538.html",
  "version"  => "1.1",
  "compatibility" => "18*"
  );
}

function tor_guard_install()
{
  global $db, $lang;
  $lang->load("torblock");
$new_setting_group = array(
"name" => "torblock",
"title" => $lang->settings_name,
"disporder" => 1,
"isdefault" => 0
);
  $settings[] = array(
"name" => "torblock_redirecturl",
"title" => $lang->redirecturl,
"optionscode" => "text",
"disporder" => 1,
"value" => denied.php,
"gid" => $gid
);
}
function tor_guard_is_installed()
{
global $db;
$query = $db->simple_select("settinggroups", "*", "name='torblock'");
if($db->num_rows($query))
{
return TRUE;
}
return FALSE;
}
function tor_guard_activate()
{
global $db, $mybb;
}

function tor_guard_deactivate()
{
global $mybb, $db, $cache;
}

function tor_guard_uninstall()
{
$query = $db->simple_select("settinggroups", "gid", "name='torblock'");
$gid = $db->fetch_field($query, "gid");
if(!$gid) {
return;
}
$db->delete_query("settinggroups", "name='torblock'");
$db->delete_query("settings", "gid=$gid");
rebuild_settings();
}
function tor_guard_block()
{
global $mybb;


$torExitNodes = file_get_contents("https://www.dan.me.uk/tornodes");

$ip = $_SERVER['REMOTE_ADDR'];

if (strpos($torExitNodes, $ip) == true) {
die('$settings['value']');
}
}
?>

RE: Block Tor users from entering your forum.

Maximum
Active Member
Prime
Level:
0
Reputation:
23
Posts:
217
Likes:
28
Credits:
136
19-06-2015, 10:46 PM
#2
So uhm, where would I put this?

Just make a PHP file and upload it?

RE: Block Tor users from entering your forum.

Akay
We are!
Level:
0
Reputation:
28
Posts:
946
Likes:
109
Credits:
2.05K
19-06-2015, 10:54 PM
#3
19-06-2015, 10:46 PM
Maximum Wrote:
So uhm, where would I put this?

Just make a PHP file and upload it?

Make a file called "tor_guard.php" and upload to Plugins.

RE: Block Tor users from entering your forum.

Maximum
Active Member
Prime
Level:
0
Reputation:
23
Posts:
217
Likes:
28
Credits:
136
19-06-2015, 11:11 PM
#4
19-06-2015, 10:54 PM
akay Wrote:
19-06-2015, 10:46 PM
Maximum Wrote:
So uhm, where would I put this?

Just make a PHP file and upload it?

Make a file called "tor_guard.php" and upload to Plugins.

Thank you Sir Akay.

RE: Block Tor users from entering your forum.

abda53
Novice
Level:
0
Reputation:
0
Posts:
42
Likes:
2
Credits:
23
19-06-2015, 11:38 PM
#5
Very cool. This could easily be adapted to non nulledbb sites as well. I only skimmed through it.. only thing I would suggest would be to file cache $torExitNodes so that you aren't make a new call to the 3rd party site on every page load, and update the file occasionally

RE: Block Tor users from entering your forum.

Mr_Joker
YouR JuSt G4Y
Level:
0
Reputation:
3
Posts:
795
Likes:
51
Credits:
493
22-06-2015, 02:01 AM
#6
ERROR!

Parse error: syntax error, unexpected 'value' (T_STRING) in /home/hqforumx/public_html/inc/plugins/tor_guard.php on line 102

RE: Block Tor users from entering your forum.

Akay
We are!
Level:
0
Reputation:
28
Posts:
946
Likes:
109
Credits:
2.05K
22-06-2015, 07:20 AM
#7
22-06-2015, 02:01 AM
Mr_Joker Wrote:
ERROR!

Parse error: syntax error, unexpected 'value' (T_STRING) in /home/hqforumx/public_html/inc/plugins/tor_guard.php on line 102

PHP Code:
"value" => denied.php,

 if (
strpos($torExitNodes$ip) == true) {
     die(
'$settings['value']');


I think he forgot to upload denied.php.

RE: Block Tor users from entering your forum.

cute
Married to Yuun
Vixen
Level:
4
Reputation:
50
Posts:
523
Likes:
92
Credits:
1.09K
22-06-2015, 01:35 PM
#8
22-06-2015, 07:20 AM
akay Wrote:
22-06-2015, 02:01 AM
Mr_Joker Wrote:
ERROR!

Parse error: syntax error, unexpected 'value' (T_STRING) in /home/hqforumx/public_html/inc/plugins/tor_guard.php on line 102

PHP Code:
"value" => denied.php,

 if (
strpos($torExitNodes$ip) == true) {
     die(
'$settings['value']');


I think he forgot to upload denied.php.

denied.php should be wrapped in quotation marks. 10/10 would not use OP's code.
[Image: ZtDsXXv.png]

RE: Block Tor users from entering your forum.

linkzy
No pressure, no diamonds
Level:
0
Reputation:
181
Posts:
5.34K
Likes:
341
Credits:
54
22-06-2015, 01:46 PM
#9
What about using deny and using all those reverse IP's Tor uses like umm deny from [IP] ?
| A | v4hl| Addicted | Senpai | Sui | Sensei | H | fdigl |


RE: Block Tor users from entering your forum.

maxtor
Closed Account
Level:
0
Reputation:
0
Posts:
19
Likes:
0
Credits:
0
23-06-2015, 10:46 AM
#10
thank you for your sharing Smile

Users browsing this thread: 1 Guest(s)