• linux-clamav


    1. clamav
    	1.1 安装-更新-启用-测试
    	1.2 扫描
    	1.3 clamscan --help
    2. Rkhunter
    	2.1 安装-更新
    	2.2 系统检查-验证配置文件
    	2.3 配置文件,日志文件
    	2.4 rkhunter --help
    3. See Also

    1. clamav

    1.1 安装-更新-启用-测试

    https://wiki.archlinux.org/index.php/ClamAV
    https://www.clamav.net/
    安装
    $ sudo pacman -S clamav
    使用以下命令更新病毒定义
    $ sudo freshclam
    数据库文件保存在:
    /var/lib/clamav/daily.cvd
    /var/lib/clamav/main.cvd
    /var/lib/clamav/bytecode.cvd

    启动/启用自动更新病毒库服务: clamav-freshclam.service
    $ sudo systemctl enable clamav-freshclam.service
    $ sudo systemctl start clamav-freshclam.service
    注意:您将需要freshclam在首次启动服务之前运行,否则将遇到麻烦/错误,这将导致ClamAV无法正确启动。
    该服务称为clamav-daemon.service。启动它,并使其在启动时启动。
    $ sudo systemctl enable clamav-daemon.service
    $ sudo systemctl start clamav-daemon.service

    为了确保正确安装ClamAV和定义,请使用clamscan 扫描EICAR测试文件(无病毒代码的无害签名)。http://2016.eicar.org/86-0-Intended-use.html
    $ curl https://secure.eicar.org/eicar.com.txt |clamscan -
    输出必须包括:
    stdin: Win.Test.EICAR_HDB-1 FOUND

    1.2 扫描

    clamscan 可用于扫描某些文件,主目录或整个系统:
    $ clamscan myfile
    $ clamscan --recursive --infected /home
    $ sudo clamscan --recursive --infected --exclude-dir='^/sys|^/dev' /
    如果您想clamscan删除受感染的文件,请在命令中添加该--remove选项,也可以使用--move=/dir将其隔离。
    您可能还想clamscan扫描更大的文件。在这种情况下,请将选项--max-filesize=4000M和附加--max-scansize=4000M到命令中。“ 4000M”是最大可能值,可以根据需要降低。
    使用该-l /path/to/file选项会将clamscan日志打印到文本文件中,以查找报告的感染。

    -r递归扫描子目录; -o跳过打印OK的文件名; /home扫描home目录; -l输出日志文件
    $ clamscan -r -o /home -l /home/toma/cl7-0628.log
    ----------- SCAN SUMMARY -----------
    Known viruses: 7429542
    Engine version: 0.102.3
    Scanned directories: 4399
    Scanned files: 29483
    Infected files: 1
    Total errors: 5
    Data scanned: 1767.17 MB
    Data read: 1201.42 MB (ratio 1.47:1)
    Time: 729.874 sec (12 m 9 s)

    --exclude-dir 排除一些虚目录
    $ sudo clamscan -r -o --exclude-dir='^/sys|^/dev|^/mnt|^/home' / -l /home/toma/cl6-0628.log

    1.3 clamscan --help

    $ clamscan --help clamscan [options] [file/directory/-] cn
    --help -h Show this help 显示此帮助
    --version -V Print version number 打印版本号
    --verbose -v Be verbose 冗长
    --archive-verbose -a Show filenames inside scanned archives 在扫描的档案中显示文件名
    --debug Enable libclamav's debug messages 启用libclamav的调试消息
    --quiet Only output error messages 仅输出错误消息
    --stdout Write to stdout instead of stderr. Does not affect 'debug' messages. 写到stdout而不是stderr。不影响“调试”消息。
    --no-summary Disable summary at end of scanning 扫描结束时禁用摘要
    --infected -i Only print infected files 仅打印受感染的文件
    --suppress-ok-results -o Skip printing OK files 跳过打印OK文件
    --bell Sound bell on virus detection 检测病毒的声音
    --tempdir=DIRECTORY Create temporary files in DIRECTORY 在目录中创建临时文件
    --leave-temps[=yes/no(*)] Do not remove temporary files 不要删除临时文件
    --gen-json[=yes/no(*)] Generate JSON description of scanned file(s). JSON will be printed and alsodropped to the temp directory if --leave-temps is enabled. 生成扫描文件的JSON描述。如果启用--leave-temps,则将打印JSON并将其拖放到temp目录中。
    --database=FILE/DIR -d FILE/DIR Load virus database from FILE or load all supported db files from DIR 从FILE加载病毒数据库或从DIR加载所有受支持的数据库文件
    --official-db-only[=yes/no(*)] Only load official signatures 仅加载官方签名
    --log=FILE -l FILE Save scan report to FILE 将扫描报告保存到FILE
    --recursive[=yes/no(*)] -r Scan subdirectories recursively 递归扫描子目录
    --allmatch[=yes/no(*)] -z Continue scanning within file after finding a match 找到匹配项后继续在文件中扫描
    --cross-fs[=yes(*)/no] Scan files and directories on other filesystems 扫描其他文件系统上的文件和目录
    --follow-dir-symlinks[=0/1(*)/2] Follow directory symlinks (0 = never, 1 = direct, 2 = always) 遵循目录符号链接(0 =永不,1 =直接,2 =始终)
    --follow-file-symlinks[=0/1(*)/2] Follow file symlinks (0 = never, 1 = direct, 2 = always) 跟随文件符号链接(0 =从不,1 =直接,2 =始终)
    --file-list=FILE -f FILE Scan files from FILE 从FILE扫描文件
    --remove[=yes/no(*)] Remove infected files. Be careful! 删除受感染的文件。小心!
    --move=DIRECTORY Move infected files into DIRECTORY 将受感染的文件移至目录
    --copy=DIRECTORY Copy infected files into DIRECTORY 将受感染的文件复制到目录中
    --exclude=REGEX Don't scan file names matching REGEX 不要扫描与REGEX匹配的文件名
    --exclude-dir=REGEX Don't scan directories matching REGEX 不要扫描与REGEX匹配的目录
    --include=REGEX Only scan file names matching REGEX 仅扫描与REGEX匹配的文件名
    --include-dir=REGEX Only scan directories matching REGEX 仅扫描与REGEX匹配的目录
    --bytecode[=yes(*)/no] Load bytecode from the database 从数据库加载字节码
    --bytecode-unsigned[=yes/no(*)] Load unsigned bytecode 加载无符号字节码
    --bytecode-timeout=N Set bytecode timeout (in milliseconds) 设置字节码超时(以毫秒为单位)
    --statistics[=none(*)/bytecode/pcre] Collect and print execution statistics 收集并打印执行统计信息
    --detect-pua[=yes/no(*)] Detect Possibly Unwanted Applications 检测可能有害的应用程序
    --exclude-pua=CAT Skip PUA sigs of category CAT 跳过类别CAT的PUA信号
    --include-pua=CAT Load PUA sigs of category CAT 加载类别为CAT的PUA信号
    --detect-structured[=yes/no(*)] Detect structured data (SSN, Credit Card) 检测结构化数据(SSN,信用卡)
    --structured-ssn-format=X SSN format (0=normal,1=stripped,2=both) SSN格式(0 =正常,1 =剥离,2 =两者)
    --structured-ssn-count=N Min SSN count to generate a detect 最小SSN计数以生成检测
    --structured-cc-count=N Min CC count to generate a detect 最小CC计数以生成检测
    --scan-mail[=yes(*)/no] Scan mail files 扫描邮件文件
    --phishing-sigs[=yes(*)/no] Enable email signature-based phishing detection 启用基于电子邮件签名的网络钓鱼检测
    --phishing-scan-urls[=yes(*)/no] Enable URL signature-based phishing detection 启用基于URL签名的网络钓鱼检测
    --heuristic-alerts[=yes(*)/no] Heuristic alerts 启发式警报
    --heuristic-scan-precedence[=yes/no(*)] Stop scanning as soon as a heuristic match is found 找到启发式匹配项后立即停止扫描
    --normalize[=yes(*)/no] Normalize html, script, and text files. Use normalize=no for yara compatibility 规范化html,脚本和文本文件。使用normalize = no获得yara兼容性
    --scan-pe[=yes(*)/no] Scan PE files 扫描PE文件
    --scan-elf[=yes(*)/no] Scan ELF files 扫描ELF文件
    --scan-ole2[=yes(*)/no] Scan OLE2 containers 扫描OLE2容器
    --scan-pdf[=yes(*)/no] Scan PDF files 扫描PDF文件
    --scan-swf[=yes(*)/no] Scan SWF files 扫描SWF文件
    --scan-html[=yes(*)/no] Scan HTML files 扫描HTML文件
    --scan-xmldocs[=yes(*)/no] Scan xml-based document files 扫描基于xml的文档文件
    --scan-hwp3[=yes(*)/no] Scan HWP3 files 扫描HWP3文件
    --scan-archive[=yes(*)/no] Scan archive files (supported by libclamav) 扫描存档文件(libclamav支持)
    --alert-broken[=yes/no(*)] Alert on broken executable files (PE & ELF) 警报损坏的可执行文件(PE和ELF)
    --alert-encrypted[=yes/no(*)] Alert on encrypted archives and documents 提醒加密的档案和文件
    --alert-encrypted-archive[=yes/no(*)] Alert on encrypted archives 警报加密档案
    --alert-encrypted-doc[=yes/no(*)] Alert on encrypted documents 加密文件警报
    --alert-macros[=yes/no(*)] Alert on OLE2 files containing VBA macros 对包含VBA宏的OLE2文件发出警报
    --alert-exceeds-max[=yes/no(*)] Alert on files that exceed max file size, max scan size, or max recursion limit 对超过最大文件大小,最大扫描大小或最大递归限制的文件发出警报
    --alert-phishing-ssl[=yes/no(*)] Alert on emails containing SSL mismatches in URLs 在URL中包含SSL不匹配的电子邮件时发出警报
    --alert-phishing-cloak[=yes/no(*)] Alert on emails containing cloaked URLs 对包含隐藏URL的电子邮件发出警报
    --alert-partition-intersection[=yes/no(*)] Alert on raw DMG image files containing partition intersections 对包含分区相交的原始DMG图像文件发出警报
    --nocerts Disable authenticode certificate chain verification in PE files 禁用PE文件中的Authenticode证书链验证
    --dumpcerts Dump authenticode certificate chain in PE files 在PE文件中转储Authenticode证书链
    --max-scantime=#n Scan time longer than this will be skipped and assumed clean 扫描时间长于此时间将被忽略并认为是干净的
    --max-filesize=#n Files larger than this will be skipped and assumed clean 大于此大小的文件将被跳过并假定为干净文件
    --max-scansize=#n The maximum amount of data to scan for each container file (**) 每个容器文件要扫描的最大数据量(**)
    --max-files=#n The maximum number of files to scan for each container file (**) 每个容器文件要扫描的最大文件数(**)
    --max-recursion=#n Maximum archive recursion level for container file (**) 容器文件的最大归档递归级别(**)
    --max-dir-recursion=#n Maximum directory recursion level 最大目录递归级别
    --max-embeddedpe=#n Maximum size file to check for embedded PE 检查嵌入式PE的最大大小文件
    --max-htmlnormalize=#n Maximum size of HTML file to normalize 要规范化的HTML文件的最大大小
    --max-htmlnotags=#n Maximum size of normalized HTML file to scan 要扫描的规范化HTML文件的最大大小
    --max-scriptnormalize=#n Maximum size of script file to normalize 要规范化的脚本文件的最大大小
    --max-ziptypercg=#n Maximum size zip to type reanalyze 邮编的最大大小可重新分析
    --max-partitions=#n Maximum number of partitions in disk image to be scanned 磁盘映像中要扫描的最大分区数
    --max-iconspe=#n Maximum number of icons in PE file to be scanned PE文件中要扫描的最大图标数
    --max-rechwp3=#n Maximum recursive calls to HWP3 parsing function 对HWP3解析函数的最大递归调用
    --pcre-match-limit=#n Maximum calls to the PCRE match function. 最多调用PCRE匹配功能。
    --pcre-recmatch-limit=#n Maximum recursive calls to the PCRE match function. 对PCRE匹配函数的最大递归调用。
    --pcre-max-filesize=#n Maximum size file to perform PCRE subsig matching. 执行PCRE subsig匹配的最大文件大小。
    --disable-cache Disable caching and cache checks for hash sums of scanned files. 禁用对扫描文件的哈希和进行缓存和缓存检查。
      Pass in - as the filename for stdin. 传入-作为stdin的文件名。
      (*) Default scan settings (*)默认扫描设置
      (**) Certain files (e.g. documents, archives, etc.) may in turn contain other files inside. The above options ensure safe processing of this kind of data. (**)某些文件(例如文档,档案等)可能反过来在其中包含其他文件。以上选项可确保安全处理此类数据。

    2. Rkhunter

    2.1 安装-更新

    http://rkhunter.sourceforge.net/
    https://sourceforge.net/p/rkhunter/rkh_code/ci/master/tree/files/README
    https://wiki.archlinux.org/index.php/Rkhunter
    安装
    $ sudo pacman -Ss rkhunter
    首次更新文件属性数据库:
    $ sudo rkhunter --propupd

    2.2 系统检查-验证配置文件

    运行系统检查:
    $ sudo rkhunter --check
    ... 内容较多, 以下为统计信息

    [ Found ]   	5	
    [ None found ]	13	
    [ Not found ]	1189	
    [ OK ]      	246	
    [ Skipped ] 	6	
    [ Warning ] 	14	
    Suspect files:	4
    Possible rootkits: 7
    


    验证配置文件:
    $ sudo rkhunter --config-check

    2.3 配置文件,日志文件

    主配置文件位于/etc/rkhunter.conf。
    默认情况下,上次系统检查的日志将放置在/var/log/rkhunter.log。
    误报, 开箱即用,Rootkit Hunter在检查文件属性时将抛出一些错误警告。这是因为,一些核心实用程序已被脚本替换。这些警告可以通过白名单静音。
    /etc/rkhunter.conf
    SCRIPTWHITELIST=/usr/bin/egrep
    SCRIPTWHITELIST=/usr/bin/fgrep
    SCRIPTWHITELIST=/usr/bin/ldd

    2.4 rkhunter --help

    $ sudo rkhunter --help Usage: rkhunter {--check | --unlock | --update | --versioncheck |  
      --propupd [{filename | directory | package name},...] |  
      --list [{tests | {lang | languages} | rootkits | perl | propfiles}] |  
      --config-check | --version | --help} [options]  
    Current options are:    
    --append-log Append to the logfile, do not overwrite 追加到日志文件,请勿覆盖
    --bindir <directory>... Use the specified command directories 使用指定的命令目录
    -c, --check Check the local system 检查本地系统
    -C, --config-check Check the configuration file(s), then exit 检查配置文件,然后退出
    --cs2, --color-set2 Use the second color set for output 使用第二种颜色设置进行输出
    --configfile <file> Use the specified configuration file 使用指定的配置文件
    --cronjob Run as a cron job 作为cron工作运行
      (implies -c, --sk and --nocolors options) (意味着-c,-sk和--nocolors选项)
    --dbdir <directory> Use the specified database directory 使用指定的数据库目录
    --debug Debug mode 调试模式
      (Do not use unless asked to do so) (除非有要求,否则请勿使用)
    --disable <test>[,<test>...] Disable specific tests 禁用特定测试
      (Default is to disable no tests) (默认为禁用任何测试)
    --display-logfile Display the logfile at the end 在末尾显示日志文件
    --enable <test>[,<test>...] Enable specific tests 启用特定测试
      (Default is to enable all tests) (默认为启用所有测试)
    --hash {MD5 | SHA1 | SHA224 | SHA256 | SHA384 | SHA512 | SHA256 | SHA3​​84 | SHA512 |
    NONE | <command>} Use the specified file hash function 使用指定的文件哈希函数
      (Default is SHA256) (默认为SHA256)
    -h, --help Display this help menu, then exit 显示此帮助菜单,然后退出
    --lang, --language <language> Specify the language to use 指定要使用的语言
      (Default is English) (默认为英语)
    --list [tests | languages |
    rootkits | perl | propfiles]
    List the available test names, languages, rootkit names, perl module status or file properties database, then exit 列出可用的测试名称,语言,rootkit名称,perl模块状态或文件属性数据库,然后退出
    -l, --logfile [file] Write to a logfile 写入日志文件
      (Default is /var/log/rkhunter.log) (默认值为/var/log/rkhunter.log)
    --noappend-log Do not append to the logfile, overwrite it 不要追加到日志文件中,将其覆盖
    --nocf Do not use the configuration file entries for disabled tests (only valid with --disable) 不要将配置文件条目用于禁用的测试(仅对--disable有效)
    --nocolors Use black and white output 使用黑白输出
    --nolog Do not write to a logfile 不要写入日志文件
    --nomow, --no-mail-on-warning Do not send a message if warnings occur 如果发生警告,请勿发送消息
    --ns, --nosummary Do not show the summary of check results 不显示检查结果摘要
    --novl, --no-verbose-logging No verbose logging 没有详细的日志记录
    --pkgmgr {RPM | DPKG | BSD |
    BSDng | SOLARIS |
    Use the specified package manager to obtain or verify file property values. 使用指定的程序包管理器来获取或验证文件属性值。
    NONE} (Default is NONE) (默认为无)
    --propupd [file | directory |
    package]...
    Update the entire file properties database, or just for the specified entries 更新整个文件属性数据库,或仅更新指定的条目
    -q, --quiet Quiet mode (no output at all) 安静模式(完全没有输出)
    --rwo, --report-warnings-only Show only warning messages 仅显示警告消息
    --sk, --skip-keypress Don't wait for a keypress after each test 每次测试后不要等待按键
    --summary Show the summary of system check results 显示系统检查结果摘要
      (This is the default) (这是默认设置)
    --syslog [facility.priority] Log the check start and finish times to syslog 将检查开始和完成时间记录到syslog
      (Default level is authpriv.notice) (默认级别为authpriv.notice)
    --tmpdir <directory> Use the specified temporary directory 使用指定的临时目录
    --unlock Unlock (remove) the lock file 解锁(删除)锁定文件
    --update Check for updates to database files 检查数据库文件的更新
    --vl, --verbose-logging Use verbose logging (on by default) 使用详细日志记录(默认情况下处于启用状态)
    -V, --version Display the version number, then exit 显示版本号,然后退出
    --versioncheck Check for latest version of program 检查程序的最新版本
    -x, --autox Automatically detect if X is in use 自动检测是否正在使用X
    -X, --no-autox Do not automatically detect if X is in use 不自动检测是否正在使用X
    $ sudo rkhunter --update
    [ Rootkit Hunter version 1.4.6 ]
    Checking rkhunter data files...
      Checking file mirrors.dat                                  [ Update failed ]
      Checking file programs_bad.dat                             [ Update failed ]
      Checking file backdoorports.dat                            [ Update failed ]
      Checking file suspscan.dat                                 [ No update ]
      Checking file i18n versions                                [ Update failed ]
    Please check the log file (/var/log/rkhunter.log)
    USER	COMMAND
    toma	 \_ fish
    root	 |   \_ sudo rkhunter --update
    root	 |       \_ /bin/sh /usr/bin/rkhunter --update
    root	 |           \_ /usr/bin/wget -q -O /var/lib/rkhunter/tmp/rkhunter.upd.oEZ3bq3xu5 http://rkhunter.sourceforge.net/1.4/programs_bad.dat
    root	 |           \_ /usr/bin/wget -q -O /var/lib/rkhunter/tmp/rkhunter.upd.oEZ3bq3xu5 http://rkhunter.sourceforge.net/1.4/backdoorports.dat
    root	 |           \_ /usr/bin/wget -q -O /var/lib/rkhunter/tmp/rkhunter.upd.oEZ3bq3xu5 http://rkhunter.sourceforge.net/1.4/suspscan.dat
    root	 |           \_ /usr/bin/wget -q -O /var/lib/rkhunter/tmp/rkhunter.upd.oEZ3bq3xu5 http://rkhunter.sourceforge.net/1.4/i18n/1.4.6/i18n.ver

    3. See Also

    Linux系统安全笔记 发表于 2019-01-02 osoft
    https://www.cnblogs.com/sztom/p/10211554.html
    https://www.clamav.net/downloads
    https://github.com/Cisco-Talos/clamav-devel
    https://en.wikipedia.org/wiki/Clam_AntiVirus
    https://en.wikipedia.org/wiki/List_of_antivirus_software
    https://en.wikipedia.org/wiki/Comparison_of_antivirus_software
    https://en.wikipedia.org/wiki/Comparison_of_firewalls

     
  • 相关阅读:
    线程池、进程池(concurrent.futures模块)和协程
    python中socket、进程、线程、协程、池的创建方式和应用场景
    IO多路复用和local概念
    pymysql模块
    HTML初识
    CSS之选择器
    CSS之样式属性(背景固定、圆形头像、模态框)
    字符串格式的方法%s、format和python3.6新特性f-string和类型注解
    common-pool2 使用
    apache-common pool的使用
  • 原文地址:https://www.cnblogs.com/sztom/p/13222917.html
Copyright © 2020-2023  润新知