mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-10-01 12:07:46 +03:00
Fixed files overwriting in installer; added OWASP CRS.
This commit is contained in:
48
iis/ModSecurityIIS/owasp_crs/util/runAV/runAV.c
Normal file
48
iis/ModSecurityIIS/owasp_crs/util/runAV/runAV.c
Normal file
@@ -0,0 +1,48 @@
|
||||
#include "common.h"
|
||||
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
char cmd[MAX_OUTPUT_SIZE];
|
||||
char output[MAX_OUTPUT_SIZE];
|
||||
int error;
|
||||
char *colon;
|
||||
char *keyword;
|
||||
|
||||
if (argc > 1) {
|
||||
sprintf (cmd, "/usr/bin/clamscan --no-summary %s", argv[1]);
|
||||
output[0] = '\0';
|
||||
error = run_cmd(cmd,output,MAX_OUTPUT_SIZE);
|
||||
if (error != 0) {
|
||||
printf ("1 exec error %d: OK", error);
|
||||
} else if (!*output) {
|
||||
printf ("1 exec empty: OK");
|
||||
}
|
||||
else {
|
||||
colon = strstr(output, ":");
|
||||
if (colon) { colon += 2; }
|
||||
if (!colon) {
|
||||
printf ("0 unable to parse clamscan output [%s] for cmd [%s]", output, cmd);
|
||||
}
|
||||
else if (keyword = strstr(colon, " FOUND")) {
|
||||
*keyword = '\0';
|
||||
printf ("0 clamscan: %s", colon);
|
||||
}
|
||||
else if (keyword = strstr(colon, " ERROR")) {
|
||||
*keyword = '\0';
|
||||
printf ("0 clamscan: %s", colon);
|
||||
}
|
||||
else if (keyword = strstr(colon, "OK")) {
|
||||
printf ("1 clamscan: OK");
|
||||
}
|
||||
else if (keyword = strstr(colon, "Empty file")) {
|
||||
printf ("1 empty file");
|
||||
}
|
||||
else if (keyword = strstr(colon, "Can't access file ")) {
|
||||
printf ("0 invalid file %s", keyword+18);
|
||||
}
|
||||
else {
|
||||
printf ("0 unable to parse clamscan output [%s] for cmd [%s]", output, cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user