Reset Your Joomla Super Admin Password in 5 Seconds


With tried and tested to utter destruction perl script.

Yes, you can, 5 seconds is all it takes !

It’s tried, it tested, (are you feeling sleepy)

Empower yourself, save time and avoid stress

No need to wreck your brain trawling the configuration.php file for the db parameters you need.

No, this script does it all! (are you feeling sleeeeepy)

No money back guarantee

What will it cost you … just a pauper ransom, that’s 00.00 centissime!

Yes, I know I been reading one of those Web marketing books, were you hypnotised, are you feeling sleepy, by my copy. Simply put this perl script derives the database information from the Joomla configuration file – just supply the correct path to the joomla top level directory instance when executing the script.from the command line.

Enter the new password at the prompt and (as Francoise Hardy would say) voila, the password is reset.

The script is verbose so even non perl wizzes/witchees can understand it.

Warning – using the script is at your own risk!

#!/usr/bin/perl

use DBI;

my $jmldir =  $ARGV[0];

if(-e $ARGV[0])
{
  if(-d $ARGV[0]) { $jmldir = "$ARGV[0]"."configuration.php"};
  my %conf_args = {};
  if((-f $jmldir) && open (DATA, "< $jmldir"))
  {
    while( <DATA> )
    {
      chomp $_;
      #([\w]*)to capture all settings
      $m2=m/\$(user|db|password|dbprefix)\s\=.\'([\w]*)\'?/;
      if ($1 && $2) {
        $conf_args{$1} = $2;
      }
    }
    close (DATA);

    my $dbh = DBI->connect("DBI:mysql:$conf_args{'db'}", $conf_args{'user'}, $conf_args{'password'}, {RaiseError=>1})
      or die "Couldn't connect to database: " . DBI->errstr;
    my $jml_tbl = "$conf_args{'dbprefix'}users";

    print "\nEnter new password: ";
    my $name = ;;
    chomp($name);

    my $sql="UPDATE $jml_tbl SET PASSWORD=MD5('$name') WHERE username='admin'";
    my $qu = $dbh->prepare($sql)
      or die "Prepared failed: " . $dbh->errstr;

    $affected = $qu->execute or die 'Execute failed: ' . $dbh->errstr;
    die "$dbh->errstr" if (!affected); # trap errors
    die "No rows updated" if ($affected eq '0E0');

    print "Joomla admin account updated!\n";

    $qu -> finish();
    $dbh->disconnect();
  }
  else
  {
    print "can not open $jmldir!";
  }
}
else
{
  print "$jmldir does not exist!";
}
exit;
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s