QQ蠕虫的行为检测方法
1、选题背景:
QQ蠕虫是一种利用QQ等腾讯公司相关产品进行传播的一种特殊蠕虫,该蠕虫的基本原理是利用了QQ帐户的快速登录机制,只要当前系统中有一个QQ帐户成功登录,就可以通过后台接口实现该帐户相关应用的快速登录而不需要再次输入帐户密码。登录后蠕虫可以访问QQ应用的各种网络接口,例如:通过接口实现加QQ好友、加入QQ群、发消息、发日志、发微博、上传群共享文件等操作,且完全不需要用户同意。借用这种技术,QQ蠕虫可以实现非常快速的传播。这种蠕虫诞生于QQ体系之上,其影响和传播主要集中在国内地区,因此国外品牌的杀软对这类蠕虫识别和支持非常有限,国内的杀软品牌对该蠕虫检测也不是特别理想,从而导致了该QQ蠕虫的传播更加快速,影响范围更广。
基于以上信息,利用WinPcap技术抓取网络数据包,对HTTP POST包进行分析,过滤出对域名qq.com访问的数据包,但是由于WinPcap考虑到很多数据结构需要自己封装且时间很少,所以决定使用sharpPcap+C# 代替常用的 WinPcap+VC来捕获数据包
2、实现基本思路:
(1)经典的HTTP请求方式:
GET /somedir/page.html HTTP/1.1
Host: www.someschool.edu
Connection: close
User-agent: Mozilla/4.0
Accept-language: fr
(3)利用这个我们就可以用 sharpPcap 技术抓取网络数据包,在数据包中判断TCP数据报文里是否保存了HTTP数据。如果有HTTP数据且是请求报文,就获得了HTTP的 GET、POST 请求数据后进行解析,数据的解析可以通过Content-Type分析数据格式,并按照相应的解析方式进行解码,解码过程中还有对于中文字符的处理等等。
3、部分功能实现
基于sharpPcap,C#写的抓包程序源代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SharpPcap;
namespace SharpPcapTest
{
class Program
{
static void Main(string[] args)
{
PacketArrivalForm packArrivalForm = new PacketArrivalForm();
packArrivalForm.ShowDialog();
FileOperate fileOperate = new FileOperate();
string ver = SharpPcap.Version.VersionString;
Console.WriteLine("SharpPcap {0}, Example1.IfList.cs", ver);
String strTemp = "SharpPcap" + ver + "\n";
fileOperate.wtiteToTxtFile(@".\123.txt", strTemp);
// Retrieve the device list
var devices = LivePcapDeviceList.Instance;
// If no devices were found print an error
if (devices.Count < 1)
{
Console.WriteLine("No devices were found on this machine");
return;
}
Console.WriteLine("\nThe following devices are available on this machine:");
Console.WriteLine("----------------------------------------------------\n");
/* Scan the list printing every entry */
/*获取驱动列表*/
foreach (var dev in devices)
{
//Console.WriteLine("{0}\n", dev.ToString());
fileOperate.wtiteToTxtFile(@".\123.txt", dev.ToString());
strTemp += dev.ToString();
}
//在对话框中显示相关的设备信息
ShowForm showForm = new ShowForm();
showForm.setRichTextBoxStr(strTemp);
showForm.ShowDialog();
/*接收数据包时间等各种数据*/
int i = int.Parse(Console.ReadLine());
LivePcapDevice device = devices[i];
// Register our handler function to the 'packet arrival' event
device.OnPacketArrival += new PacketArrivalEventHandler(device_OnPacketArrival);
// Open the device for capturing
int readTimeoutMilliseconds = 1000;
device.Open(DeviceMode.Promiscuous, readTimeoutMilliseconds);
Console.WriteLine();
Console.WriteLine("-- Listening on {0}, hit 'Enter' to stop...",device.Description);
strTemp = "Hour\tMinute\tSecond\tMillisecond\tlen\n";
fileOperate.wtiteToTxtFile(@".\data.txt", strTemp);
// Start the capturing process
device.StartCapture();
// Wait for 'Enter' from the user.
Console.ReadLine();
// Stop the capturing process
device.StopCapture();
Console.WriteLine("-- Capture stopped.");
// Print out the device statistics
Console.WriteLine(device.Statistics().ToString());
fileOperate.wtiteToTxtFile(@".\data.txt", device.Statistics().ToString());
Console.Write("Hit 'Enter' to exit...");
Console.ReadLine();
}
private static void device_OnPacketArrival(object sender, CaptureEventArgs e)
{
FileOperate fileOperate = new FileOperate();
var time = e.Packet.Timeval.Date;
var len = e.Packet.Data.Length;
Console.WriteLine("{0}:{1}:{2},{3} Len={4}",time.Hour, time.Minute, time.Second, time.Millisecond, len);
string strTemp = time.Hour.ToString() + "\t" + time.Minute.ToString() + "\t" + time.Second.ToString() + "\t" + time.Millisecond.ToString() + "\t\t" + len.ToString() + "\n";
Console.WriteLine(e.Packet.ToString());
strTemp += "\n" + e.Packet.ToString() + "\n";
fileOperate.wtiteToTxtFile(@".\data.txt", strTemp);
}
}
}
获取数据包数据截图:
完整源码就不附上了,附上exe下载地址:http://pan.baidu.com/s/1mgp3kWo
普推下Team:Gulity-Thron
评论7次
http://www.baidu.com/s?ie=utf-8&bs=http%3A%2F%2F10.0.0.2%2F&f=8&rsv_bp=1&rsv_spt=3&wd=%E8%AE%AF%E5%85%AC%E5%8F%B8%E7%9B%B8%E5%85%B3%E4%BA%A7%E5%93%81%E8%BF%9B%E8%A1%8C%E4%BC%A0%E6%92%AD%E7%9A%84%E4%B8%80%E7%A7%8D%E7%89%B9%E6%AE%8A%E8%A0%95%E8%99%AB%EF%BC%8C%E8%AF%A5%E8%A0%95%E8%99%AB%E7%9A%84%E5%9F%BA%E6%9C%AC%E5%8E%9F%E7%90%86%E6%98%AF%E5%88%A9%E7%94%A8%E4%BA%86QQ%E5%B8%90%E6%88%B7%E7%9A%84%E5%BF%AB%E9%80%9F%E7%99%BB%E5%BD%95%E6%9C%BA%E5%88%B6%EF%BC%8C%E5%8F%AA%E8%A6%81%E5%BD%93%E5%89%8D%E7%B3%BB%E7%BB%9F%E4%B8%AD%E6%9C%89%E4%B8%80%E4%B8%AAQQ%E5%B8%90%E6%88%B7%E6%88%90%E5%8A%9F%E7%99%BB%E5%BD%95%EF%BC%8C%E5%B0%B1%E5%8F%AF%E4%BB%A5%E9%80%9A%E8%BF%87%E5%90%8E%E5%8F%B0%E6%8E%A5%E5%8F%A3%E5%AE%9E%E7%8E%B0%E8%AF%A5%E5%B8%90%E6%88%B7%E7%9B%B8%E5%85%B3%E5%BA%94%E7%94%A8
你想说明什么?你不看看转载自哪里都?Nandi‘s Blog,那是前几个月我写的是非完整版的,你是不是觉得你好厉害,发现了某个秘密
http://www.baidu.com/s?ie=utf-8&bs=http%3A%2F%2F10.0.0.2%2F&f=8&rsv_bp=1&rsv_spt=3&a ... %AF%A5%E5%B8%90%E6%88%B7%E7%9B%B8%E5%85%B3%E5%BA%94%E7%94%A8
我以为QQ蠕虫在08年之后就绝迹了难道还能找到?
哪里都有,Leptous、QQwei
我以为QQ蠕虫在08年之后就绝迹了 难道还能找到?
@meao 推销,cps,cpa等等等。赚钱利器。
真的看不懂啊 不懂有什么用
很厲害的樣子 雖然看不懂