error_log quarantine

Home Forums BulletProof Security Pro error_log quarantine

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #45889
    Terry
    Participant

    Is there a way to tell BPS not to quarantine error_logĀ  files generated by the server that occur in multiple folders without having to whitelist each one individually. I have had sites with the files in 15 to 20 different folders which I think were generated from attacks on the sites. I know how to do block BPS from checking one at a time but looking for a way when I see error_logĀ  files in many different folders.

    #45890
    AITpro Admin
    Keymaster

    Unfortunately, that is not possible to do with Regular Expressions (RegEx) code because of how this PHP function works: file_exists()

    Question to AI: Can you use regular expressions for the path for the php file_exists function?

    AI response: No, the PHP file_exists function does not support regular expressions for its path parameter. It accepts a single, literal path string to a specific file or directory.

    I could use coding methods like AI is suggesting below to scan all directories for files named: error_log, put the error_log file paths into an array, store that array information in the WP DB and then output the DB data in form that would allow excluding all files named error_log in one Form submission. Unfortunately, I don’t have that kind of time to spare on BPS Pro these days. I’ve been working on other coding projects these days. Mainly focusing on AI Dev these days. So yeah unfortunately, there is no quick and easy solution for this.

    To check for the existence of files matching a regular expression pattern, you must:
    Scan the directory to get a list of all file names using a function like scandir().
    Iterate through the list and use a regular expression matching function like preg_match() to test each file name against your desired pattern.

    Alternatively, you can use the PHP glob() function, which uses shell wildcards (not full regular expressions) to return an array of file paths matching a pattern. If the resulting array is not empty, it means at least one file matching the wildcard pattern exists.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.