我如何改进我的程序,以使eScan认为它不是病毒?

问题描述 投票:0回答:1

这是我的课程:

class Program
{
    [DllImport("User32", CharSet = CharSet.Auto)]
    public static extern int SystemParametersInfo(int uiAction, int uiParam,
    string pvParam, uint fWinIni);

    static void Main(string[] args)
    {
        while (true)
        {
            if (!Directory.Exists("C:/temp"))
            {
                Directory.CreateDirectory("C:/temp");
            }

            if (!File.Exists(@"c:\temp\image.png"))
            {
                using (WebClient client = new WebClient())
                {
                    client.DownloadFile(new Uri("https://i.imgur.com/dhaP3Mu.png"), @"c:\temp\image.png");
                }
            }

            if (!CheckWallpaper(@"c:\temp\image.png"))
            {
                SystemParametersInfo(0x0014, 0, @"c:\temp\image.png", 0x0001);
            }

            Thread.Sleep(1000);
        }
    }

    static bool CheckWallpaper(string imagePath)
    {
        bool isSame = false;

        try
        {
            using (RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Control Panel\Desktop\WallPaper"))
            {
                if (key != null)
                {
                    Object o = key.GetValue(imagePath);
                    if (o != null)
                    {
                        Version version = new Version(o as String);  //"as" because it's REG_SZ...otherwise ToString() might be safe(r)
                    }
                }
            }
        }
        catch (Exception ex)  //just for demonstration...it's always best to handle specific exceptions
        {
            //react appropriately
        }

        return isSame;
    }
}

这只是一个小恶作剧,使用户无法更改其墙纸。但是现在我无法构建它,因为eData立即说它是“ Variant.Razy.587029”基因的病毒。我可以理解它认为它是一种病毒,因此有没有办法改善我的代码,使其看起来并不可疑?卡巴斯基我没有问题。而且我无法更改病毒扫描设置,因为它显然不是我的电脑

编辑:我还没有完成,例如CheckWallpaper()总是输出false,我只是想对其进行测试。

EDIT2:我现在将墙纸检查从“在注册表中查找”更改为“与Image.png比较%appdata%/Roaming/Microsoft/Windows/Themes/TranscodedWallpaper。我还添加了Thread.Sleep(1000),否则将再次检测到程序”]]

这是我的课程:类Program {[DllImport(“ User32”,CharSet = CharSet.Auto)] public static extern int SystemParametersInfo(int uiAction,int uiParam,string pvParam,uint fWinIni); ...

c# registry virus virus-scanning
1个回答
1
投票

正如Glenn van Acker所说,它本质上是一种病毒。如果您确实希望防病毒程序忽略此类程序,则“最简单”的方法是部署,签名和发布该程序。然后写信给防病毒公司将其列入白名单。

© www.soinside.com 2019 - 2024. All rights reserved.