Page 1 of 6 123 ... LastLast
Results 1 to 10 of 55
  1. #1
    Join Date
    May 2008
    Posts
    442
    Plugin Contributions
    1

    Default AbuseIPDB Integration module

    I've developed a new module that integrates AbuseIPDB with Zen Cart, and I'm making it available for everyone to use.

    What is AbuseIPDB? It's a community-based project that collects and shares data about abusive IP addresses. By integrating with their API, my module allows you to protect your e-commerce website from potentially harmful visitors by checking the confidence score of their IP address and blocking access if it exceeds a predefined threshold.

    The module also includes several useful features, such as caching to reduce the number of API calls, a test mode for debugging, and logging to monitor blocked IPs. You can also manually whitelist or blacklist IP addresses to have greater control over access to your site.

    I've tested the module and it's ready for use, so if you're interested in trying it out, it's attached: AbuseIPDBO v1.0.0

    If you have any questions or encounter any issues while using the module, please don't hesitate to reach out to me. I hope this module proves useful to you.

    marcopolo
    Last edited by marcopolo; 16 Apr 2023 at 02:16 PM.

  2. #2
    Join Date
    May 2008
    Posts
    442
    Plugin Contributions
    1

    Default Re: AbuseIPDB Integration module

    Here is the module: AbuseIPDBO v1.0.0
    Attached Files Attached Files

  3. #3
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,690
    Plugin Contributions
    9

    Default Re: AbuseIPDB Integration module

    * @author marcopolo & chatgpt
    the horror....
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  4. #4
    Join Date
    May 2008
    Posts
    442
    Plugin Contributions
    1

    Default Re: AbuseIPDB Integration module

    Quote Originally Posted by carlwhat View Post
    the horror....
    It did a good job I think, it is working great. It was done with ChatGPT-4

  5. #5
    Join Date
    Oct 2007
    Location
    Cornwall/Amsterdam
    Posts
    61
    Plugin Contributions
    0

    Default Re: AbuseIPDB Integration module

    Hi @marcopolo

    Got this all set up on my 1.5.6c store, api key works & blocking is working. I am however getting a headers already sent error when using it. My logs folder fills up with every visit & page view, so I’ve had to disable the plugin. Sample debug as follows (with api key removed)

    Code:
    [21-May-2023 18:14:44 Europe/London] Threshold: 50
    [21-May-2023 18:14:44 Europe/London] Cache Time: 3600
    [21-May-2023 18:14:44 Europe/London] Test Mode: false
    [21-May-2023 18:14:44 Europe/London] Test IP: 
    [21-May-2023 18:14:44 Europe/London] Enable Logging: false
    [21-May-2023 18:14:44 Europe/London] Log File Format: abuseipdb_blocked_Y_m.log
    [21-May-2023 18:14:44 Europe/London] Log File Path: logs/
    [21-May-2023 18:14:44 Europe/London] Whitelisted IPs: 
    [21-May-2023 18:14:44 Europe/London] Blocked IPs: 
    [21-May-2023 18:14:44 Europe/London] Checking cache for IP: 54.236.1.13
    [21-May-2023 18:14:45 Europe/London] API call made for IP: 54.236.1.13 with score: 68
    [21-May-2023 18:14:45 Europe/London] IP 54.236.1.13 blocked from API call
    [21-May-2023 18:14:45 Europe/London] Request URI: /queen-crown-badge-p-712.html, IP address: 54.236.1.13
    #1  header() called at [/home/brucebli/public_html/koolbadges.co.uk/includes/classes/observers/class.abuseipdb_observer.php:137]
    #2  abuseipdb_observer->checkAbusiveIP() called at [/home/brucebli/public_html/koolbadges.co.uk/includes/classes/observers/class.abuseipdb_observer.php:19]
    #3  abuseipdb_observer->update() called at [/home/brucebli/public_html/koolbadges.co.uk/includes/classes/class.base.php:103]
    #4  base->notify() called at [/home/brucebli/public_html/koolbadges.co.uk/includes/templates/responsive_avonlee_contempo/common/tpl_header.php:4]
    #5  require(/home/brucebli/public_html/koolbadges.co.uk/includes/templates/responsive_avonlee_contempo/common/tpl_header.php) called at [/home/brucebli/public_html/koolbadges.co.uk/includes/templates/responsive_avonlee_contempo/common/tpl_main_page.php:106]
    #6  require(/home/brucebli/public_html/koolbadges.co.uk/includes/templates/responsive_avonlee_contempo/common/tpl_main_page.php) called at [/home/brucebli/public_html/koolbadges.co.uk/index.php:97]
    --> PHP Warning: Cannot modify header information - headers already sent by (output started at /home/brucebli/public_html/koolbadges.co.uk/includes/templates/responsive_avonlee_contempo/jscript/jscript_framework.php:17) in /home/brucebli/public_html/koolbadges.co.uk/includes/classes/observers/class.abuseipdb_observer.php on line 137.

  6. #6
    Join Date
    May 2008
    Posts
    442
    Plugin Contributions
    1

    Default Re: AbuseIPDB Integration module

    This is a common PHP error that usually happens when you attempt to send a HTTP header after some output has already been sent to the browser.

    In this case, the output has been started at file jscript_framework.php on line 17, which is preventing the header modification in class.abuseipdb_observer.php on line 137.

    The issue lies in the sequence of operations where some content was output before the headers could be completely set. This could be due to:

    Printing some text or HTML before calling a header function.
    A PHP or HTML file which has whitespace or an empty line before the opening PHP tag (<?php) or after the closing PHP tag (?>), if used.
    A UTF-8 Byte Order Mark (BOM) at the beginning of one of the files.
    Using echo, print, printf, or die functions before setting headers.
    To fix this issue, check the file /home/brucebli/public_html/koolbadges.co.uk/includes/templates/responsive_avonlee_contempo/jscript/jscript_framework.php specifically at line 17 and make sure there's no output before the headers are set in the file class.abuseipdb_observer.php.

    If this doesn't solve your problem, consider using output buffering by placing ob_start(); at the beginning of your PHP script. This function will turn output buffering on. While output buffering is active no output is sent from the script (other than headers), instead the output is stored in an internal buffer. You can then use ob_end_flush(); or ob_end_clean(); at the end of the script to send output and turn off output buffering. However, it's better to solve the actual problem of why output is being sent too early, if possible.

  7. #7
    Join Date
    May 2008
    Posts
    442
    Plugin Contributions
    1

    Default Re: AbuseIPDB Integration module

    Let me know what module is using the file: jscript_framework.php as it is not part of this modules files, if you can upload the file here so I can take a look at the code and see what it is doing.

  8. #8
    Join Date
    Oct 2007
    Location
    Cornwall/Amsterdam
    Posts
    61
    Plugin Contributions
    0

    Default Re: AbuseIPDB Integration module

    The file itself is by lat9 - I personally can't remember which plugin it came from, but I think it might be something to do with the responsive avonlee contempo modified themed I'm running.

    File contents as follows

    Code:
    <?php
    /**
     * @package admin
     * @copyright Copyright 2003-2017 Zen Cart Development Team
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: Author: zcwilt  lat9 Modified in v1.5.6 $
     */
    ?>
    <script type="text/javascript"><!--//<![CDATA[
    if (typeof zcJS == "undefined" || !zcJS) {
      window.zcJS = { name: 'zcJS', version: '0.1.0.0' };
    };
    
    zcJS.ajax = function (options) {
      options.url = options.url.replace("&amp;", unescape("&amp;"));
      var deferred = jQuery.Deferred(function (d) {
          var securityToken = '<?php echo $_SESSION['securityToken']; ?>';
          var defaults = {
              cache: false,
              type: 'POST',
              traditional: true,
              dataType: 'json',
              timeout: 5000,
              data: jQuery.extend(true,{
                securityToken: securityToken
            }, options.data)
          },
          settings = jQuery.extend(true, {}, defaults, options);
          if (typeof(console.log) == 'function') {
              console.log( settings );
          }
    
          d.done(settings.success);
          d.fail(settings.error);
          d.done(settings.complete);
          var jqXHRSettings = jQuery.extend(true, {}, settings, {
              success: function (response, textStatus, jqXHR) {
                d.resolve(response, textStatus, jqXHR);
              },
              error: function (jqXHR, textStatus, errorThrown) {
                  if (window.console) {
                    if (typeof(console.log) == 'function') {
                      console.log(jqXHR);
                    }
                  }
                  d.reject(jqXHR, textStatus, errorThrown);
              },
              complete: d.resolve
          });
          jQuery.ajax(jqXHRSettings);
       }).fail(function(jqXHR, textStatus, errorThrown) {
       var response = jqXHR.getResponseHeader('status');
       var responseHtml = jqXHR.responseText;
       var contentType = jqXHR.getResponseHeader("content-type");
       switch (response)
         {
           case '403 Forbidden':
             var jsonResponse = JSON.parse(jqXHR.responseText);
             var errorType = jsonResponse.errorType;
             switch (errorType)
             {
               case 'ADMIN_BLOCK_WARNING':
               break;
               case 'AUTH_ERROR':
               break;
               case 'SECURITY_TOKEN':
               break;
    
               default:
                 alert('An Internal Error of type '+errorType+' was received while processing an ajax call. The action you requested could not be completed.');
             }
           break;
           default:
            if (jqXHR.status === 200) {
                if (contentType.toLowerCase().indexOf("text/html") >= 0) {
                    document.open();
                    document.write(responseHtml);
                    document.close();
                }
             }
         }
       });
    
      var promise = deferred.promise();
      return promise;
    };
    zcJS.timer = function (options) {
      var defaults = {
        interval: 10000,
        startEvent: null,
        intervalEvent: null,
        stopEvent: null
    
    },
      settings = jQuery.extend(true, {}, defaults, options);
    
      var enabled = new Boolean(false);
      var timerId = 0;
      var mySelf;
      this.Start = function()
      {
          this.enabled = new Boolean(true);
    
          mySelf = this;
          mySelf.settings = settings;
          if (mySelf.enabled)
          {
              mySelf.timerId = setInterval(
              function()
              {
                  if (mySelf.settings.intervalEvent)
                  {
                    mySelf.settings.intervalEvent(mySelf);
                  }
              }, mySelf.settings.interval);
              if (mySelf.settings.startEvent)
              {
                mySelf.settings.startEvent(mySelf);
              }
          }
      };
      this.Stop = function()
      {
        mySelf.enabled = new Boolean(false);
        clearInterval(mySelf.timerId);
        if (mySelf.settings.stopEvent)
        {
          mySelf.settings.stopEvent(mySelf);
        }
      };
    };
    
    //]] --></script>

  9. #9
    Join Date
    May 2008
    Posts
    442
    Plugin Contributions
    1

    Default Re: AbuseIPDB Integration module

    I'm not sure why your receiving that error, try this file in place of the one your using now and see if it resolves the issue, see attached AbuseIPDBO_custom_file.zip
    Attached Files Attached Files

  10. #10
    Join Date
    Oct 2007
    Location
    Cornwall/Amsterdam
    Posts
    61
    Plugin Contributions
    0

    Default Re: AbuseIPDB Integration module

    Thanks marcopolo

    With that updated file I still get the headers already sent error

    Code:
    [21-May-2023 21:19:03 Europe/London] Request URI: /teal-heart-boss-bridesmaid-badge-p-6746.html, IP address: 54.236.1.13
    #1  header() called at [/home/brucebli/public_html/koolbadges.co.uk/includes/classes/observers/class.abuseipdb_observer.php:144]
    #2  abuseipdb_observer->checkAbusiveIP() called at [/home/brucebli/public_html/koolbadges.co.uk/includes/classes/observers/class.abuseipdb_observer.php:19]
    #3  abuseipdb_observer->update() called at [/home/brucebli/public_html/koolbadges.co.uk/includes/classes/class.base.php:103]
    #4  base->notify() called at [/home/brucebli/public_html/koolbadges.co.uk/includes/templates/responsive_avonlee_contempo/common/tpl_header.php:4]
    #5  require(/home/brucebli/public_html/koolbadges.co.uk/includes/templates/responsive_avonlee_contempo/common/tpl_header.php) called at [/home/brucebli/public_html/koolbadges.co.uk/includes/templates/responsive_avonlee_contempo/common/tpl_main_page.php:106]
    #6  require(/home/brucebli/public_html/koolbadges.co.uk/includes/templates/responsive_avonlee_contempo/common/tpl_main_page.php) called at [/home/brucebli/public_html/koolbadges.co.uk/index.php:97]
    --> PHP Warning: Cannot modify header information - headers already sent by (output started at /home/brucebli/public_html/koolbadges.co.uk/includes/templates/responsive_avonlee_contempo/jscript/jscript_framework.php:17) in /home/brucebli/public_html/koolbadges.co.uk/includes/classes/observers/class.abuseipdb_observer.php on line 144.

 

 
Page 1 of 6 123 ... LastLast

Similar Threads

  1. AbuseIPDB integration?
    By marcopolo in forum General Questions
    Replies: 3
    Last Post: 4 May 2022, 06:31 PM
  2. v155 Full Ebay Integration Module
    By Wilkesy in forum All Other Contributions/Addons
    Replies: 9
    Last Post: 19 Jun 2020, 03:29 AM
  3. v156 PayCertify Payment Integration Module
    By PayCertify in forum Addon Payment Modules
    Replies: 1
    Last Post: 1 May 2019, 11:29 PM
  4. Mailchimp Module Integration
    By hamid380 in forum Addon Sideboxes
    Replies: 5
    Last Post: 7 Sep 2011, 01:11 PM
  5. Custom Shipping Module Integration
    By youderian in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 22 Dec 2008, 05:59 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR