- ;;; ==========================================================================
- ;;; File : clean_virus_safe.lsp
- ;;; Version : 1.0
- ;;; Date : 14 August 2009
- ;;; Author : Steve Johnson after Autodesk, based on suggestion by Jimmy
- ;;; Bergmark.
- ;;; Purpose : Checks for existence of acad.vlx and logo.gif files, which are
- ;;; associated with virus AL/Logo-A, also known as ACAD/Unexplode,
- ;;; ACAD/Agent.A or ACM_UNEXPLODE.B. Written as a safer alternative
- ;;; to Autodesk's code which deletes suspect files without
- ;;; prior warning. This code renames the files instead.
- ;;; Legal : Provided as-is with no warranty whatsoever, use at own risk.
- ;;; May be distributed freely.
- ;;; Usage : Append the contents of this file into a startup LISP file
- ;;; (e.g. acaddoc.lsp in your search path - create such a file if
- ;;; it does not exist). Autodesk's suggestion to modify the
- ;;; acad20xx.lsp file should not be followed: this is bad practice.
- ;;; The acad20xx.lsp file is Autodesk's file and any modifications
- ;;; you make to it are likely to be lost when updates and patches
- ;;; are applied.
- ;;; Effects : Any and all files named acad.vlx and logo.gif and located in
- ;;; AutoCAD's search path will be renamed, e.g. "acad.vlx" will
- ;;; become "[suspected Virus] acad.vlx0". The name will end in a
- ;;; number starting with 0. If other suspect files are later found
- ;;; in the same location, those files will be renamed to end with
- ;;; 1, 2, 3 and so on.
- ;;; --------------------------------------------------------------------------
- ;;; Structure:
- ;;; clean_virus_safe.lsp
- ;;; `--clean_virus_safe
- ;;; `--make_new_name
- ;;; ==========================================================================
- (defun clean_virus_safe (ALERTBOX / make_new_name
- full-name path-only # new-name rename-msg)
- (defun make_new_name ()
- (strcat "[suspected Virus] " virus-file (itoa #))
- ) ; End make_new_name
- ;; Start clean_virus_safe ----------------------------
- (foreach virus-file '("acad.vlx" "logo.gif")
- (while (setq full-name (findfile virus-file))
- (progn
- (setq
- path-only
- (substr full-name 1 (- (strlen full-name) (strlen virus-file)))
- # 0
- )
- (while (findfile (make_new_name))
- (setq # (1+ #))
- )
- (setq
- new-name (strcat path-only (make_new_name))
- rename-msg
- (if (vl-file-rename full-name new-name)
- (strcat
- "Renamed suspected virus file:\n "
- full-name " to\n " new-name
- )
- (strcat
- "ERROR: Could not rename suspected virus file:\n "
- full-name " to\n " new-name
- )
- )
- )
- (princ (strcat "\n" rename-msg))
- (if ALERTBOX (alert rename-msg))
- )
- )
- )
- (princ)
- ) ; End clean_virus_safe
- ;; Call the (clean_virus_safe) function with or without alert box:
- (clean_virus_safe nil) ; Does not use alert box
- ; (clean_virus_safe T) ; Uses alert box
- ;; One of the above lines should be commented out (i.e. start with a semi-colon).
- (princ)
|