Run ImunifyAV from command line on a specific path

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • scott
    Senior Member
    Forum ExplorerTechnical AssociateSolutions Developer
    • Mar 2021
    • 122

    #1

    Run ImunifyAV from command line on a specific path

    Can you run ImunifyAV from the command line on a specific path and allow the process to stay in the foreground until it is finished and display a report?

    Something like clamscan but with the ImunifyAV database.

  • akots
    Administrator
    • Mar 2023
    • 127

    #2
    Hello Scott,

    You can start an on-demand ImunifyAV scan for a specific path with:
    Code:
    imunify-antivirus malware on-demand start --path /home/<username>/public_html/
    To review the scans that were started, you can use:
    HTML Code:
    imunify-antivirus malware on-demand list
    Then, once you have the relevant
    HTML Code:
    SCAN_ID
    , you can check the malware findings for that particular scan with:
    HTML Code:
    imunify-antivirus malware malicious list --by-scan-id <SCAN_ID>
    At the moment, the CLI is documented as separate subcommands for starting the scan, checking scan status/list, and then viewing malware results, rather than as a single clamscan-style foreground command that waits for completion and immediately prints the final report. The relevant commands documented are
    HTML Code:
    malware on-demand start --path
    ,
    HTML Code:
    malware on-demand list
    ,
    HTML Code:
    malware on-demand status
    , and
    HTML Code:
    malware malicious list
    , with -
    HTML Code:
    -by-scan-id
    available for filtering results.​

    Comment

    • scott
      Senior Member
      Forum ExplorerTechnical AssociateSolutions Developer
      • Mar 2021
      • 122

      #3
      I think it'd be a great idea if

      HTML Code:
      imunify-antivirus malware on-demand start --path /home/<username>/public_html/
      gave the scan id of that scan, if a true foreground scanning system is not possible.

      That way you can script it to run the command and then tell the script to watch for the completion of that scanid.

      You can run that command and then immediately run

      HTML Code:
      imunify-antivirus malware on-demand list
      to see the latest/running scanid, but that's kind of a race condition, if another scan happens to start at the same time or the scan finishes before you can get the list.

      Just my thoughts on it.

      Comment

      • scott
        Senior Member
        Forum ExplorerTechnical AssociateSolutions Developer
        • Mar 2021
        • 122

        #4
        Additionally, it'd be nice to be able to pass a file with a list of files to scan rather than just a path to scan.

        This way you can utilize find to list files that have been modified within a certain amount of days (or whatever you want to find) and pass that list to imunifyav to be scanned.

        Comment

        • akots
          Administrator
          • Mar 2023
          • 127

          #5
          Hello Scott,

          Thank you for the detailed suggestions! We really appreciate you taking the time to share them. Your feedback makes sense, especially for workflows where a more direct, foreground-style scan/report flow would be helpful.

          This looks like a good candidate for a feature request. If you’d like, please submit it via our Feature Portal, as described here: https://features.imunify360.com/

          You can find the instructions in this article:
          https://cloudlinux.zendesk.com/hc/en-us/articles/5795005123740-How-to-submit-an-Imunify-feature-request

          Comment

          Working...