B Thibault 8 年之前
父节点
当前提交
5ae2aa56f5
共有 2 个文件被更改,包括 34 次插入0 次删除
  1. 3 0
      cli/test-virus
  2. 31 0
      cli/viruscan.sh

+ 3 - 0
cli/test-virus

@@ -0,0 +1,3 @@
+X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*
+
+

+ 31 - 0
cli/viruscan.sh

@@ -0,0 +1,31 @@
+#!/bin/sh
+
+_status=0
+done=0
+
+if [[ -f $1 ]]; then
+    while read line
+    do
+        if [[ $line == *": OK" ]]; then
+            echo $line
+        elif [[ $line == *" FOUND" ]]; then
+            _status=1
+            echo $line
+        elif [[ $line == "ClamAV "* ]]; then
+            echo $line
+        elif [[ $line == "----------- SCAN SUMMARY -----------" ]]; then
+            done=1
+            echo $line
+        elif [ $done -eq 1 ] && [[ $line == *": "* ]]; then
+            echo $line
+        fi
+    done <<< `/usr/bin/scp $@ sshjailed@cq.knacki.info:~/ 2>&1`
+
+else
+    >&2 echo "Usage: ${0} [FILE]"
+    _status=1
+
+fi
+
+exit $_status
+