Just for your information this is not tested code so don't hold it against me but here is a thought on how you may be able to achieve what you are looking for.
After line 220 you could try to do something like this
if ($l =~ /^define\('AUTH_KEY',/) { $l = ""; }
if ($l =~ /^define\('SECURE_AUTH_KEY',/) { $l = ""; }
if ($l =~ /^define\('LOGGED_IN_KEY',/) { $l = ""; }
if ($l =~ /^define\('NONCE_KEY',/) { $l = ""; }
if ($l =~ /^define\('AUTH_SALT',/) { $l = ""; }
if ($l =~ /^define\('SECURE_AUTH_SALT',/) { $l = ""; }
if ($l =~ /^define\('LOGGED_IN_SALT',/) { $l = ""; }
if ($l =~ /^define\('NONCE_SALT',/) {
use LWP::Simple;
my $salt_info = get('http://api.wordpress.org/secret-key/1.1/salt')
or die 'Unable to get salt info';
$l = $salt_info;
}
if ($l =~ /^\$table_prefix/) {
my @chars = ('0'..'9', 'A'..'Z', 'a'..'z');
my $len = 3;
my $wp_random;
while ($len--) {
$wp_random .= $chars[rand @chars];
};
$wp_db_prefix = "wp_" . $wp_random . "_";
$l = "\$table_prefix = '".$wp_db_prefix."';";
}
You could also do something like this to ensure that you may be able to pull information prior to making the changes in a test.pl file and run perl test.pl
#!/usr/bin/perl
print "LWP Version: ". LWP->VERSION;
print "\n\nSalt Info: \n";
use LWP::Simple;
my $salt_info = get('http://api.wordpress.org/secret-key/1.1/salt')
or die 'Unable to get salt info';
print $salt_info;
my @chars = ('0'..'9', 'A'..'Z', 'a'..'z');
my $len = 3;
my $wp_random;
while ($len--) {
$wp_random .= $chars[rand @chars];
};
print "\n\nRandom String: $wp_random \n\n";
My old answer did not consider removing the old values of the salt keys as well as if statement for the table_prefix and rndStr not functioning properly.
if ($l =~ /^define\('DB_COLLATE',/) {
use strict;
use warnings;
use LWP::Simple;
my $salt_info = get('http://api.wordpress.org/secret-key/1.1/salt') or die 'Unable to get salt info';
$l = "('DB_COLLATE', '');\n\n" . $salt_info;
}
if ($l =~ /^\\$table_prefix/) {
$wp_random = rndStr 3, 'a'..'z', 0..9;
$wp_db_prefix = "wp_" . $wp_random . "_";
$l = "\\$table_prefix = '".
$wp_db_prefix."';";
}