[Libreoffice-commits] core.git: antivirusDetection.vbs configure.ac
antivirusDetection.vbs | 30 ++ configure.ac | 40 ++-- 2 files changed, 40 insertions(+), 30 deletions(-) New commits: commit 8d8f62852a64bd2fcae47a9499406d9167aebf83 Author: Michel Thomas AuthorDate: Tue Feb 11 21:34:57 2020 +0530 Commit: Mike Kaganski CommitDate: Wed Feb 12 09:14:03 2020 +0100 tdf#84553 Correctly handle failures while getting a WMI Object. The output before this patch : checking for active Antivirus software... C:\cygwin\home\tdf\lode\jenkins\workspace\gerrit_windows\antivirusDetection.vbs(1, 1) (null): 0x8004100E found The link for which is : https://ci.libreoffice.org/job/gerrit_windows/57035/consoleFull Change-Id: I714442739a8daf132e95b9f6a750aa7abab3561e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88465 Tested-by: Mike Kaganski Reviewed-by: Mike Kaganski diff --git a/antivirusDetection.vbs b/antivirusDetection.vbs index a4e76731f0b6..ad22e267343d 100755 --- a/antivirusDetection.vbs +++ b/antivirusDetection.vbs @@ -1,19 +1,25 @@ +On Error Resume Next Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\SecurityCenter2") -Set installedAntiviruses = objWMIService.ExecQuery("Select * from AntivirusProduct") +If objWMIService is Nothing Then +Wscript.StdOut.Write "NULL" +Else +Set installedAntiviruses = objWMIService.ExecQuery("Select * from AntivirusProduct") 'Iterates through all the antivirus software,retrieved by the WMI query,present on the system and prints only the ones that are active 'this is done by checking the 12th bit of the productState property of the antivirus 'if 12th bit is on then it means that the antivirus is in active state 'if 12th bit is off then it is inactive. 'see http://neophob.com/2010/03/wmi-query-windows-securitycenter2/ -count=0 -list="" -For Each antivirus in installedAntiviruses -If antivirus.productState And Then 'checking the state of the 12th bit of productState property of the antivirus -count=count+1 -list=list & VBNewLine & VBtab & "*" & antivirus.displayName +count=0 +list="" +For Each antivirus in installedAntiviruses +If antivirus.productState And Then 'checking the state of the 12th bit of productState property of the antivirus +count=count+1 +list=list & VBNewLine & VBtab & "*" & antivirus.displayName +End if +Next +If count = 0 Then +Wscript.StdOut.Write "NOT_FOUND" +Else +Wscript.Echo list End if -Next -If count = 0 Then - Wscript.StdOut.Write "NOT_FOUND" -Else Wscript.Echo list -End if +End if \ No newline at end of file diff --git a/configure.ac b/configure.ac index 615c9f2df8ee..4713f269ccbf 100644 --- a/configure.ac +++ b/configure.ac @@ -12980,24 +12980,28 @@ dnl === if test $_os = WINNT ; then AC_MSG_CHECKING([for active Antivirus software]) ANTIVIRUS_LIST=`cscript.exe //Nologo $SRC_ROOT/antivirusDetection.vbs` -if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then -AC_MSG_RESULT([found]) - EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*' -echo $EICAR_STRING > $SRC_ROOT/eicar -EICAR_TEMP_FILE_CONTENTS=`cat $SRC_ROOT/eicar` -rm $SRC_ROOT/eicar -if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then -AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST]) -fi -echo $EICAR_STRING > $BUILDDIR/eicar -EICAR_TEMP_FILE_CONTENTS=`cat $BUILDDIR/eicar` -rm $BUILDDIR/eicar -if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then -AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST]) -fi -add_warning "To speed up builds and avoid failures in unit tests, it is highly recommended that you exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST" -else -AC_MSG_RESULT([not found]) +if [ [ "$ANTIVIRUS_LIST" != "NULL" ] ]; then +if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then +AC_MSG_RESULT([found]) + EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*' +echo $EICAR_STRING > $SRC_ROOT/eicar +EICAR_TEMP_FILE_CONTENTS=`cat $SRC_ROOT/eicar` +rm $SRC_ROOT/eicar +if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then +AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST]) +fi +echo $EICAR_STRING >
[Libreoffice-commits] core.git: configure.ac
configure.ac | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) New commits: commit a570a6b122125e88629fde990306f525c561284c Author: Michel Thomas AuthorDate: Sat Feb 8 22:17:39 2020 +0530 Commit: Mike Kaganski CommitDate: Mon Feb 10 05:09:45 2020 +0100 tdf#84553 Detection of antivirus exclusion, EICAR test. Change-Id: I3577a361edcc67f85f86ddb75778cd39784b39a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88269 Reviewed-by: Mike Kaganski Tested-by: Jenkins diff --git a/configure.ac b/configure.ac index 1bccce3578c8..96e2cbc58ae3 100644 --- a/configure.ac +++ b/configure.ac @@ -12982,7 +12982,20 @@ if test $_os = WINNT ; then ANTIVIRUS_LIST=`cscript.exe //Nologo $SRC_ROOT/antivirusDetection.vbs` if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then AC_MSG_RESULT([found]) -add_warning "To speed up builds and avoid failures in unit tests, it is highly recommended that you exclude the build directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST" + EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*' +echo $EICAR_STRING > $SRC_ROOT/eicar +EICAR_TEMP_FILE_CONTENTS=`cat $SRC_ROOT/eicar` +rm $SRC_ROOT/eicar +if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then +AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST]) +fi +echo $EICAR_STRING > $BUILDDIR/eicar +EICAR_TEMP_FILE_CONTENTS=`cat $BUILDDIR/eicar` +rm $BUILDDIR/eicar +if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then +AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST]) +fi +add_warning "To speed up builds and avoid failures in unit tests, it is highly recommended that you exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST" else AC_MSG_RESULT([not found]) fi ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: antivirusDetection.vbs configure.ac
antivirusDetection.vbs | 19 +++ configure.ac | 15 +++ 2 files changed, 34 insertions(+) New commits: commit c16969b9bc73fdd77e763299d6aea7b614e203e2 Author: Michel Thomas AuthorDate: Sun Feb 2 01:03:20 2020 +0530 Commit: Mike Kaganski CommitDate: Sat Feb 8 06:17:03 2020 +0100 tdf#84553 Detect and warn of Windows Antivirus. Change-Id: I7731cb316306c153ad14bb3d27f39600a44ed9ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87811 Reviewed-by: Julien Nabet Tested-by: Jenkins diff --git a/antivirusDetection.vbs b/antivirusDetection.vbs new file mode 100755 index ..a4e76731f0b6 --- /dev/null +++ b/antivirusDetection.vbs @@ -0,0 +1,19 @@ +Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\SecurityCenter2") +Set installedAntiviruses = objWMIService.ExecQuery("Select * from AntivirusProduct") +'Iterates through all the antivirus software,retrieved by the WMI query,present on the system and prints only the ones that are active +'this is done by checking the 12th bit of the productState property of the antivirus +'if 12th bit is on then it means that the antivirus is in active state +'if 12th bit is off then it is inactive. +'see http://neophob.com/2010/03/wmi-query-windows-securitycenter2/ +count=0 +list="" +For Each antivirus in installedAntiviruses +If antivirus.productState And Then 'checking the state of the 12th bit of productState property of the antivirus +count=count+1 +list=list & VBNewLine & VBtab & "*" & antivirus.displayName +End if +Next +If count = 0 Then + Wscript.StdOut.Write "NOT_FOUND" +Else Wscript.Echo list +End if diff --git a/configure.ac b/configure.ac index d4a737aeaeb1..1bccce3578c8 100644 --- a/configure.ac +++ b/configure.ac @@ -12973,6 +12973,21 @@ fi AC_SUBST(ENABLE_FORMULA_LOGGER) +dnl === +dnl Checking for active Antivirus software. +dnl === + +if test $_os = WINNT ; then +AC_MSG_CHECKING([for active Antivirus software]) +ANTIVIRUS_LIST=`cscript.exe //Nologo $SRC_ROOT/antivirusDetection.vbs` +if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then +AC_MSG_RESULT([found]) +add_warning "To speed up builds and avoid failures in unit tests, it is highly recommended that you exclude the build directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST" +else +AC_MSG_RESULT([not found]) +fi +fi + dnl === dnl Setting up the environment. dnl === ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits