4
I am unable to scan a file that contains the EICAR (Standard Test File for Antivirus Scanning Methods) characters, as it contains escape characters such as " ", "()", "[]". I need a help to identify these characters in my program as being normal within a string, as other common ones like "a", "b", "1", "2", etc. Follow the code below:
string[] Lista = new string[] { "X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*"};
string dir = @"C:\Program Files (x86)";
private void btnScan_Click(object sender, EventArgs e)
{
List<string> busca= Directory.GetFiles(dir, "*.dll*", SearchOption.AllDirectories).ToList();
foreach (string item in busca)
{
StreamReader stream = new StreamReader(item);
string ler = stream.ReadToEnd();
foreach (string st in Lista)
{
if (Regex.IsMatch(ler, st))
{
btnDelete.Visible = true;
btnQuarentena.Visible = true;
}
}
}
}
I’ve tried to put the string EICAR in this way, but did not help:
string[] Lista = new string[] { @"X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*"};
Visual Studio always returns me the same error, of exhaust, affected by the characters " ", "[]" and "()".