• I found a way to publish dangerous IP Addresses on my site by creating a post/page with the following php code. With dangerous I mean IP addresses that have many failed login attempts, trying to access my site.

    For this You need a plugin that allows execution of php code within posts.

    My question is how the IP addresses echoed in the table can be clickable and link to an IP Address geolocation service, such as https://whatismyipaddress.com/ip/184.168.193.63#Geolocation-Information (that IP has 4893 failed login attempts on my site!)

    <?php
    echo "<table><tr><td><strong>IP</strong></td><td align=right><strong>No. of Attempts</strong></td><td align=right><strong>Last attempt</strong></td></tr>";
    global $wpdb;
    $result = $wpdb->get_results(
    "
    SELECT ip AS IP, COUNT( ip ) AS  'Failed', MAX(Time) AS Latest
    FROM wp_simple_login_log
    WHERE login_result =  '0'
    GROUP BY ip
    ORDER BY Failed DESC
    Limit 0,20
    "
    
    );
    foreach($result as $row) {
        echo "<tr><td>$row->IP</td><td align=right>$row->Failed</td><td align=right>$row->Latest</td></tr>";
    }
    echo "</table>";
    ?>

    https://www.ads-software.com/extend/plugins/simple-login-log/

Viewing 1 replies (of 1 total)
  • Hi, did you try the option, described in readme? I mean something like the last section of code:

    <?php
    add_filter( 'sll-output-data', 'link_location_by_ip' );
    function link_location_by_ip($item){
    
    	//$item is a single row for columns with their values
    
    	$item['ip'] = sprintf('<a target="_blank"  href="https://infosniper.net/index.php?ip_address=%1$s&map_source=3&two_maps=1&overview_map=1&lang=1&map_type=1&zoom_level=11">%1$s</a>', $item['ip']);
    	return $item;
    }
    ?>

    I belive that in your case should be something like this:

    foreach($result as $row) {
        echo "<tr><td>sprintf('<a target="_blank"  href="https://whatismyipaddress.com/ip/%1$s#Geolocation-Information">%1$s</a>', $row->IP)</td><td align=right>$row->Failed</td><td align=right>$row->Latest</td></tr>";
    }

    But IP should be in text format, like $item = “85.85.85.85”, and not the number 100.100.100.100.

    Actually, I’m more interesting in logging of the failed passwords together with logins as described here. And the time since last attempt, like here. Now I need to have both plugins activated… It would be great if both functionality will be included into the simple-login-log plugin in next release… Please.

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Simple Login Log] show failed logins in a table and link to lookup service’ is closed to new replies.