Exemplo n.º 1
0
        private Task WaitForClient()
        {
            socket.Close();
            return(Task.Factory.StartNew(() => {
                byte[] data = new byte[1024];
                IPEndPoint ipep = new IPEndPoint(IPAddress.Any, 28960);
                newsock = new UdpClient(ipep);
                Print.Info("Waiting for a client...");
                IPEndPoint sender = new IPEndPoint(IPAddress.Any, 0);
                while (!iSClosing)
                {
                    try
                    {
                        data = newsock.Receive(ref sender);

                        string message = Encoding.ASCII.GetString(data, 0, data.Length);
                        PacketReceived(this, new PacketReceivedEventArgs {
                            from = sender,
                            message = Encoding.ASCII.GetString(data, 0, data.Length).Substring(4),
                            type = message.Contains("getstatus") ? PacketReceivedType.GETSTATUS : PacketReceivedType.GETINFO,
                            stream = newsock
                        });
                    }
                    catch (Exception e) { Print.Error(e.Message); }
                }
            }));
        }
Exemplo n.º 2
0
        public static string GenerateNonce()
        {
            var    random = new Random();
            string s      = "";

            for (int i = 0; i < 10; i++)
            {
                s += random.Next(10);
            }
            Print.Info("Nonce Generated: " + s);
            return(s);
        }
Exemplo n.º 3
0
 private void Init()
 {
     try
     {
         Print.Info(Tag + ": Initialzing Socket");
         socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
         socket.Bind(new IPEndPoint(IPAddress.Any, Port));
         Print.Success(Tag + ": Socket Bound to Port " + Port);
         ConnectToMasterServer();
         Send(PacketTypes.HeartBeat_Flat);
         Thread.Sleep(1000);
         Send(PacketTypes.HeartBeat);
     }
     catch (Exception e) { Print.Error(e.Message); }
 }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            Console.Title = "";
            Print.Info("\r \n^7Title: ^3Fake Server Launcher^7\nAuthor: ^3Poyser^7\n\nHow to: ^3Make Changes to config.json to add/edit multiple servers^7 ^2:)\n^5CTRL+C ^7to to Unresgister servers and exit.\n");
            FserverManager fM = new FserverManager("config.json");

            fM.Init();

            foreach (FServer s in fM.FServers)
            {
                Print.Info("Starting " + s.Tag + "..");
                s.PacketReceived += PacketReceived;
                s.Start();
            }
            Thread.Sleep(Timeout.Infinite);
        }
Exemplo n.º 5
0
 private void Console_CancelKeyPress(object sender, ConsoleCancelEventArgs e)
 {
     try
     {
         iSClosing = true;
         newsock.Close();
         socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
         socket.Bind(new IPEndPoint(IPAddress.Any, Port));
         socket.Connect(masterserver);
         Send(PacketTypes.HeartBeat_Flat);
         Print.Success("Closing Server with flatline");
         Print.Info("\nPress any key to exit");
         Console.ReadKey();
         Environment.Exit(0);
     }
     catch (Exception x) { Print.Error(x.Message); Environment.Exit(0); }
 }
Exemplo n.º 6
0
 public void Init()
 {
     Print.Info("Parsing " + this.jsonpath + "..");
     try
     {
         FServers = JsonConvert.DeserializeObject <List <FServer> >(File.ReadAllText(this.jsonpath));
         string servers = "[";
         foreach (FServer s in FServers)
         {
             servers += "^2" + s.Tag + "^7:^2" + s.Port + "^7,";
         }
         Print.Success(this.jsonpath + " loaded with ^2" + FServers.Count + " ^7entries " + servers.Substring(0, servers.Length - 1) + "]");
     }
     catch (Exception e)
     {
         Print.Error(e.Message);
     }
 }
Exemplo n.º 7
0
        public async void DataCallBack(IAsyncResult result)
        {
            byte[] receivedata = new byte[3000];
            receivedata = (byte[])result.AsyncState;

            string respon = Encoding.Default.GetString(receivedata).Replace('\0', ' ').Replace('ÿ', ' ').Trim();

            if (respon != "")
            {
                Print.Success("Response: " + respon);
            }
            //getstatus -1051696178
            //statusResponse\g_compassShowEnemies\0\g_gametype\war\gamename\Call of Duty 4\mapname\mp_backlot\protocol\6\shortversion\1.7\sv_allowAnonymous\0\sv_disableClientConsole\0\sv_floodprotect\4\sv_hostname\1234\sv_maxclients\24\sv_maxPing\600\sv_maxRate\25000\sv_minPing\0\sv_privateClients\0\sv_punkbuster\0\sv_pure\1\sv_voice\1\ui_maxclients\32\challenge\-1051696178\pswrd\0\mod\0

            if (respon.Contains("getstatus"))
            {
                nonce = respon.Replace("getstatus", "").Trim();
                Print.Success(Tag + ": Nonce detected @" + nonce);

                ConnectToMasterAuthServer();

                Print.Info(Tag + ": Sending Spoofed IpAuthorizePacket to MasterAuthServer@" + masterauthserver.Address + ":" + masterauthserver.Port);
                Send(PacketTypes.IpAuthorizePacket());

                ConnectToMasterServer();
                Print.Info(Tag + ": Sending Spoofed statusResponse to " + "MasterServer@" + masterserver.Address + ":" + masterserver.Port);
                Send(PacketTypes.Convert(GenerateServerStatusString()));

                Print.Info("\n\t\t\t\t" + Tag + " ^2Registered To MasterServer^7\n");
                await WaitForClient();

                return;
            }

            receivedata = new byte[3000];
            if (socket.Connected)
            {
                socket.BeginReceive(receivedata, 0, receivedata.Length, SocketFlags.None, new AsyncCallback(DataCallBack), receivedata);
            }
        }
Exemplo n.º 8
0
 private void ConnectToMasterServer()
 {
     Print.Info(Tag + ": Connecting to Master server @" + masterserver.Address + ":" + masterserver.Port);
     socket.Connect(masterserver);
     Print.Success(Tag + ": Connected to Master MasterServer@" + masterserver.Address + ":" + masterserver.Port);
 }