コード例 #1
0
        public static void Main(string[] args)
        {
            Console.Title = "Point Blank Socket";
SendInitia:
            Comp.Blue("╔════════════════════════════════════════════════════════════════════════════╗");
            Comp.Blue("║                                                                            ║");
            Comp.Blue("║               *</>  Developed by: (c) Wesley Vale - 2019  </>*             ║");
            Comp.Blue("║                                                                            ║");
            Comp.Blue("║                                                www.fb.com/wesley.vale.3192 ║");
            Comp.Blue("║                                                wpp: 92 99188-0629          ║");
            Comp.Blue("╚════════════════════════════════════════════════════════════════════════════╝");
            Comp.Blue("╔══════════════════════════════╗                                  build: 0.2");
            Comp.Blue("║        [ MENU ]              ║");
            Comp.Blue("║  -  t  (Flodar Pacotes tcp)  ║");
            Comp.Blue("║  -  u  (Flodar Pacotes tcp)  ║");
            Comp.Blue("╚══════════════════════════════╝");
            Comp.Yellow("[Console] Bem Vindo ao Point Blank SocketDump: ");
            string inicial = Console.ReadLine().ToLower();

            switch (inicial)
            {
            case "t":
            {
                if (!Sistema(inicial))
                {
                    return;
                }
                new Thread(() =>
                    {
                        int index = 0;
                        while (true)
                        {
                            try
                            {
                                byte[] buffer = new byte[0];
                                Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                                socket.Connect(new IPEndPoint(Address, Port));
                                if (socket.Connected)
                                {
                                    socket.BeginReceive(buffer, 0, buffer.Length, SocketFlags.None, (callback) =>
                                    {
                                        Socket id = (Socket)callback.AsyncState;
                                        if (id.Poll(0, SelectMode.SelectRead))
                                        {
                                            if (id.Receive(buffer, SocketFlags.Peek) == 0)
                                            {
                                                socket.Send(buffer, buffer.Length, SocketFlags.None);
                                                Comp.Green("[Socket TCP] Sending Packet Dump        nº[" + ++index + "]");
                                            }
                                        }
                                    }, socket);
                                }
                            }
                            catch (SocketException ex)
                            {
                                Comp.Red(ex.Message);
                                break;
                            }
                        }
                    }).Start(); break;
            }

            case "u":
            {
                if (!Sistema(inicial))
                {
                    return;
                }
                new Thread(() =>
                    {
                        for (int index = 0; index < IPEndPoint.MaxPort; index++)
                        {
                            try
                            {
                                UdpClient udp = new UdpClient(IP, Port);
                                if (udp.Available == 0)
                                {
                                    byte[] buff = SyncClient.Data();
                                    udp.Send(buff, buff.Length);
                                    Comp.Cyan("[Socket UDP] Sending Packet Dump           Buffer: [" + buff.Length + "]     nº[" + index + "]");
                                }
                            }
                            catch (SocketException ex)
                            {
                                Comp.Red(ex.ToString());
                                break;
                            }
                        }
                    }).Start();
                break;
            }

            default:
            {
                Comp.White("[Error] Erro ao registrar a conexão especifica.");
                Console.Clear();
                goto SendInitia;
            }
            }
            Process.GetCurrentProcess().WaitForExit();
        }