PHP Classes

File: fix.php

Recommend this page to a friend!
  Classes of Manuel Lemos   WordPress Vulnerability Scanner   fix.php   Download  
File: fix.php
Role: Example script
Content type: text/plain
Description: Example script
Class: WordPress Vulnerability Scanner
Scan and fix known WordPress vulnerabilities
Author: By
Last change:
Date: 4 years ago
Size: 1,003 bytes
 

Contents

Class file image Download
<?php
   
/*
     * fix.php
     */


   
require('wordpress_vulnerabilities.php');

   
$options = (file_exists('options.php') ? include('options.php') : array());
   
$fix = new wordpress_vulnerabilities_class;

    if((
$success = $fix->Initialize($options)))
    {
        if((
$success = $fix->GetSupportedVulnerabilityChecks($checks)))
        {
           
$checked = $total_vulnerable = 0;
            foreach(
$checks as $name)
            {
                echo
'Checking "', $name, '"...',"\n";
                if(!(
$success = $fix->CheckVulnerability($name, $vulnerable)))
                    break;
                if(
$vulnerable)
                {
                    ++
$total_vulnerable;
                    echo
'Vulnerable to "', $name, '": Yes',"\n";
                    if(!(
$success = $fix->FixVulnerability($name, $fixed)))
                        break;
                    echo
'Fixing vulnerability "', $name, '": ', ($fixed ? 'Success' : 'Failed'),"\n";
                }
                ++
$checked;
            }
            echo
'Checked ', $checked, ' vulnerabilities, Vulnerable ', $total_vulnerable, ' .', "\n";
        }
       
$success = $fix->Finalize($success);
    }
    if(!
$success)
        echo
'Failed with error: ', $fix->error, "\n";