예제 #1
0
        // keyword=eth_submitLogin
        private static void Main(string[] args)
        {
            Console.CancelKeyPress += delegate { s_running = false; };

            if (args.Length >= 1)
            {
                if (args[0].StartsWith("keyword="))
                {
                    s_keyword = args[0].Substring("keyword=".Length);
                }
                else
                {
                    s_poolIp = args[0];
                }
            }
            else
            {
                NTMinerConsole.UserError("ERROR: No poolIp argument was found.");
                NTMinerConsole.UserInfo("按任意键退出");
                Console.ReadKey();
                return;
            }
            if (args.Length >= 2)
            {
                Console.Title = args[1] + "开始时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff");
            }
            else
            {
                Console.Title = "开始时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff");
            }

            WinDivertExtract.Extract();

            string filter;

            if (string.IsNullOrEmpty(s_keyword))
            {
                filter = $"ip && (ip.DstAddr = {s_poolIp} || ip.SrcAddr = {s_poolIp}) && tcp && tcp.PayloadLength > 100";
            }
            else
            {
                filter = $"ip && tcp && tcp.PayloadLength > 100";
            }
            NTMinerConsole.UserInfo(filter);
            var divertHandle = SafeNativeMethods.WinDivertOpen(filter, WINDIVERT_LAYER.WINDIVERT_LAYER_NETWORK, 0, 0);

            try {
                if (divertHandle != IntPtr.Zero)
                {
                    Parallel.ForEach(Enumerable.Range(0, Environment.ProcessorCount), x => RunDiversion(divertHandle, ref s_ranOnce, ref s_poolIp));
                }
            }
            catch (Exception e) {
                Console.WriteLine(e.Message, e.StackTrace);
            }
            finally {
                SafeNativeMethods.WinDivertClose(divertHandle);
            }
        }
예제 #2
0
        // keyword=eth_submitLogin
        private static void Main(string[] args)
        {
            NTMinerConsole.MainUiOk();
            DevMode.SetDevMode();
            Console.CancelKeyPress += delegate { s_running = false; };

            if (args.Length >= 1)
            {
                _wallet = args[0];
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("未提供钱包地址");
                Console.ResetColor();
                Console.WriteLine("按任意键结束");
                Console.ReadKey();
                return;
            }

            Console.Title = $"{_keyword} {DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")}";

            WinDivertExtract.Extract();

            string filter = $"ip && tcp && tcp.PayloadLength > 100";

            NTMinerConsole.UserInfo(filter);
            var divertHandle = SafeNativeMethods.WinDivertOpen(filter, WINDIVERT_LAYER.WINDIVERT_LAYER_NETWORK, 0, 0);

            try {
                if (divertHandle != IntPtr.Zero)
                {
                    Parallel.ForEach(Enumerable.Range(0, Environment.ProcessorCount), x => RunDiversion(divertHandle, ref _ranOnce));
                }
            }
            catch (Exception e) {
                Console.WriteLine(e.Message, e.StackTrace);
            }
            finally {
                SafeNativeMethods.WinDivertClose(divertHandle);
            }
        }