MyBB Community Forums

Full Version: Plugin Offer
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Hi, I'm Mike from www.BotScout.com. BotScout is a free anti-bot, anti-spam service that has plugins for most of the major forums, blogs, and CMS's like SMF, phpBB, VBulletin, Joomla, Drupal, etc.

myBB seems to be gaining a lot of popularity and seems like an excellent forum package and we'd like to be able to offer a plugin for myBB. Implementing the BotScout code is usually very easy, and if anyone here would like to help code one I'd be more than glad to help.

I'm pretty sure that the general or "generic" BotScout code could be easily adapted for use with myBB, but creating the actual plugin package for myBB is something I wouldn't have a clue as to how to do.

Would someone here like to collaborate on this? I'm thinking it would be a pretty quick job for anyone familiar with creating myBB plugins (and I'd help in whatever way I could).

If you like, please feel free to contact me here, or by PM, or through the contact form on the BotScout site.

Mike
BotScout.com
Not really an offer to help but out of curiosity, what differentiates you from similar services?

(2011-03-06, 06:54 AM)PwnEm Wrote: [ -> ]Not really an offer to help but out of curiosity, what differentiates you from similar services?

Well, our wives say we're a lot of fun in bed, lol. Smile

Seriously though, I don't know if there are any earth-shaking features that differentiate us from other services. I'm sure that some of them have very similar features or could say similar things about how they operate compared to us.

Basically, I posted here to help support myBB and to equip the myBB community with a plugin that would (hopefully) be of some use to them.

As for BotScout itself, I think we have a pretty good "capture" rate (to spot or catch new bots) and we have a very frequently updated database (about once a minute). We run a large network of dedicated honeypot sites to help find new bots, and we have a number of arrangements with trusted partners that provide feeds of new bots to us as well.

One thing that (I think) makes us different is that we only store unique bot signatures (about 1.2 million so far and growing at a rate of a few thousand a day). There are some anti-bot databases that claim to have several million bots 'registered', but from what we can tell a lot of those are duplicates.

Our API is simple, flexible, and robust, and can provide a "plain vanilla" response or an XML-formatted response. You can query it in a variety of ways depending upon what you want to do. But again, you could probably say the same thing about most of the anti-bot services out there today.

Is BotScout "better" than other services? I've no idea. I can't say that because I honestly don't know. We're not in competition with anyone, we're just trying to help forum owners keep bots out. So far we seem to be pretty effective overall.
If you just need a base, something like this will work. Just add your code to check if they actually are on the list before showing the errors.

<?php

$plugins->add_hook('datahandler_user_validate', 'botscout_validate');

function botscout_info()
{
	return array(
		'name'			=> 'Bot Scout',
		'description'	=> 'BotScout is a free anti-bot, anti-spam service.',
		'website'		=> 'http://www.botscout.com/',
		'author'		=> 'MrMike',
		'authorsite'	=> 'http://www.botscout.com/',
		'version'		=> '1.0',
	);
}

function botscout_activate()
{
	global $db, $mybb;

}

function botscout_deactivate()
{
	global $mybb, $db;

}

function botscout_validate($datahandler) {
global $mbbb, $db, $user;

$datahandler->set_error('banned_username');
$datahandler->set_error('banned_email');


}

?>

If you need more help just ask.

Regards,
Jammerx2
Thank you...I'm unsure what to do with this, but I think implementing this should be pretty straightforward (famous last words!).

The BotScout code works by gathering 3 bits of info- the user name, the user email, and the IP address. (You can submit any or all of those 3 bits, but it works best when all 3 are submitted.)

It normally grabs or intercepts this info from whatever page the registration form submits to. It then makes a call to the BotScout database and returns info showing whether or not the submitted item(s) appear in the database, and how often (how many times).

If you'd like to help package this into a suitable package or mod for myBB, I'd be grateful (and I'll help in any way that I can).

MrMike



(2011-03-06, 03:13 PM)Jammerx2 Wrote: [ -> ]If you just need a base, something like this will work. Just add your code to check if they actually are on the list before showing the errors.

<?php

$plugins->add_hook('datahandler_user_validate', 'botscout_validate');

function botscout_info()
{
	return array(
		'name'			=> 'Bot Scout',
		'description'	=> 'BotScout is a free anti-bot, anti-spam service.',
		'website'		=> 'http://www.botscout.com/',
		'author'		=> 'MrMike',
		'authorsite'	=> 'http://www.botscout.com/',
		'version'		=> '1.0',
	);
}

function botscout_activate()
{
	global $db, $mybb;

}

function botscout_deactivate()
{
	global $mybb, $db;

}

function botscout_validate($datahandler) {
global $mbbb, $db, $user;

$datahandler->set_error('banned_username');
$datahandler->set_error('banned_email');


}

?>

If you need more help just ask.

Regards,
Jammerx2

The botscout_validate() function is what will be called when the user registers, and the data can be accessed through the $user variable (e.g. $user['username']). When I get back I will see about adding the needed code.
Thank you very much! We'd be glad to host a copy of the plugin with appropriate credits to you and myBB.

(2011-03-06, 04:56 PM)Jammerx2 Wrote: [ -> ]The botscout_validate() function is what will be called when the user registers, and the data can be accessed through the $user variable (e.g. $user['username']). When I get back I will see about adding the needed code.

It seems since I was testing it out using banned usernames and emails, it banned my ip. Anyways, this should work, feel free to ask for anything else.

<?php

$plugins->add_hook('datahandler_user_validate', 'botscout_validate');

function botscout_info()
{
	return array(
		'name'			=> 'Bot Scout',
		'description'	=> 'BotScout is a free anti-bot, anti-spam service.',
		'website'		=> 'http://www.botscout.com/',
		'author'		=> 'MrMike',
		'authorsite'	=> 'http://www.botscout.com/',
		'version'		=> '1.0',
	);
}

function botscout_activate()
{
	global $db, $mybb;

	$botscout_group = array(
		"gid"			=> "NULL",
		"name"			=> "botscout",
		"title" =>"Bot Scout Settings",
		"description"	=> "Settings for the Bot Scout plugin.",
		"disporder"		=> "1234567890",
		"isdefault"		=> "no",
	);

	$db->insert_query("settinggroups", $botscout_group);
	$gid = $db->insert_id();

	$botscout_setting = array(
		"sid"			=> "NULL",
		'name'			=> 'botscout_ip',
		'title'			=> 'IP Check',
		'description'	=> 'Check the users IP against the Bot Scout database upon registration.',
		'optionscode'	=> 'yesno',
		'value'			=> '1',
		'disporder'		=> '1',
		'gid'			=> intval($gid),
	);

	$db->insert_query('settings', $botscout_setting);
	
		$botscout_setting = array(
		"sid"			=> "NULL",
		'name'			=> 'botscout_email',
		'title'			=> 'Email Check',
		'description'	=> 'Check the users email against the Bot Scout database upon registration.',
		'optionscode'	=> 'yesno',
		'value'			=> '1',
		'disporder'		=> '1',
		'gid'			=> intval($gid),
	);

	$db->insert_query('settings', $botscout_setting);
	
		$botscout_setting = array(
		"sid"			=> "NULL",
		'name'			=> 'botscout_username',
		'title'			=> 'Username Check',
		'description'	=> 'Check the users username against the Bot Scout database upon registration.',
		'optionscode'	=> 'yesno',
		'value'			=> '1',
		'disporder'		=> '1',
		'gid'			=> intval($gid),
	);

	$db->insert_query('settings', $botscout_setting);
	
	rebuild_settings();
}

function botscout_deactivate()
{
	global $mybb, $db;

	$db->delete_query("settinggroups","name='botscout'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='botscout_ip'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='botscout_email'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='botscout_username'");
}

function botscout_validate($datahandler) {
global $mybb, $db, $user, $lang;

if($mybb->settings['botscout_email'] == 1)
$XMAIL = "&mail=".urlencode($user['email']);
if($mybb->settings['botscout_ip'] == 1)
$XIP = "&ip=".$user['regip'];
if($mybb->settings['botscout_username'] == 1)
$XNAME = "&name=".$user['username'];

$test_string = "http://botscout.com/test/?multi".$XMAIL.$XIP.$XNAME;

if(function_exists('file_get_contents')){
	$data = file_get_contents($test_string);
}else{
	$ch = curl_init($test_string);
	curl_setopt($ch, CURLOPT_HEADER, 0);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	$data = curl_exec($ch);
	curl_close($ch);
}


$botdata = explode('|', $data); 


if(substr($returned_data, 0,1) == '!'){
	$datahandler->set_error("Error: $returned_data");
}

if($botdata[0] == "Y") {
if($botdata['3'] > 0) {
$datahandler->set_error($lang->error_banned);
}
if($botdata['5'] > 0) {
$datahandler->set_error('banned_email');
}
if($botdata['7'] > 0) {
$datahandler->set_error('banned_username');
}
}

}

?>
(2011-03-06, 09:28 PM)Jammerx2 Wrote: [ -> ]It seems since I was testing it out using banned usernames and emails, it banned my ip.

Hmmm, it doesn't normally do that, but in some cases it may (if it sees a string of already-banned emails coming through). If you'll PM me the IPs or emails I'll remove them ASAP.

(2011-03-06, 09:28 PM)Jammerx2 Wrote: [ -> ]Anyways, this should work, feel free to ask for anything else.

Thank you! I'll bundle this up and add it as a download on the BotScout site, with credit to you.



<?php

$plugins->add_hook('datahandler_user_validate', 'botscout_validate');

function botscout_info()
{
	return array(
		'name'			=> 'Bot Scout',
		'description'	=> 'BotScout is a free anti-bot, anti-spam service.',
		'website'		=> 'http://www.botscout.com/',
		'author'		=> 'MrMike',
		'authorsite'	=> 'http://www.botscout.com/',
		'version'		=> '1.0',
	);
}

function botscout_activate()
{
	global $db, $mybb;

	$botscout_group = array(
		"gid"			=> "NULL",
		"name"			=> "botscout",
		"title" =>"Bot Scout Settings",
		"description"	=> "Settings for the Bot Scout plugin.",
		"disporder"		=> "1234567890",
		"isdefault"		=> "no",
	);

	$db->insert_query("settinggroups", $botscout_group);
	$gid = $db->insert_id();

	$botscout_setting = array(
		"sid"			=> "NULL",
		'name'			=> 'botscout_ip',
		'title'			=> 'IP Check',
		'description'	=> 'Check the users IP against the Bot Scout database upon registration.',
		'optionscode'	=> 'yesno',
		'value'			=> '1',
		'disporder'		=> '1',
		'gid'			=> intval($gid),
	);

	$db->insert_query('settings', $botscout_setting);
	
		$botscout_setting = array(
		"sid"			=> "NULL",
		'name'			=> 'botscout_email',
		'title'			=> 'Email Check',
		'description'	=> 'Check the users email against the Bot Scout database upon registration.',
		'optionscode'	=> 'yesno',
		'value'			=> '1',
		'disporder'		=> '1',
		'gid'			=> intval($gid),
	);

	$db->insert_query('settings', $botscout_setting);
	
		$botscout_setting = array(
		"sid"			=> "NULL",
		'name'			=> 'botscout_username',
		'title'			=> 'Username Check',
		'description'	=> 'Check the users username against the Bot Scout database upon registration.',
		'optionscode'	=> 'yesno',
		'value'			=> '1',
		'disporder'		=> '1',
		'gid'			=> intval($gid),
	);

	$db->insert_query('settings', $botscout_setting);
	
	rebuild_settings();
}

function botscout_deactivate()
{
	global $mybb, $db;

	$db->delete_query("settinggroups","name='botscout'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='botscout_ip'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='botscout_email'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='botscout_username'");
}

function botscout_validate($datahandler) {
global $mybb, $db, $user, $lang;

if($mybb->settings['botscout_email'] == 1)
$XMAIL = "&mail=".urlencode($user['email']);
if($mybb->settings['botscout_ip'] == 1)
$XIP = "&ip=".$user['regip'];
if($mybb->settings['botscout_username'] == 1)
$XNAME = "&name=".$user['username'];

$test_string = "http://botscout.com/test/?multi".$XMAIL.$XIP.$XNAME;

if(function_exists('file_get_contents')){
	$data = file_get_contents($test_string);
}else{
	$ch = curl_init($test_string);
	curl_setopt($ch, CURLOPT_HEADER, 0);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	$data = curl_exec($ch);
	curl_close($ch);
}


$botdata = explode('|', $data); 


if(substr($returned_data, 0,1) == '!'){
	$datahandler->set_error("Error: $returned_data");
}

if($botdata[0] == "Y") {
if($botdata['3'] > 0) {
$datahandler->set_error($lang->error_banned);
}
if($botdata['5'] > 0) {
$datahandler->set_error('banned_email');
}
if($botdata['7'] > 0) {
$datahandler->set_error('banned_username');
}
}

}

?>
[/quote]

I can't understand the code, but I have read a few threads about similar plugins. The controls usually allow the admin an on off switch for each of the three values. So, for example, the admin can turn off user name as something to check. The controls also specify the threshold for each type of information. So, for example, the admin can specify that there be 4 complaints on the email address and 6 on the IP address. Or whatever.
Pages: 1 2 3