TPU: Detect and Block Spam Registrations

TPU: Detect and Block Spam Registrations 1.6.6

No permission to download
If you proxy IPv6 via Cloudflare and your server has no IPv6, then your server should receive a connection from an IPv4 IP instead, which is probably one of Cloudflare's servers?
It was passing an client's IPv6 address to php and php was blindly using that to connect via IPv4 to some where utterly random.

The 2nd time was socket_connect failing instantly with a no-route-to-host which set socket_last_error but not socket_get_option into an error state.
 
Last edited:
It was passing an client's IPv6 address to php and php was blindly using that to connect via IPv4 to some where utterly random.

The 2nd time was socket_connect failing instantly with a no-route-to-host which set socket_last_error but not socket_get_option into an error state.
if that was in my port scanning test, then that should be fixed with the latest version
 
Latest update causes server errors

ErrorException: Undefined variable: ip - library/TPUDetectSpamReg/HoneyPot.php:12
Generated By: Unknown Account, Today at 11:55 AM
 
Latest update causes server errors

ErrorException: Undefined variable: ip - library/TPUDetectSpamReg/HoneyPot.php:12
Generated By: Unknown Account, Today at 11:55 AM
Grab the 1.3 update, I forgot to bump the version number in the last release
 
  • Like
Reactions: Xon
An error appears in server error log, if someone register through facebook. Enabling Captcha is the most recent thing i did.

Though registration is working. At the end of registration this page loads http://computerhelpforums.net/register/facebook/register

User see this error: A server error occurred. Please try again later.

At the same time an error is logged in admin cp. Here are details

XenForo_Exception: Cannot load class using XFCP. Load the class using the correct loader first. - library/XenForo/Autoloader.php:108
Generated By: testing231, 7 minutes ago

Stack Trace

#0 [internal function]: XenForo_Autoloader->autoload('XFCP_TPUDetectS...')
#1 /home/compute7/public_html/library/TPUDetectSpamReg/ModelSpamPrevention.php(4): spl_autoload_call('XFCP_TPUDetectS...')
#2 /home/compute7/public_html/library/XenForo/Autoloader.php(119): include('/home/compute7/...')
#3 [internal function]: XenForo_Autoloader->autoload('TPUDetectSpamRe...')
#4 /home/compute7/public_html/library/TPUDetectSpamReg/ControllerPublicRegister.php(9): spl_autoload_call('TPUDetectSpamRe...')
#5 /home/compute7/public_html/library/XenForo/ControllerPublic/Register.php(602): TPUDetectSpamReg_ControllerPublicRegister->_completeRegistration(Array, Array)
#6 /home/compute7/public_html/library/NRE/ControllerPublic/Register.php(334): XenForo_ControllerPublic_Register->actionFacebookRegister()
#7 /home/compute7/public_html/library/XenForo/FrontController.php(347): NRE_ControllerPublic_Register->actionFacebookRegister()
#8 /home/compute7/public_html/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#9 /home/compute7/public_html/index.php(13): XenForo_FrontController->run()
#10 {main}

Request State

array(3) {
["url"] => string(56) "http://computerhelpforums.net/register/facebook/register"
["_GET"] => array(0) {
}
["_POST"] => array(13) {
["username"] => string(10) "testing231"
["dob_month"] => string(1) "5"
["dob_day"] => string(2) "12"
["dob_year"] => string(4) "1982"
["custom_fields"] => array(3) {
["vb7"] => string(1) "0"
["vb9"] => string(1) "0"
["vb12"] => string(1) "0"
}
["custom_fields_shown"] => array(3) {
[0] => string(3) "vb7"
[1] => string(3) "vb9"
[2] => string(4) "vb12"
}
["timezone"] => string(13) "Asia/Tashkent"
["agree"] => string(1) "1"
["associate_login"] => string(0) ""
["associate_password"] => string(8) "********"
["_xfToken"] => string(8) "********"
["redirect"] => string(30) "http://computerhelpforums.net/"
["fb_token"] => string(0) ""
}
}
 
I've been getting the following error occasionally, it looks like the return structure of http://ip-api.com/ has changed.

Code:
ErrorException: Undefined property: stdClass::$countryCode - library/TPUDetectSpamReg/IPCountry.php:18
Generated By: Unknown Account, 14 minutes ago
Stack Trace
#0 /var/www/html/library/TPUDetectSpamReg/IPCountry.php(18): XenForo_Application::handlePhpError(8, 'Undefined prope...', '/var/www/sites/...', 18, Array)
#1 /var/www/html/library/TPUDetectSpamReg/IPCountry.php(38): TPUDetectSpamReg_IPCountry::getIPCountry('2003:6b:836:a20...')
#2 [internal function]: TPUDetectSpamReg_IPCountry::getRegSpamScore(Array, Array, '1', '0', Object(TPUDetectSpamReg_ModelSpamPrevention))
#3 /var/www/html/library/XenForo/CodeEvent.php(90): call_user_func_array(Array, Array)
#4 /var/www/sites/forums.spacebattles.com/html/library/TPUDetectSpamReg/ModelSpamPrevention.php(67): XenForo_CodeEvent::fire('tpu_detect_spam...', Array)
#5 /var/www/html/library/XenForo/ControllerPublic/Register.php(1394): TPUDetectSpamReg_ModelSpamPrevention->allowRegistration(Array, Object(Zend_Controller_Request_Http))
#6 /var/www/html/library/XenForo/ControllerPublic/Register.php(389): XenForo_ControllerPublic_Register->_runSpamCheck(Object(bdTagMe_XenForo_DataWriter_User), Array)
#7 /var/www/html/library/XenForo/FrontController.php(347): XenForo_ControllerPublic_Register->actionRegister()
#8 /var/www/html/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#9 /var/www/html/index.php(13): XenForo_FrontController->run()
#10 {main}

I'm using the following to supress the error, replacing;
PHP:
  $country=json_decode(file_get_contents('http://ip-api.com/json/'.$ip));
  if ($country->countryCode!='')
  return $country->countryCode;
With:
PHP:
  $country=json_decode(file_get_contents('http://ip-api.com/json/'.$ip));
  if (isset($country) && isset($country->countryCode) && $country->countryCode!='')
  return $country->countryCode;
 
This looks great! Installed, and thank you.

Question, can I setup a rule to reject all registrations from anywhere but North America? Such as +6|* and -6|US, -6|CA, -6|MX?
 
Right after I posted a support thread on here because I was getting annoying user registered spammers from PTCL (Pakistani ISP), I saw this addon and instantly installed it. I made sure to put PTCL as +6 in auto reject with the full ISP name and country. Hopefully this will stop them from registering. Thank you for this.
 
Right after I posted a support thread on here because I was getting annoying user registered spammers from PTCL (Pakistani ISP), I saw this addon and instantly installed it. I made sure to put PTCL as +6 in auto reject with the full ISP name and country. Hopefully this will stop them from registering. Thank you for this.

I've had the same exact issue, tons of human spam from Pakistan.
 
Receiving this error:

ErrorException: Undefined property: stdClass::$countryCode - library/TPUDetectSpamReg/IPCountry.php:18
Generated By: Unknown Account, Today at 2:18 AM

Request State:
Code:
array(3) {
["url"] => string(53) "http://www.forumurl.com/index.php?register/register"
["_GET"] => array(1) {
["register/register"] => string(0) ""
}
["_POST"] => array(15) {
["username"] => string(0) ""
["67d57e7601e22b14279d7c4624dbfe70"] => string(7) "KailanB"
["ec7a2e5a25054cd68d163b72d6ec6b41"] => string(0) ""
["3b639e2f3342757483219dc61156e4b4"] => string(25) "kaila*******14@gmail.com"
["88a65466119b6621120ba9a10a115c51"] => string(4) "male"
["dob_month"] => string(2) "10"
["dob_day"] => string(1) "2"
["dob_year"] => string(4) "1997"
["a3378517d688e90591e861234cef085d"] => array(2) {
["awdu"] => string(0) ""
["ign"] => string(10) "Ch3rryBomx"
}
["custom_fields_shown"] => array(2) {
[0] => string(4) "awdu"
[1] => string(3) "ign"
}
["6c0456f9ddba0a90668f22466a4400fd"] => string(15) "America/Chicago"
["session_secret"] => string(45) "VkGCJnZ8XfLsixmGqKOrCGBPPKv277kZvvpG7dQHQmj4x"
["agree"] => string(1) "1"
["_xfToken"] => string(8) "********"
["reg_key"] => string(32) "0418bc22adf299ec8dd99c71ec96e68e"
}
}

Stack Trace:
Code:
#0 /public_html/library/TPUDetectSpamReg/IPCountry.php(18): XenForo_Application::handlePhpError(8, 'Undefined prope...', '/public_html...', 18, Array)
#1 /public_html/library/TPUDetectSpamReg/IPCountry.php(38): TPUDetectSpamReg_IPCountry::getIPCountry('2601:d:c800:a6c...')
#2 [internal function]: TPUDetectSpamReg_IPCountry::getRegSpamScore(Array, Array, '1', '0', Object(TPUDetectSpamReg_ModelSpamPrevention))
#3 /public_html/library/XenForo/CodeEvent.php(90): call_user_func_array(Array, Array)
#4 /public_html/library/TPUDetectSpamReg/ModelSpamPrevention.php(67): XenForo_CodeEvent::fire('tpu_detect_spam...', Array)
#5 /public_html/library/XenForo/ControllerPublic/Register.php(1394): TPUDetectSpamReg_ModelSpamPrevention->allowRegistration(Array, Object(Zend_Controller_Request_Http))
#6 /public_html/html/library/XenForo/ControllerPublic/Register.php(389): XenForo_ControllerPublic_Register->_runSpamCheck(Object(Andy_NewUserConversation_DataWriter_User), Array)
#7 /public_html/html/library/Andy/NewUserConversation/ControllerPublic/Register.php(16): XenForo_ControllerPublic_Register->actionRegister()
#8 /public_html/html/library/XenForo/FrontController.php(347): Andy_NewUserConversation_ControllerPublic_Register->actionRegister()
#9 /public_html/html/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#10 /public_html/index.php(13): XenForo_FrontController->run()
#11 {main}

Yes, the IP is an IPv6 address.
 
Top Bottom