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

Want a Google Reader equivalent, then check out Tiny Tiny RSS 1.2.12

When I firsted looked at the this application, I thought it was going to look ugly and have no functionallity. I mean after looking at Google Reader and using it for some time, it really was another good Google Application. And it was made to make it easy to read and sort RSS feeds. One look at the demo, and I was hooked. It has some common features that Google Reader does, starred items and labels. I just wonder if you can plop and authentication/user account creation on it so that you can offer your own branded reader similar to Googles. TinyTiny RSS 1.2.12 Demo!
Tiny Tiny RSS 1.2.12 (Default branch) - Screenshot Tiny Tiny RSS is a Web-based news (RSS, RDF, or Atom) feed aggregator designed to allow you to read news from any location, while feeling as close to a real desktop application as possible.
License: GNU General Public License (GPL)
Changes:
This release fixes reported bugs, adds the zh_CN translation, and adds various minor improvements.

[FreshMeat]
Read More

SueTube: sex, copyright, and rock & roll

Give this a gander. All of the current lawsuits against YouTube/Google, when they started taking down videos of Russel Peters and other popular shows. I cried.
SueTube: sex, copyright, and rock & roll -

Since its launch, YouTube has been a magnet for controversy. Ars looks at the popular video site's history of threats, lawsuits, and bans with an eye towards understanding what the landscape will look like once the dust settles.

Read More...

[Ars Technica]
Read More

iriver’s UNIT2 detailed on teaser site

One of the sexist and functional MP3 devices I've seen yet. The iPod had its time, and even the smallest iPod is really sexy. But this is just over the top.
iriver's UNIT2 detailed on teaser site -

Filed under: , ,


Mmm, there's nothing like fragmented high-resolution photos of a lust-worthy device to get us salivating, and iriver's marketing department has done an exquisite job figuring that out. Shortly after unveiling the sexiest e-dictionary known to man, the much anticipated UNIT2 conglomerate received its own teaser site, complete with photos and a few extra details you should know. While it has yet to lose its mystique, we now know (officially, at least) that the base will act as a DVD player, TV tuner, access point, charging station, hard drive, and a speaker station. Aside from sporting an SD slot and USB connectivity, this beauty will handle music, movies, photos, eBooks, and WiFi streaming without breaking a sweat. Mechanically, you can expect an automatic sliding door, detachable display, slot-loaded CD / DVD deck, and a 78-key controller to manage the fun. No word yet on the price, but be sure to peek the additional photos below.

 

Read | Permalink | Email this | Comments


Office Depot Featured Gadget: Xbox 360 Platinum System Packs the power to bring games to life!

[EnGadget]
Read More