首页
社区
课程
招聘
7
[原创]简单云查杀客户端源代码
发表于: 2011-4-10 23:24 15276

[原创]简单云查杀客户端源代码

2011-4-10 23:24
15276
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;
 
//
//+++++++++++++++++++++++++++++++++++++++++++++
//
// CloudScanner 
//
// Written by Spark.   nkspark_at_gmail.com
// 
//          2011.03.26
//+++++++++++++++++++++++++++++++++++++++++++++
//
 
namespace CloudScanner
{
    class Program
    {
        static string GetScanResult(string strFileName)
        {
            //VirusTotal的查询请求链接。
            string strQueryURL = "http://www.virustotal.com/search.html"
            string strMD5;
 
            FileStream fsSource = new FileStream(strFileName, FileMode.Open, FileAccess.ReadWrite);
 
            byte[] bIn = new byte[fsSource.Length];
            fsSource.Read(bIn, 0, (int)fsSource.Length);
            fsSource.Close();
 
            System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create();
            strMD5 = BitConverter.ToString(md5.ComputeHash(bIn)).Replace("-""");
            strMD5 = "chain=" + strMD5;
 
 
 
            WebClient webClient = new WebClient();
            webClient.Encoding = System.Text.Encoding.UTF8;
            System.Net.ServicePointManager.Expect100Continue = false;
 
 
            return webClient.UploadString(strQueryURL, strMD5);
        }
 
        //从VirusTotal的返回结果中提取病毒名称。
        static string ExtractResult(string strPage)
        {
            string strAVProductName;
            string strVersion;
            string strUpdate;
            string strVirusName = "";
 
             
            int iStartPos = -1;
            int iEndPos = -1;
 
            iStartPos = strPage.IndexOf("id=\"tablaMotores\"");
            if (iStartPos == -1) return "";           
            iEndPos = strPage.IndexOf("</table>", iStartPos);
            strPage = strPage.Substring(iStartPos, iEndPos-iStartPos);
 
            TagInfo ti = new TagInfo();
 
            string strTRLine;
            ti.TagName = "tr";
            ti.GetPos(strPage);
            strTRLine = ti.GetContext(strPage);
            strPage = strPage.Substring(ti.EndPos);           
 
            while (strTRLine != "")
            {                
                ti.TagName = "tr";
                ti.GetPos(strPage);
                strTRLine = ti.GetContext(strPage);
                if (strTRLine == ""return "";
                strPage = strPage.Substring(ti.EndPos);
 
                //AV Product
                ti.TagName = "td";
                ti.GetPos(strTRLine);
                strAVProductName = ti.GetContext(strTRLine);
                 
 
                //Version
                strTRLine = strTRLine.Substring(ti.EndPos);
                ti.TagName = "td";
                ti.GetPos(strTRLine);
                strVersion = ti.GetContext(strTRLine);
                 
                //Last Update
                strTRLine = strTRLine.Substring(ti.EndPos);
                ti.TagName = "td";
                ti.GetPos(strTRLine);
                strUpdate = ti.GetContext(strTRLine);
                 
                //Result
                strTRLine = strTRLine.Substring(ti.EndPos);
                ti.TagName = "td";
                ti.GetPos(strTRLine);
                strVirusName = ti.GetContext(strTRLine);
                if (strVirusName != "-")
                    return strVirusName;                        
            }
 
            return ""
        }
        static void Main(string[] args)
        {
  
            string strResult;
            string strFileName="";
            long lTime;
 
            if (args.Length < 1)
            {
                Console.WriteLine("Usage: CloudScanner.exe FileName");
                return;
            }
 
            strFileName = args[0];
 
            if (!File.Exists(strFileName))
            {
                Console.WriteLine("文件不存在!");
                return;
            }
 
            lTime = DateTime.Now.Ticks;            
            strResult = GetScanResult(strFileName);
 
            strResult = ExtractResult(strResult);
            lTime = (DateTime.Now.Ticks - lTime) / TimeSpan.TicksPerSecond;
 
            if(strResult != "")               
                Console.WriteLine("发现病毒 " + strResult + ",扫描用时" + lTime.ToString() + "秒。");
            else               
                Console.WriteLine("正常文件,扫描用时" + lTime.ToString() + "秒。");
 
        }
 
  
 
    }
 
    public class TagInfo
    {
        public string TagName;
        public int StartPos = -1;
        public int EndPos = -1;
 
        public void GetPos(string strIn)
        {
 
 
            string strScriptStart = "<" + TagName;
            string strScriptEnd = "/" + TagName + ">";
 
            StartPos = strIn.IndexOf(strScriptStart);
            if (StartPos != -1)
                EndPos = strIn.IndexOf(strScriptEnd, StartPos);
        }
 
        public string GetContext(string strIn)
        {
 
            string strTemp = "";
            string strScriptStart = ">";
            string strScriptEnd = "<";
            int iScriptStart;
            int iScriptEnd;
 
            if (StartPos != -1 && EndPos != -1)
            {
                iScriptStart = strIn.IndexOf(strScriptStart, StartPos) + 1;
                iScriptEnd = strIn.LastIndexOf(strScriptEnd, EndPos);
                strTemp = strIn.Substring(iScriptStart, iScriptEnd - iScriptStart);
            }
            return strTemp;
        }
 
    }
 
}

[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课

上传的附件:
收藏
免费 7
支持
分享
赞赏记录
参与人
雪币
留言
时间
Youlor
为你点赞~
2024-5-31 06:34
伟叔叔
为你点赞~
2024-3-29 00:48
心游尘世外
为你点赞~
2024-2-10 00:25
飘零丶
为你点赞~
2024-2-1 00:20
QinBeast
为你点赞~
2024-1-24 02:33
shinratensei
为你点赞~
2024-1-19 04:07
PLEBFE
为你点赞~
2023-3-10 01:12
最新回复 (28)
雪    币: 2562
活跃值: (4283)
能力值: ( LV13,RANK:540 )
在线值:
发帖
回帖
粉丝
2
谢谢分享~~
2011-4-10 23:46
0
雪    币: 72
活跃值: (10)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
3
谢谢分享…学习
2011-4-11 00:00
0
雪    币: 839
活跃值: (359)
能力值: ( LV11,RANK:180 )
在线值:
发帖
回帖
粉丝
4
猛男~~
2011-4-11 00:48
0
雪    币: 284
活跃值: (16)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
5
不错的吖,怎么没人顶呢/
2011-4-11 08:29
0
雪    币: 695
活跃值: (70)
能力值: ( LV4,RANK:40 )
在线值:
发帖
回帖
粉丝
6
nice,原来云查杀是这样一个原理
2011-4-11 09:04
0
雪    币: 170
活跃值: (90)
能力值: ( LV12,RANK:210 )
在线值:
发帖
回帖
粉丝
7
云查杀依据庞大的黑白名单库+N种反病毒的软件扫描+人工分析
1、黑白名单(关键就是及时、全面)
2、N种反病毒查杀(速度)
3、人工分析(都没扫出来的,人再去看一看,不确定有这一环节)
4、杀掉发现的病毒(杀完病毒,系统可否正常使用)
2011-4-11 09:19
0
雪    币: 170
活跃值: (90)
能力值: ( LV12,RANK:210 )
在线值:
发帖
回帖
粉丝
8
云查杀在互联网时代效果还是蛮好的吧。
2011-4-11 09:19
0
雪    币: 217
活跃值: (147)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
9
思路很好这个 代码
2011-4-11 10:44
0
雪    币: 266
活跃值: (15)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
10
这个 前年 就玩过了
2011-4-11 10:58
0
雪    币: 46
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
11
顶贴支持  ~~
2011-4-11 12:22
0
雪    币: 10881
活跃值: (2594)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
12
期待更新这个软件    不错
2011-4-11 12:27
0
雪    币: 33
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
13
估计国内那些云也是如此
2011-4-11 18:03
0
雪    币: 258
活跃值: (40)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
14
思路很好,花了点时间,用MFC重写了。。。。
KillVirus.rar
上传的附件:
2011-4-11 21:24
0
雪    币: 170
活跃值: (90)
能力值: ( LV12,RANK:210 )
在线值:
发帖
回帖
粉丝
15
单机用户。。。。亿级试试
2011-4-12 08:53
0
雪    币: 88
活跃值: (25)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
16

思路那是相当的棒
2011-4-12 16:52
0
雪    币: 578
活跃值: (14)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
17
很强悍,收藏了,研究下
2011-4-12 18:20
0
雪    币: 239
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
18
谢谢楼主,思路不错呀
2011-4-15 01:28
0
雪    币: 23
活跃值: (15)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
19
[QUOTE=hawkish;946697]思路很好,花了点时间,用MFC重写了。。。。
KillVirus.rar
[/QUOTE]

嘿嘿…不错…看看
2011-4-15 08:03
0
雪    币: 1556
活跃值: (315)
能力值: ( LV4,RANK:40 )
在线值:
发帖
回帖
粉丝
20
感谢LZ

不过如果只是MD5的话 多加一个字节就可以洗洗睡了吧?
2011-4-15 09:04
0
雪    币: 52
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
21
流量很贵的,哈哈,云端表示都这么玩,情何以堪
2011-4-17 09:38
0
雪    币: 291
活跃值: (25)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
22
思路很好~~~支持一下~
2011-4-17 21:47
0
雪    币: 6
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
23
同感,这个贵在思路清晰
2011-4-17 23:27
0
雪    币: 49
活跃值: (29)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
24
国内云查杀估计都是这样么?
2011-4-18 00:20
0
雪    币: 249
活跃值: (20)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
25
總感覺這不是雲查殺吧...........
2011-4-27 21:26
0
游客
登录 | 注册 方可回帖
返回

账号登录
验证码登录

忘记密码?
没有账号?立即免费注册