Remove iThemes Security Lockouts Script

I decided to create a command line PHP script that would list the current iThemes Security Logs and also allow you to remove them based on IP Address. Here is the script which I’ve called “ithemes-clearip.php” and it’s Github link, its dirty and really was made in like 15 minutes.

https://github.com/jordantrizz/wordpress-scripts

<?
// List and remove iThemes Security Log entries based on IP Address
// Options
$shortopts ="d:";
$shortopts .="l";
$options = getopt($shortopts);
//Database Connect
require_once("wp-config.php");
$link = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
$database_name = DB_NAME;
if ($conn->connect_error) {
  die("Cant connect to database using wp-config.php details - Connection failed: " . $conn->connect_error);
}
if(!$options) {
  print "There was a problem reading in the options.\n\n";
  exit(1);
}
if(array_key_exists("d",$options)) {
  $ip = $options["d"];
  if(filter_var($ip, FILTER_VALIDATE_IP)){
    echo "Deleting all entries for IP Address ". $options["d"] ." in $database_name\n\n";
    $sql="delete from ".$database_name.".wp_itsec_log where log_host = \"".$ip."\"\n\n";
    echo $sql;
    if($link->query($sql) === TRUE) {
      echo "Deleted ". mysqli_affected_rows($link)." rows\n\n";
    } else {
      echo "Error deleting record: " . $conn->error;
    }
  } else {
    print "You didn't specify a correct IP Address.\n\n";
    exit(1);
  }
} elseif(empty($options["l"])) {
  $sql = 'SELECT log_host,log_date from wp_itsec_log';
  $result = $link->query($sql) or die(mysql_error());
  if (!$result) {
    print 'Could not run query: ' . mysql_error();
    exit;
  }
  print "\nLog Host\tLog Date";
  print "\n-----------------------------------";
  while($row = mysqli_fetch_row($result)) {
    print "\n".$row['0']."\t".$row['1'];
  }
  print "\n";
  mysqli_close($link);
}
?>

 

 


Did you like this article?


0 Shares:
You May Also Like

Apple Releases iPhone Firmware 2.1 and iTunes 8

Apple has just released iTunes 8 and the iTouch and iPhone firmware 2.1! You will need to download iTunes 8 in order to get the new firmware. And unfortunately it looks as though iTunes 8 has blocked the Pwnge tool. However the iphone-dev team knows about this and will have a patch http://blog.iphone-dev.org/post/49689803/countermeasures Enjoy!
Read More

Exim4 and PHP and PHP-CGI mail() function using incorrect From: and applying Sender: headers.

If you're using Exim4 and PHP as a module or as a CGI with suexec. You may have noticed some issues with your mail. Specifically you would have noticed that either the "From:" header was using "nobody@machinename" or "user@machine name, its also possibly that you had an additional header called "Sender:". There are two things you need to do to fix this. You first need to make sure that your "php.ini" has the following value "sendmail_path = /usr/sbin/sendmail -t -i". Which is the default, double check this variable as it might be set to something else.
Read More

Western Digital developing 20,000RPM drives

That's right, this isn't a joke.
The new drive will be very similar to the recently-released VelociRaptor, in that it’ll be a 2.5in drive with a custom 3.5in housing built around it. Details are incredibly light at this stage, given that the product is still in development, and we don’t even have a release timeframe at the moment. However, our sources said that the drive will be ‘silent’ – that’s the last thing I would have expected from a drive with platters spinning at 20,000 RPM. Western Digital is apparently working on silencing the beast by improving the housing technology, which will now not just act as a heatsink, but also as a noise cancelling device. We’d also hope that the drive enclosure has some vibration dampening technology as well, because that’s also likely to be a problem given the high spindle speeds.
Now they just need push SATA 6.0Gbit/s onto motherboards http://en.wikipedia.org/wiki/SATA#SATA_6.0_Gbit.2Fs Full artile at bit-tech.net
Read More

Apples iPhone Firmware 2.0.2 Causes More Issues Than It Fixes

I just saw this article on Slashdot... Slashdot | Apple's IPhone 3G Firmware Update Bombs Yahoo posted the news article... Apple's iPhone 3G Firmware Update Bombs (NewsFactor) by NewsFactor: Yahoo! Tech Both articles comment on the 2.0.1 firmware. However if you read the original article, it speaks about the new firmware which is 2.0.2 and was released on the 18th. NewsFactor Network | Apple Reportedly Plans Another Fix for the iPhone Either way, I don't have problems with my phone aside from MobileChat crashing and other Applications as well.
Read More

A list of changes and fixes in the iPhone 2.1 Firmware

There is a full list of changes and fixes in the new iPhone 2.1 firware on Apples site, which you can read here: http://www.apple.com/iphone/softwareupdate/ I've also included them below:
General Updates * Decrease in call set-up failures and dropped calls. * Significantly better battery life for most users. * Dramatically reduced time to backup to iTunes. * Improved email reliability, notably fetching email from POP and Exchange accounts. * Faster installation of 3rd party applications.
Read More