Automatic WordPress security: local firewall, malware and file-integrity scanning, vulnerability protection, quarantine, scheduled backups, an optional page cache, and automatic global threat intelligence. See README.md for installation, update, and uninstall instructions.
157 lines
7.9 KiB
PHP
157 lines
7.9 KiB
PHP
<?php
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit;
|
|
}
|
|
|
|
$argus_active_page = 'quarantine';
|
|
include ARGUS_WPD_DIR . 'admin/views/partials/header.php';
|
|
|
|
$status_labels = array(
|
|
Argus_Quarantine::STATUS_QUARANTINED => __( 'Quarantined', 'argus-wordpress-defence' ),
|
|
Argus_Quarantine::STATUS_RESTORED => __( 'Restored', 'argus-wordpress-defence' ),
|
|
Argus_Quarantine::STATUS_DELETED => __( 'Deleted', 'argus-wordpress-defence' ),
|
|
);
|
|
?>
|
|
|
|
<h1 class="argus-wpd-page-title"><?php esc_html_e( 'Quarantine', 'argus-wordpress-defence' ); ?></h1>
|
|
<p style="color:var(--muted);font-size:13px;margin:0 0 24px;">
|
|
<?php
|
|
echo $review_count > 0
|
|
? esc_html( sprintf( _n( '%d item requires review.', '%d items require review.', $review_count, 'argus-wordpress-defence' ), $review_count ) )
|
|
: esc_html__( 'No items currently require review.', 'argus-wordpress-defence' );
|
|
?>
|
|
</p>
|
|
|
|
<?php if ( ! empty( $notice ) ) : ?>
|
|
<div class="notice notice-<?php echo esc_attr( $notice_type ); ?>" style="padding:14px 18px;margin:0 0 20px;"><p style="margin:0"><?php echo esc_html( $notice ); ?></p></div>
|
|
<?php endif; ?>
|
|
|
|
<div class="argus-wpd-grid">
|
|
<div class="argus-wpd-metric-card">
|
|
<div class="argus-wpd-metric-label"><?php esc_html_e( 'Currently Quarantined', 'argus-wordpress-defence' ); ?></div>
|
|
<div class="argus-wpd-metric-value"><?php echo esc_html( number_format_i18n( $status_counts[ Argus_Quarantine::STATUS_QUARANTINED ] ) ); ?></div>
|
|
</div>
|
|
<div class="argus-wpd-metric-card">
|
|
<div class="argus-wpd-metric-label"><?php esc_html_e( 'Restored', 'argus-wordpress-defence' ); ?></div>
|
|
<div class="argus-wpd-metric-value"><?php echo esc_html( number_format_i18n( $status_counts[ Argus_Quarantine::STATUS_RESTORED ] ) ); ?></div>
|
|
</div>
|
|
<div class="argus-wpd-metric-card">
|
|
<div class="argus-wpd-metric-label"><?php esc_html_e( 'Deleted', 'argus-wordpress-defence' ); ?></div>
|
|
<div class="argus-wpd-metric-value"><?php echo esc_html( number_format_i18n( $status_counts[ Argus_Quarantine::STATUS_DELETED ] ) ); ?></div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php if ( $legacy_count > 0 ) : ?>
|
|
<div class="notice notice-warning" style="padding:14px 18px;margin:0 0 20px;">
|
|
<p style="margin:0">
|
|
<?php
|
|
echo esc_html(
|
|
sprintf(
|
|
|
|
_n(
|
|
'%d file quarantined by an earlier version of ARGUS exists outside this page\'s tracked store (left in place, not migrated). It is not executable but is not listed below.',
|
|
'%d files quarantined by an earlier version of ARGUS exist outside this page\'s tracked store (left in place, not migrated). They are not executable but are not listed below.',
|
|
$legacy_count,
|
|
'argus-wordpress-defence'
|
|
),
|
|
$legacy_count
|
|
)
|
|
);
|
|
?>
|
|
</p>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div style="display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:10px;margin-bottom:20px;">
|
|
<div class="argus-wpd-range-tabs">
|
|
<?php foreach ( $status_labels as $key => $label ) : ?>
|
|
<a href="<?php echo esc_url( add_query_arg( array( 'status' => $key, 'paged' => false ) ) ); ?>" class="<?php echo $key === $status_filter ? 'active' : ''; ?>"><?php echo esc_html( $label ); ?></a>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<div class="argus-wpd-range-tabs">
|
|
<?php foreach ( array( 10, 25, 50 ) as $size ) : ?>
|
|
<a href="<?php echo esc_url( add_query_arg( array( 'per_page' => $size, 'paged' => false ) ) ); ?>" class="<?php echo $size === $per_page ? 'active' : ''; ?>"><?php echo esc_html( $size ); ?></a>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<?php if ( empty( $items ) ) : ?>
|
|
<div class="argus-wpd-panel"><p class="argus-wpd-empty"><?php esc_html_e( 'Nothing here.', 'argus-wordpress-defence' ); ?></p></div>
|
|
<?php else : ?>
|
|
<div class="argus-wpd-finding-list">
|
|
<?php foreach ( $items as $item ) : ?>
|
|
<div class="argus-wpd-finding-card argus-wpd-sev-<?php echo esc_attr( $item->severity ); ?>">
|
|
<div class="argus-wpd-finding-summary">
|
|
<span class="argus-wpd-sev-badge"><?php echo esc_html( strtoupper( $item->severity ) ); ?></span>
|
|
<span class="argus-wpd-finding-title"><?php echo esc_html( $item->original_path ); ?></span>
|
|
<span class="argus-wpd-status-pill argus-wpd-status-<?php echo esc_attr( $item->status ); ?>"><?php echo esc_html( $status_labels[ $item->status ] ?? ucfirst( $item->status ) ); ?></span>
|
|
<span class="argus-wpd-finding-time"><?php echo esc_html( human_time_diff( strtotime( $item->quarantined_at . ' UTC' ) ) ); ?> <?php esc_html_e( 'ago', 'argus-wordpress-defence' ); ?></span>
|
|
</div>
|
|
|
|
<?php if ( Argus_Quarantine::STATUS_QUARANTINED === $item->status ) : ?>
|
|
<div class="argus-wpd-finding-actions">
|
|
<form method="post" style="display:inline">
|
|
<?php wp_nonce_field( 'argus_wpd_quarantine_analyse_' . $item->id, 'argus_wpd_quarantine_analyse_nonce' ); ?>
|
|
<input type="hidden" name="quarantine_id" value="<?php echo esc_attr( $item->id ); ?>" />
|
|
<button type="submit" class="button"><?php esc_html_e( 'Analyse', 'argus-wordpress-defence' ); ?></button>
|
|
</form>
|
|
<form method="post" style="display:inline">
|
|
<?php wp_nonce_field( 'argus_wpd_quarantine_restore_' . $item->id, 'argus_wpd_quarantine_restore_nonce' ); ?>
|
|
<input type="hidden" name="quarantine_id" value="<?php echo esc_attr( $item->id ); ?>" />
|
|
<button type="submit" class="button" onclick="return confirm('<?php echo esc_js( __( 'Restore this file? ARGUS will re-verify its content first and refuse if it still looks malicious.', 'argus-wordpress-defence' ) ); ?>')"><?php esc_html_e( 'Restore', 'argus-wordpress-defence' ); ?></button>
|
|
</form>
|
|
<form method="post" style="display:inline">
|
|
<?php wp_nonce_field( 'argus_wpd_quarantine_delete_' . $item->id, 'argus_wpd_quarantine_delete_nonce' ); ?>
|
|
<input type="hidden" name="quarantine_id" value="<?php echo esc_attr( $item->id ); ?>" />
|
|
<button type="submit" class="button" style="color:var(--rose);border-color:rgba(230,103,103,.4);" onclick="return confirm('<?php echo esc_js( __( 'Delete permanently? This file will be permanently removed and cannot be recovered from ARGUS Quarantine.', 'argus-wordpress-defence' ) ); ?>')"><?php esc_html_e( 'Delete Permanently', 'argus-wordpress-defence' ); ?></button>
|
|
</form>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<details class="argus-wpd-finding-details">
|
|
<summary><?php esc_html_e( 'Inspect', 'argus-wordpress-defence' ); ?></summary>
|
|
<dl class="argus-explain">
|
|
<dt><?php esc_html_e( 'Detection Engine', 'argus-wordpress-defence' ); ?></dt>
|
|
<dd><?php echo esc_html( $item->detection_engine ); ?></dd>
|
|
<dt><?php esc_html_e( 'Detection Type', 'argus-wordpress-defence' ); ?></dt>
|
|
<dd><?php echo esc_html( ucfirst( $item->detection_type ) ); ?></dd>
|
|
<dt><?php esc_html_e( 'Detection Rule', 'argus-wordpress-defence' ); ?></dt>
|
|
<dd><?php echo esc_html( $item->detection_rule ?: '—' ); ?></dd>
|
|
<dt><?php esc_html_e( 'File Size', 'argus-wordpress-defence' ); ?></dt>
|
|
<dd><?php echo esc_html( size_format( (int) $item->file_size ) ); ?></dd>
|
|
<dt><?php esc_html_e( 'SHA-256 (at time of quarantine)', 'argus-wordpress-defence' ); ?></dt>
|
|
<dd><code><?php echo esc_html( $item->file_hash ); ?></code></dd>
|
|
<dt><?php esc_html_e( 'Original Modified', 'argus-wordpress-defence' ); ?></dt>
|
|
<dd><?php echo esc_html( $item->original_mtime ?: '—' ); ?></dd>
|
|
<?php if ( $item->analysed_at ) : ?>
|
|
<dt><?php esc_html_e( 'Last Analysis', 'argus-wordpress-defence' ); ?></dt>
|
|
<dd>
|
|
<?php
|
|
echo esc_html(
|
|
sprintf(
|
|
|
|
__( 'Score %1$d, analysed %2$s ago', 'argus-wordpress-defence' ),
|
|
(int) $item->confidence_score,
|
|
human_time_diff( strtotime( $item->analysed_at . ' UTC' ) )
|
|
)
|
|
);
|
|
if ( ! empty( $item->matched_rules ) ) {
|
|
echo ' -- ' . esc_html__( 'matched:', 'argus-wordpress-defence' ) . ' ' . esc_html( implode( ', ', $item->matched_rules ) );
|
|
}
|
|
?>
|
|
</dd>
|
|
<?php endif; ?>
|
|
</dl>
|
|
</details>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php
|
|
$base_url = remove_query_arg( 'paged' );
|
|
include ARGUS_WPD_DIR . 'admin/views/partials/pagination.php';
|
|
include ARGUS_WPD_DIR . 'admin/views/partials/footer.php';
|
|
?>
|