示例#1
0
        /// <summary>
        /// 从所有网卡上开始抓包
        /// </summary>
        public void startCapture()
        {
            Debug.WriteLine("[+]一个游戏( " + port + " )准备开始抓包...");
            this.bufferList = new List <RawCapture>();
            this.clear();         // 清理原有的数据
            this.isStartAnalyzer = true;
            this.startAnalyzer(); // 启动分析线程
            naList = new List <ICaptureDevice>();

            //foreach (ICaptureDevice device in CaptureDeviceManager.getInstance()) {
            var devices = CaptureDeviceManager.getInstance();

            for (int i = 0; i < devices.Count; i++)
            {
                if (devices[i].Description.Contains("VMware") || devices[i].Description.Contains("TAP-Windows Adapter"))
                {
                    Debug.WriteLine("[-]端口( " + port + " )在" + devices[i].Description + " 已忽略...");
                    continue; //跳过虚拟网卡和SS-TAP
                }
                // 这里必须使用CaptureDeviceList.New()[i]获取新实例, 虽然很慢, 但是没有解决办法
                // 如果使用devices[i] 那表示使用的还是同一块网卡, 绑定多个过滤器, 并不是多网卡实例 会导致多个Game收到同样的内容
                ICaptureDevice device = CaptureDeviceList.New()[i];
                //ICaptureDevice device = devices[i];

                try {
                    device.OnPacketArrival += new PacketArrivalEventHandler(this.device_OnPacketArrival);
                    device.Open(Settings.devMode, Settings.readTimeOut);
                    device.Filter = "port " + this.port;
                    device.StartCapture();
                } catch (Exception ex) {
                    MessageBox.Show(ex.Message);
                }
                naList.Add(device);
                Debug.WriteLine("[+]端口( " + port + " )在" + device.Description + " 初始化完毕...");
            }
            this.isStartMonitor = true;
            this.startMonitor();// 启动掉线监测
            Debug.WriteLine("[+]一个游戏( " + port + " )抓包已启动完毕...");
        }
示例#2
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            Debug.WriteLine("[*]CDM初始化中...");
            CaptureDeviceManager.getInstance();
            Debug.WriteLine("[+]CDM初始化完毕...");

            // 初始化游戏进程
            Process[] processes = Process.GetProcessesByName(gameName);
            foreach (Process p in processes)
            {
                gameList.Add(MethodUtils.GetCharacter(p));
            }
            Debug.WriteLine("[+]已启动的游戏搜寻完毕. found: " + gameList.Count);

            // 启动更新线程 读取内存
            UpdateThread = new Thread(UpdateInfo);
            UpdateThread.IsBackground = true;
            UpdateThread.Start();
            Debug.WriteLine("[+]读取内存进程启动完毕...");

            // 启动寻找游戏线程 每5秒寻找一次游戏
            UpdateGameThread = new Thread(GetGameWindow);
            UpdateGameThread.IsBackground = true;
            UpdateGameThread.Start();
            Debug.WriteLine("[+]游戏寻找进程启动完毕...");

            this.gridControl1.DataSource = gameList; // 设置数据源
            this.columnSDPercent.Visible = false;    // 隐藏SD条

            // 游戏抓包启动

            /*
             * int count = 0;
             * foreach (Game g in gameList) {
             *  if (g.Port != -1 && !g.IsStartAnalyzer) {
             *      g.startCapture();
             *      g.MessageDone += handleMessage;
             *      count++;
             *  }
             * }
             * Debug.WriteLine("[+]" + count + "个游戏的抓包已启动(" + (gameList.Count - count) + "个未启动)...");
             * // 这里不用手动启动了 搜寻线程中会自动启动所有不是 -1端口 且 没启动抓包的进程
             */

            // listBoxControl1.Items.Add("若此处消息无法正常显示, 请在\"网络\"选项中调整网卡设置...");
            listBoxControl1.Items.Add("所有的新用户可以免费试用7天...");
            listBoxControl1.Items.Add("挂机助手与硬件绑定, 请在需要使用的电脑上进行充值操作...");
            listBoxControl1.Items.Add("新版挂机助手核心代码全部重写. 稳定性更好, 兼容性更强. 但首次截获数据耗时变长...");
            listBoxControl1.Items.Add("如果需要死亡/掉线通知, 请务必记得填写邮箱地址, 且要将发件人设置为收件白名单, 否则只能收到一封邮件...");
            listBoxControl1.Items.Add("发件人地址: [email protected]");
            listBoxControl2.Items.Add("此处记录Boss死亡/刷新时间, 请在上方勾选记录Boss信息...");
            ActiveUser ac = null;

            try {
                string json = MethodUtils.HttpGet(host + auth + uid);
                ac = JsonConvert.DeserializeObject <ActiveUser>(json);
                barStaticItemExpire.Caption = "可用时间: " + ac.countdown;
                this.token = ac.token;
            } catch (Exception) {
                this.kill();
                MessageBox.Show("网络验证失败, 此版本已经停止服务... 请更新至最新版", "错误");
                Application.Exit();
            }
            Debug.WriteLine("[+]VCS账号校验完毕...");
            if (ac.status)
            {
                // 启动VCS线程
                VCSThread = new Thread(vcs);
                VCSThread.IsBackground = true;
                VCSThread.Start();
                allowClose = true;
                Debug.WriteLine("[+]VCS账号可用, VCS线程启动...");
            }
            else
            {
                // 开启时已经过期
                this.kill();
                MessageBox.Show("您的账号已到期, 所有功能暂停使用, 请充值后继续...", "提示");
                Debug.WriteLine("[-]VCS账号已过期, 所有线程已摧毁...");
            }
        }