示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public TestClient Login(string[] args)
        {
            LoginDetails account = new LoginDetails();

            account.FirstName = args[0];
            account.LastName  = args[1];
            account.Password  = args[2];

            return(Login(account));
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public TestClient Login(string[] args)
        {
            LoginDetails account = new LoginDetails();

            account.FirstName = args[0];
            account.LastName  = args[1];
            account.Password  = args[2];

            if (args.Length == 4)
            {
                account.StartLocation = NetworkManager.StartLocation(args[3], 128, 128, 40);
            }

            return(Login(account));
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="account"></param>
        /// <returns></returns>
        public TestClient Login(LoginDetails account)
        {
            // Check if this client is already logged in
            foreach (TestClient c in Clients.Values)
            {
                if (c.Self.FirstName == account.FirstName && c.Self.LastName == account.LastName)
                {
                    Logout(c);
                    break;
                }
            }

            TestClient client = new TestClient(this);

            client.SimPrims = SimPrims;
            client.Master = account.Master;

            bool login = client.Network.Login(account.FirstName, account.LastName, account.Password,
                "TestClient", "*****@*****.**");

            if (client.Network.Connected)
            {
                Clients[client.Network.AgentID] = client;

                Console.WriteLine("Logged in " + client.ToString());

                // Throttle the connection to not receive LayerData or asset packets
                client.Throttle.Total = 0.0f;
                client.Throttle.Task = 1536000.0f;
                client.Throttle.Set();
            }
            else
            {
                Console.WriteLine("Failed to login " + account.FirstName + " " + account.LastName +
                    ": " + client.Network.LoginError);
            }

            return client;
        }
示例#4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="account"></param>
        /// <returns></returns>
        public TestClient Login(LoginDetails account)
        {
            // Check if this client is already logged in
            foreach (TestClient c in Clients.Values)
            {
                if (c.Self.FirstName == account.FirstName && c.Self.LastName == account.LastName)
                {
                    Logout(c);
                    break;
                }
            }

            TestClient client = new TestClient(this);

            client.SimPrims = SimPrims;
            client.Master   = account.Master;

            bool login = client.Network.Login(account.FirstName, account.LastName, account.Password,
                                              "TestClient", "*****@*****.**");

            if (client.Network.Connected)
            {
                Clients[client.Network.AgentID] = client;

                Console.WriteLine("Logged in " + client.ToString());

                // Throttle the connection to not receive LayerData or asset packets
                client.Throttle.Total = 0.0f;
                client.Throttle.Task  = 1536000.0f;
                client.Throttle.Set();
            }
            else
            {
                Console.WriteLine("Failed to login " + account.FirstName + " " + account.LastName +
                                  ": " + client.Network.LoginError);
            }

            return(client);
        }
示例#5
0
        static void Main(string[] args)
        {
            Arguments arguments = new Arguments(args);

            ClientManager       manager;
            List <LoginDetails> accounts = new List <LoginDetails>();
            LoginDetails        account;
            string masterName = String.Empty;
            LLUUID masterKey  = LLUUID.Zero;
            string file       = String.Empty;
            string loginuri   = String.Empty;

            try
            {
                if (arguments["masterkey"] != null)
                {
                    masterKey = LLUUID.Parse(arguments["masterkey"]);
                }

                if (arguments["master"] != null)
                {
                    masterName = arguments["master"];
                }

                if (arguments["loginuri"] != null)
                {
                    loginuri = arguments["loginuri"];
                }

                if (arguments["file"] != null)
                {
                    file = arguments["file"];

                    // Loading names from a file
                    try
                    {
                        using (StreamReader reader = new StreamReader(file))
                        {
                            string line;
                            int    lineNumber = 0;

                            while ((line = reader.ReadLine()) != null)
                            {
                                lineNumber++;
                                string[] tokens = line.Trim().Split(new char[] { ' ', ',' });

                                if (tokens.Length >= 3)
                                {
                                    account           = new LoginDetails();
                                    account.FirstName = tokens[0];
                                    account.LastName  = tokens[1];
                                    account.Password  = tokens[2];

                                    accounts.Add(account);

                                    // Leaving this out until we have per-account masters (if that
                                    // is desirable). For now the command-line option can
                                    // specify the single master that TestClient supports

                                    //if (tokens.Length == 5)
                                    //{
                                    //    master = tokens[3] + " " + tokens[4];
                                    //}
                                }
                                else
                                {
                                    Console.WriteLine("Invalid data on line " + lineNumber +
                                                      ", must be in the format of: FirstName LastName Password");
                                }
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Error reading from " + args[1]);
                        Console.WriteLine(e.ToString());
                        return;
                    }
                }
                else if (arguments["first"] != null && arguments["last"] != null && arguments["pass"] != null)
                {
                    // Taking a single login off the command-line
                    account           = new LoginDetails();
                    account.FirstName = arguments["first"];
                    account.LastName  = arguments["last"];
                    account.Password  = arguments["pass"];

                    accounts.Add(account);
                }
                else
                {
                    throw new CommandLineArgumentsException();
                }
            }

            catch (CommandLineArgumentsException)
            {
                Usage();
                return;
            }

            foreach (LoginDetails a in accounts)
            {
                a.MasterName = masterName;
                a.MasterKey  = masterKey;
                a.URI        = loginuri;
            }

            // Login the accounts and run the input loop
            if (arguments["startpos"] != null)
            {
                manager = new ClientManager(accounts, arguments["startpos"]);
            }
            else
            {
                manager = new ClientManager(accounts);
            }

            manager.Run();
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public TestClient Login(string[] args)
        {
            LoginDetails account = new LoginDetails();
            account.FirstName = args[0];
            account.LastName = args[1];
            account.Password = args[2];

            return Login(account);
        }
示例#7
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="account"></param>
        /// <returns></returns>
        public TestClient Login(LoginDetails account)
        {
            // Check if this client is already logged in
            foreach (TestClient c in Clients.Values)
            {
                if (c.Self.FirstName == account.FirstName && c.Self.LastName == account.LastName)
                {
                    Logout(c);
                    break;
                }
            }

            TestClient client = new TestClient(this);

            // Optimize the throttle
            client.Throttle.Wind = 0;
            client.Throttle.Cloud = 0;
            client.Throttle.Land = 1000000;
            client.Throttle.Task = 1000000;

			client.MasterName = account.MasterName;
            client.MasterKey = account.MasterKey;

            NetworkManager.LoginParams loginParams = client.Network.DefaultLoginParams(
                    account.FirstName, account.LastName, account.Password, "TestClient", contactPerson);

            if (!String.IsNullOrEmpty(account.StartLocation))
                loginParams.Start = account.StartLocation;

            if (!String.IsNullOrEmpty(account.URI))
                loginParams.URI = account.URI;
            
            if (!client.Network.Login(loginParams))
            {
                Console.WriteLine("Failed to login " + account.FirstName + " " + account.LastName + ": " +
                    client.Network.LoginMessage);
            }

            if (client.Network.Connected)
            {
                if (account.MasterKey == LLUUID.Zero && !String.IsNullOrEmpty(account.MasterName))
                {
                    Console.WriteLine("Resolving {0}'s UUID", account.MasterName);
                    // Find master's key from name
                    DirectoryManager.DirPeopleReplyCallback callback = new DirectoryManager.DirPeopleReplyCallback(KeyResolvHandler);
                    client.Directory.OnDirPeopleReply += callback;
                    client.Directory.StartPeopleSearch(DirectoryManager.DirFindFlags.People, account.MasterName, 0);
                    if (keyResolution.WaitOne(TimeSpan.FromMinutes(1), false))
                    {
                        account.MasterKey = resolvedMasterKey;
                        Console.WriteLine("\"{0}\" resolved to {1}", account.MasterName, account.MasterKey);
                    }
                    else
                    {
                        Console.WriteLine("Unable to obtain UUID for \"{0}\". No master will be used. Try specifying a key with --masterkey.", account.MasterName);
                    }
                    client.Directory.OnDirPeopleReply -= callback;
                    keyResolution.Reset();
                }

                client.MasterKey = account.MasterKey;

                Clients[client.Self.AgentID] = client;

                Console.WriteLine("Logged in " + client.ToString());
            }

            return client;
        }
示例#8
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public TestClient Login(string[] args)
        {
            LoginDetails account = new LoginDetails();
            account.FirstName = args[0];
            account.LastName = args[1];
            account.Password = args[2];

            if (args.Length == 4)
            {
                account.StartLocation = NetworkManager.StartLocation(args[3], 128, 128, 40);
            }

            return Login(account);
        }
示例#9
0
        static void Main(string[] args)
        {
            Arguments arguments = new Arguments(args);

            ClientManager manager;
            List<LoginDetails> accounts = new List<LoginDetails>();
            LoginDetails account;
            string masterName = String.Empty;
            LLUUID masterKey = LLUUID.Zero;
            string file = String.Empty;
			string loginuri = String.Empty;

            try
            {
                if (arguments["masterkey"] != null)
                {
                    masterKey = LLUUID.Parse(arguments["masterkey"]);
                }

                if (arguments["master"] != null)
                {
                    masterName = arguments["master"];
                }

                if (arguments["loginuri"] != null)
                {
                    loginuri = arguments["loginuri"];
                }

                if (arguments["file"] != null)
                {
                    file = arguments["file"];

                    // Loading names from a file
                    try
                    {
                        using (StreamReader reader = new StreamReader(file))
                        {
                            string line;
                            int lineNumber = 0;

                            while ((line = reader.ReadLine()) != null)
                            {
                                lineNumber++;
                                string[] tokens = line.Trim().Split(new char[] { ' ', ',' });

                                if (tokens.Length >= 3)
                                {
                                    account = new LoginDetails();
                                    account.FirstName = tokens[0];
                                    account.LastName = tokens[1];
                                    account.Password = tokens[2];

                                    accounts.Add(account);

                                    // Leaving this out until we have per-account masters (if that
                                    // is desirable). For now the command-line option can 
                                    // specify the single master that TestClient supports

                                    //if (tokens.Length == 5)
                                    //{
                                    //    master = tokens[3] + " " + tokens[4];
                                    //}
                                }
                                else
                                {
                                    Console.WriteLine("Invalid data on line " + lineNumber +
                                        ", must be in the format of: FirstName LastName Password");
                                }
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Error reading from " + args[1]);
                        Console.WriteLine(e.ToString());
                        return;
                    }
                }
                else if (arguments["first"] != null && arguments["last"] != null && arguments["pass"] != null)
                {
                    // Taking a single login off the command-line
                      account = new LoginDetails();
                      account.FirstName = arguments["first"];
                      account.LastName = arguments["last"];
                      account.Password = arguments["pass"];
  
                      accounts.Add(account);
              
                }
                else
                {
                    throw new CommandLineArgumentsException();
                }
            }

            catch (CommandLineArgumentsException)
            {
                Usage();
                return;
            }

            foreach (LoginDetails a in accounts)
            {
                a.MasterName = masterName;
                a.MasterKey = masterKey;
                a.URI = loginuri;
            }

            // Login the accounts and run the input loop
            if (arguments["startpos"] != null)
            {
                manager = new ClientManager(accounts, arguments["startpos"]);
            }
            else
            {
                manager = new ClientManager(accounts);
            }

            manager.Run();
        }
示例#10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="account"></param>
        /// <returns></returns>
        public TestClient Login(LoginDetails account)
        {
            // Check if this client is already logged in
            foreach (TestClient c in Clients.Values)
            {
                if (c.Self.FirstName == account.FirstName && c.Self.LastName == account.LastName)
                {
                    Logout(c);
                    break;
                }
            }

            TestClient client = new TestClient(this);

            // Optimize the throttle
            client.Throttle.Wind  = 0;
            client.Throttle.Cloud = 0;
            client.Throttle.Land  = 1000000;
            client.Throttle.Task  = 1000000;

            client.GroupCommands = account.GroupCommands;
            client.MasterName    = account.MasterName;
            client.MasterKey     = account.MasterKey;

            LoginParams loginParams = client.Network.DefaultLoginParams(
                account.FirstName, account.LastName, account.Password, "TestClient", version);

            if (!String.IsNullOrEmpty(account.StartLocation))
            {
                loginParams.Start = account.StartLocation;
            }

            if (!String.IsNullOrEmpty(account.URI))
            {
                loginParams.URI = account.URI;
            }

            if (client.Network.Login(loginParams))
            {
                if (account.MasterKey == LLUUID.Zero && !String.IsNullOrEmpty(account.MasterName))
                {
                    // To prevent security issues, we must resolve the specified master name to a key.
                    ManualResetEvent keyResolution = new ManualResetEvent(false);
                    List <DirectoryManager.AgentSearchData> masterMatches = new List <DirectoryManager.AgentSearchData>();

                    // Set up the callback that handles the search results:
                    DirectoryManager.DirPeopleReplyCallback callback =
                        delegate(LLUUID queryID, List <DirectoryManager.AgentSearchData> matches) {
                        // This may be called several times with additional search results.
                        if (matches.Count > 0)
                        {
                            lock (masterMatches)
                            {
                                masterMatches.AddRange(matches);
                            }
                        }
                        else
                        {
                            // No results to show.
                            keyResolution.Set();
                        }
                    };
                    // Find master's key from name
                    Console.WriteLine("Resolving {0}'s UUID", account.MasterName);
                    client.Directory.OnDirPeopleReply += callback;
                    client.Directory.StartPeopleSearch(DirectoryManager.DirFindFlags.People, account.MasterName, 0);
                    keyResolution.WaitOne(TimeSpan.FromSeconds(30), false);
                    client.Directory.OnDirPeopleReply -= callback;

                    LLUUID masterKey  = LLUUID.Zero;
                    string masterName = account.MasterName;
                    lock (masterMatches) {
                        if (masterMatches.Count == 1)
                        {
                            masterKey  = masterMatches[0].AgentID;
                            masterName = masterMatches[0].FirstName + " " + masterMatches[0].LastName;
                        }
                        else if (masterMatches.Count > 0)
                        {
                            // Print out numbered list of masters:
                            Console.WriteLine("Possible masters:");
                            for (int i = 0; i < masterMatches.Count; ++i)
                            {
                                Console.WriteLine("{0}: {1}", i, masterMatches[i].FirstName + " " + masterMatches[i].LastName);
                            }
                            Console.Write("Ambiguous master, choose one: ");
                            // Read number from the console:
                            string read = null;
                            do
                            {
                                read = Console.ReadLine();
                                int choice = 0;
                                if (int.TryParse(read, out choice))
                                {
                                    if (choice == -1)
                                    {
                                        break;
                                    }
                                    else if (choice < masterMatches.Count)
                                    {
                                        masterKey  = masterMatches[choice].AgentID;
                                        masterName = masterMatches[choice].FirstName + " " + masterMatches[choice].LastName;
                                        break;
                                    }
                                    else
                                    {
                                        Console.WriteLine("Please type a number from the above list, -1 to cancel.");
                                    }
                                }
                                else
                                {
                                    Console.WriteLine("You didn't type a number.");
                                    Console.WriteLine("Please type a number from the above list, -1 to cancel.");
                                }
                            } while (read != null); // Do it until the user selects a master.
                        }
                    }
                    if (masterKey != LLUUID.Zero)
                    {
                        Console.WriteLine("\"{0}\" resolved to {1} ({2})", account.MasterName, masterName, masterKey);
                        account.MasterName = masterName;
                        account.MasterKey  = masterKey;
                    }
                    else
                    {
                        Console.WriteLine("Unable to obtain UUID for \"{0}\". No master will be used. Try specifying a key with --masterkey.", account.MasterName);
                    }
                }

                client.MasterKey             = account.MasterKey;
                Clients[client.Self.AgentID] = client;

                Console.WriteLine("Logged in " + client.ToString());
            }
            else
            {
                Console.WriteLine("Failed to login " + account.FirstName + " " + account.LastName + ": " +
                                  client.Network.LoginMessage);
            }

            return(client);
        }
示例#11
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="account"></param>
        /// <returns></returns>
        public TestClient Login(LoginDetails account)
        {
            // Check if this client is already logged in
            foreach (TestClient c in Clients.Values)
            {
                if (c.Self.FirstName == account.FirstName && c.Self.LastName == account.LastName)
                {
                    Logout(c);
                    break;
                }
            }

            TestClient client = new TestClient(this);

            // Optimize the throttle
            client.Throttle.Wind = 0;
            client.Throttle.Cloud = 0;
            client.Throttle.Land = 1000000;
            client.Throttle.Task = 1000000;

            client.GroupCommands = account.GroupCommands;
			client.MasterName = account.MasterName;
            client.MasterKey = account.MasterKey;

            LoginParams loginParams = client.Network.DefaultLoginParams(
                    account.FirstName, account.LastName, account.Password, "TestClient", version);

            if (!String.IsNullOrEmpty(account.StartLocation))
                loginParams.Start = account.StartLocation;

            if (!String.IsNullOrEmpty(account.URI))
                loginParams.URI = account.URI;
            
            if (client.Network.Login(loginParams))
            {
                if (account.MasterKey == LLUUID.Zero && !String.IsNullOrEmpty(account.MasterName))
                {
                    // To prevent security issues, we must resolve the specified master name to a key.
                    ManualResetEvent keyResolution = new ManualResetEvent(false);
                    List<DirectoryManager.AgentSearchData> masterMatches = new List<DirectoryManager.AgentSearchData>();
                    
                    // Set up the callback that handles the search results:
                    DirectoryManager.DirPeopleReplyCallback callback = 
                        delegate (LLUUID queryID, List<DirectoryManager.AgentSearchData> matches) {
                            // This may be called several times with additional search results.
                            if (matches.Count > 0)
                            {
                                lock (masterMatches)
                                {
                                    masterMatches.AddRange(matches);
                                }
                            }
                            else
                            {
                                // No results to show.
                                keyResolution.Set();
                            }
                        };
                    // Find master's key from name
                    Console.WriteLine("Resolving {0}'s UUID", account.MasterName);
                    client.Directory.OnDirPeopleReply += callback;
                    client.Directory.StartPeopleSearch(DirectoryManager.DirFindFlags.People, account.MasterName, 0);
                    keyResolution.WaitOne(TimeSpan.FromSeconds(30), false);
                    client.Directory.OnDirPeopleReply -= callback;

                    LLUUID masterKey = LLUUID.Zero;
                    string masterName = account.MasterName;
                    lock (masterMatches) {
                        if (masterMatches.Count == 1) {
                            masterKey = masterMatches[0].AgentID;
                            masterName = masterMatches[0].FirstName + " " + masterMatches[0].LastName;
                        } else if (masterMatches.Count > 0) {
                            // Print out numbered list of masters:
                            Console.WriteLine("Possible masters:");
                            for (int i = 0; i < masterMatches.Count; ++i)
                            {
                                Console.WriteLine("{0}: {1}", i, masterMatches[i].FirstName + " " + masterMatches[i].LastName);
                            }
                            Console.Write("Ambiguous master, choose one: ");
                            // Read number from the console:
                            string read = null;
                            do
                            {
                                read = Console.ReadLine();
                                int choice = 0;
                                if (int.TryParse(read, out choice))
                                {
                                    if (choice == -1)
                                    {
                                        break;
                                    } 
                                    else if (choice < masterMatches.Count)
                                    {
                                        masterKey = masterMatches[choice].AgentID;
                                        masterName = masterMatches[choice].FirstName + " " + masterMatches[choice].LastName;
                                        break;
                                    }
                                    else
                                    {
                                        Console.WriteLine("Please type a number from the above list, -1 to cancel.");
                                    }
                                }
                                else
                                {
                                    Console.WriteLine("You didn't type a number.");
                                    Console.WriteLine("Please type a number from the above list, -1 to cancel.");
                                }
                            } while (read != null); // Do it until the user selects a master.
                        }
                    }
                    if (masterKey != LLUUID.Zero)
                    {
                        Console.WriteLine("\"{0}\" resolved to {1} ({2})", account.MasterName, masterName, masterKey);
                        account.MasterName = masterName;
                        account.MasterKey = masterKey;
                    }
                    else
                    {
                        Console.WriteLine("Unable to obtain UUID for \"{0}\". No master will be used. Try specifying a key with --masterkey.", account.MasterName);
                    }
                }

                client.MasterKey = account.MasterKey;
                Clients[client.Self.AgentID] = client;

                Console.WriteLine("Logged in " + client.ToString());
            }
            else
            {
                Console.WriteLine("Failed to login " + account.FirstName + " " + account.LastName + ": " +
                    client.Network.LoginMessage);
            }

            return client;
        }
示例#12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="account"></param>
        /// <returns></returns>
        public TestClient Login(LoginDetails account)
        {
            // Check if this client is already logged in
            foreach (TestClient c in Clients.Values)
            {
                if (c.Self.FirstName == account.FirstName && c.Self.LastName == account.LastName)
                {
                    Logout(c);
                    break;
                }
            }

            TestClient client = new TestClient(this);

            // Optimize the throttle
            client.Throttle.Wind  = 0;
            client.Throttle.Cloud = 0;
            client.Throttle.Land  = 1000000;
            client.Throttle.Task  = 1000000;

            client.MasterName = account.MasterName;
            client.MasterKey  = account.MasterKey;

            LoginParams loginParams = client.Network.DefaultLoginParams(
                account.FirstName, account.LastName, account.Password, "TestClient", version);

            if (!String.IsNullOrEmpty(account.StartLocation))
            {
                loginParams.Start = account.StartLocation;
            }

            if (!String.IsNullOrEmpty(account.URI))
            {
                loginParams.URI = account.URI;
            }

            if (!client.Network.Login(loginParams))
            {
                Console.WriteLine("Failed to login " + account.FirstName + " " + account.LastName + ": " +
                                  client.Network.LoginMessage);
            }

            if (client.Network.Connected)
            {
                if (account.MasterKey == LLUUID.Zero && !String.IsNullOrEmpty(account.MasterName))
                {
                    Console.WriteLine("Resolving {0}'s UUID", account.MasterName);
                    // Find master's key from name
                    DirectoryManager.DirPeopleReplyCallback callback = new DirectoryManager.DirPeopleReplyCallback(KeyResolvHandler);
                    client.Directory.OnDirPeopleReply += callback;
                    client.Directory.StartPeopleSearch(DirectoryManager.DirFindFlags.People, account.MasterName, 0);
                    if (keyResolution.WaitOne(TimeSpan.FromMinutes(1), false))
                    {
                        account.MasterKey = resolvedMasterKey;
                        Console.WriteLine("\"{0}\" resolved to {1}", account.MasterName, account.MasterKey);
                    }
                    else
                    {
                        Console.WriteLine("Unable to obtain UUID for \"{0}\". No master will be used. Try specifying a key with --masterkey.", account.MasterName);
                    }
                    client.Directory.OnDirPeopleReply -= callback;
                    keyResolution.Reset();
                }

                client.MasterKey = account.MasterKey;

                Clients[client.Self.AgentID] = client;

                Console.WriteLine("Logged in " + client.ToString());
            }

            return(client);
        }