Example #1
0
        public frmSecondGlance()
        {
            InitializeComponent();

            PacketType[] types = (PacketType[])Enum.GetValues(typeof(PacketType));

            // Fill up the "To Log" combo box with options
            foreach (PacketType type in types)
            {
                if (type != PacketType.Default) cboToLog.Items.Add(type);
            }

            // Set the default selection to the first entry
            cboToLog.SelectedIndex = 0;

            // Setup the proxy
            ProxyConfig proxyConfig = new ProxyConfig("Second Glance", "John Hurliman <*****@*****.**>", 
                new string[0]);
            Proxy = new Proxy(proxyConfig);

            Proxy.Start();

            // Start the timer that moves packets from the queue and displays them
            DisplayTimer.Elapsed += new System.Timers.ElapsedEventHandler(DisplayTimer_Elapsed);
            DisplayTimer.Start();
        }
        public XMLRPCMaster(string listenAddress, int port)
        {
            RemotingConfiguration.Configure(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile, false);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(XMLRPCMaster), "Master.rem", WellKnownObjectMode.Singleton);
            RemotingServices.Marshal(this, "Master.rem");

            string portArg = "--proxy-login-port=0"; //No one will ever log in
            string clientListenIPArg = "--proxy-client-facing-address="+listenAddress; //No client will ever send packets to the server so this is irrelevant
            string clientPortArg = "--proxy-client-facing-port=0"; //No client will ever send packets to the server so this is irrelevant
            string serverListenIPArg = "--proxy-server-facing-address="+listenAddress; //This is the address packets sent by this master will appear from
            string serverPortArg = "--proxy-server-facing-port="+port; //This is the port packets sent by this master will appear from
            string loginURIArg = "--proxy-remote-login-uri=http://"+listenAddress+":0"; //This proxy will never log in.
            string[] args = { portArg, clientListenIPArg, clientPortArg, serverListenIPArg, serverPortArg, loginURIArg };
            ProxyConfig config = new ProxyConfig("Routing God", "*****@*****.**", args);
            proxy = new Proxy(config);
            proxy.Start();
        }
        public SetFollowCamPropertiestForm()
        {
            string file = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;

            string port = "8080";
            //string listenIP = "138.251.194.192";
            string listenIP = "127.0.0.1";
            string loginURI = "http://apollo.cs.st-andrews.ac.uk:8002";

            string portArg = "--proxy-login-port="+port;
            string listenIPArg = "--proxy-client-facing-address="+listenIP;
            string loginURIArg = "--proxy-remote-login-uri="+loginURI;
            string[] args = { portArg, listenIPArg, loginURIArg };
            ProxyConfig config = new ProxyConfig("Routing God", "*****@*****.**", args);
            mProxy = new Proxy(config);
            mProxy.AddLoginResponseDelegate(response => {
                mLoggedIn = true;
                return response;
            });
            mProxy.AddDelegate(PacketType.ObjectUpdate, Direction.Incoming, (p, ep) => {
                ObjectUpdatePacket packet = (ObjectUpdatePacket) p;
                foreach (var block in packet.ObjectData) {
                    if (block.PCode == (byte) PCode.Avatar) {
                        string name = Utils.BytesToString(block.NameValue);
                        name = name.Replace("STRING RW SV ", "");
                        string[] tokens = name.Split(' ', '\n');
                        string firstName = tokens[1];
                        string lastName = tokens[3];
                        string title = tokens.Length > 5 ? tokens[5] : "";

                        //avatarsListBox.DataSource = avatarsBindingSource;
                        avatarsBindingSource.Add(new Avatar(firstName, lastName, block.ID, block.FullID));

                        Console.WriteLine("\n\n Added " + firstName + " " + lastName + ".\n\n");
                    }
                }
                //"FirstName STRING RW SV Routing\nLastName STRING RW SV God\nTitle STRING RW SV "
                return packet;
            });

            InitializeComponent();

            focusRotationPanel.Vector = Vector3.UnitX;
        }
Example #4
0
        private void Init(string[] args, ProxyConfig proxyConfig)
        {
            //bool externalPlugin = false;
            this.args = args;

            if (proxyConfig == null)
            {
                proxyConfig = new ProxyConfig("GridProxy", "Austin Jennings / Andrew Ortman", args);
            }
            proxy = new Proxy(proxyConfig);

            // add delegates for login
            proxy.AddLoginRequestDelegate(new XmlRpcRequestDelegate(LoginRequest));
            proxy.AddLoginResponseDelegate(new XmlRpcResponseDelegate(LoginResponse));

            // add a delegate for outgoing chat
            proxy.AddDelegate(PacketType.ChatFromViewer, Direction.Outgoing, new PacketDelegate(ChatFromViewerOut));

            //  handle command line arguments
            foreach (string arg in args)
                if (arg == "--log-login")
                    logLogin = true;
                else if (arg.Substring(0, 2) == "--")
                {
                    int ipos = arg.IndexOf("=");
                    if (ipos != -1)
                    {
                        string sw = arg.Substring(0, ipos);
                        string val = arg.Substring(ipos + 1);

                        Logger.Log("arg '" + sw + "' val '" + val + "'", Helpers.LogLevel.Debug);

                        if (sw == "--load")
                        {
                            //externalPlugin = true;
                            LoadPlugin(val);
                        }
                    }
                }

            commandDelegates["/load"] = new CommandDelegate(CmdLoad);
        }
        public bool StartProxy(int port, string loginURI)
        {
            if (Started)
            {
                Stop();
            }
            string file = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;

            string localAddress    = "127.0.0.1";
            string portArg         = "--proxy-login-port=" + port;
            string listenIPArg     = "--proxy-proxyAddress-facing-address=" + localAddress;
            string loginURIArg     = "--proxy-remote-login-uri=" + loginURI;
            string proxyCaps       = "--proxy-caps=true";
            string proxyEventQueue = "--proxy-event-queue-only=true";

            string[] args = { portArg, listenIPArg, loginURIArg, proxyCaps, proxyEventQueue };
            mConfig   = new GridProxyConfig("Routing God", "*****@*****.**", args);
            mLoginURI = " --loginuri http://" + localAddress + ":" + port;

            return(Start());
        }
Example #6
0
        /*
         * Proxy Management
         */

        // Proxy: construct a proxy server with the given configuration
        public Proxy(ProxyConfig proxyConfig)
        {
            this.proxyConfig = proxyConfig;

            ServicePointManager.CertificatePolicy = new TrustAllCertificatePolicy();
            // Even though this will compile on Mono 2.4, it throws a runtime exception
            //ServicePointManager.ServerCertificateValidationCallback = TrustAllCertificatePolicy.TrustAllCertificateHandler;

            InitializeLoginProxy();
            InitializeSimProxy();
            InitializeCaps();
        }
Example #7
0
 // SimProxy: construct a proxy for a single simulator
 public SimProxy(ProxyConfig proxyConfig, IPEndPoint simEndPoint, Proxy proxy)
 {
     //this.proxyConfig = proxyConfig;
     remoteEndPoint = new IPEndPoint(simEndPoint.Address, simEndPoint.Port);
     this.proxy = proxy;
     socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
     socket.Bind(new IPEndPoint(proxyConfig.clientFacingAddress, 0));
     proxy.AddHandler(remoteEndPoint, this);
     Reset();
 }
Example #8
0
        /*
         * Proxy Management
         */

        // Proxy: construct a proxy server with the given configuration
        public Proxy(ProxyConfig proxyConfig)
        {
            this.proxyConfig = proxyConfig;

            InitializeLoginProxy();
            InitializeSimProxy();
            InitializeCaps();
        }
Example #9
0
        public ProxyManager(string port, string listenIP, string loginUri)
        {
            openmvAssembly = Assembly.Load("OpenMetaverse");
            if (openmvAssembly == null) throw new Exception("Assembly load exception");

            _Port = string.Format("--proxy-login-port={0}", port);

            IPAddress remoteIP; // not used
            if (IPAddress.TryParse(listenIP, out remoteIP))
                _ListenIP = String.Format("--proxy-client-facing-address={0}", listenIP);
            else
                _ListenIP = "--proxy-client-facing-address=127.0.0.1";

            if (String.IsNullOrEmpty(loginUri))
                _LoginURI = "--proxy-remote-login-uri=https://login.agni.lindenlab.com/cgi-bin/login.cgi";
            else
                _LoginURI = "--proxy-remote-login-uri=" + loginUri;


            string[] args = { _Port, _ListenIP, _LoginURI };
            /*
                help
                proxy-help
                proxy-login-port
                proxy-client-facing-address
                proxy-remote-facing-address
                proxy-remote-login-uri
                verbose
                quiet
             */

            ProxyConfig pc = new ProxyConfig("WinGridProxy", "Jim Radford", args);

            Proxy = new ProxyFrame(args, pc);
            
            Proxy.proxy.AddLoginRequestDelegate(new XmlRpcRequestDelegate(LoginRequest));
            Proxy.proxy.AddLoginResponseDelegate(new XmlRpcResponseDelegate(LoginResponse));

            Proxy.proxy.AddCapsDelegate("EventQueueGet", new CapsDelegate(EventQueueGetHandler));

            // this is so we are informed of any new capabilities that are added to the KnownCaps dictionary
            Proxy.proxy.KnownCaps.AddDelegate(OpenMetaverse.DictionaryEventAction.Add, new OpenMetaverse.DictionaryChangeCallback(KnownCapsAddedHandler));
        }
 public ProxyFrame(string[] args, ProxyConfig proxyConfig)
 {
     Init(args, proxyConfig);
 }
        public void Connect(string masterAddress, string listeningAddress, int masterXmlRpcPort, int port, int xmlRpcPort)
        {
            //socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
            //socket.Bind(new IPEndPoint(IPAddress.Parse(listeningIP), port));
            //socket.BeginReceiveFrom(receiveBuffer, 0, receiveBuffer.Length, SocketFlags.None, ref remoteEndPoint, new AsyncCallback(ProcessPacket), null);

            IMasterProxy master = XmlRpcProxyGen.Create<IMasterProxy>();
            master.Url = "http://"+masterAddress+":"+masterXmlRpcPort+"/Master.rem";

            new Thread(() => {
                int masterPort = master.Register(name, listeningAddress, port, xmlRpcPort);

                IPAddress masterIP = GetAddress(masterAddress);
                IPAddress listenIP = GetAddress(listeningAddress);

                string serverListenIPArg = "--proxy-remote-facing-address=" + listenIP.ToString();
                string serverListenPortArg = "--proxy-remote-facing-port=" + port;
                string clientLoginPortArg = "--proxy-login-port=0"; //Never going to be used. No one will ever connect to this proxy.
                string loginURIArg = "--proxy-remote-login-uri=http://http://localhost:9000";
                string[] args = { serverListenIPArg, serverListenPortArg, clientLoginPortArg, loginURIArg };
                ProxyConfig config = new ProxyConfig("Routing God", "*****@*****.**", args);
                proxy = new Proxy(config);
                proxy.ActiveCircuit = new IPEndPoint(masterIP, masterPort);

                foreach (PacketType pt in Enum.GetValues(typeof(PacketType)))
                    proxy.AddDelegate(pt, Direction.Incoming, ProcessPacket);

                proxy.Start();

            }).Start();
        }
        public bool StartProxy(int port, string loginURI)
        {
            if (Started)
                Stop();
            string file = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;

            string localAddress = "127.0.0.1";
            string portArg = "--proxy-login-port=" + port;
            string listenIPArg = "--proxy-proxyAddress-facing-address=" + localAddress;
            string loginURIArg = "--proxy-remote-login-uri=" + loginURI;
            string proxyCaps = "--proxy-caps=true";
            string proxyEventQueue = "--proxy-event-queue-only=true";
            string[] args = { portArg, listenIPArg, loginURIArg, proxyCaps, proxyEventQueue };
            mConfig = new GridProxyConfig("Routing God", "*****@*****.**", args);
            mLoginURI = " --loginuri http://" + localAddress + ":" + port;

            return Start();
        }
        private void connectButton_Click(object sender, EventArgs e)
        {
            if (proxy != null)
                proxy.Stop();
            string file = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;

            string portArg = "--proxy-login-port="+portBox.Text;
            string listenIPArg = "--proxy-client-facing-address="+listenIPBox.Text;
            string loginURIArg = "--proxy-remote-login-uri="+loginURIBox.Text;
            string[] args = { portArg, listenIPArg, loginURIArg };
            ProxyConfig config = new ProxyConfig("Routing God", "*****@*****.**", args);
            proxy = new Proxy(config);
            proxy.AddLoginResponseDelegate(response => {
                loggedIn = true;
                if (LoggedIn != null)
                    LoggedIn(proxy, null);
                return response;
            });

            proxy.Start();

            if (OnStarted != null)
                OnStarted(proxy, null);

            startButton.Text = "ReStart";
        }
Example #14
0
        public ProxyManager(string port, string listenIP, string loginUri)
        {
            /*foreach (Assembly tempas in AppDomain.CurrentDomain.GetAssemblies())
            {

                if (tempas.GetName(true).Name + ".exe"
                == AppDomain.CurrentDomain.FriendlyName)
                {
                    foreach (AssemblyName tempbs in tempas.GetReferencedAssemblies())
                    {
                        MessageBox.Show(tempbs.Name);
                    }
                }
                //if(tempas.GetReferencedAssembliesGetNameFullName
            }*/
            AssemblyName a=new AssemblyName("OpenMetaverse");
            //openmvAssembly = Assembly.Load(a);
            openmvAssembly = Assembly.GetExecutingAssembly();
            if (openmvAssembly == null) throw new Exception("Assembly load exception");

            _Port = string.Format("--proxy-login-port={0}", port);

            IPAddress remoteIP; // not used
            if (IPAddress.TryParse(listenIP, out remoteIP))
                _ListenIP = String.Format("--proxy-client-facing-address={0}", listenIP);
            else
                _ListenIP = "--proxy-client-facing-address=127.0.0.1";

            if (String.IsNullOrEmpty(loginUri))
                _LoginURI = "--proxy-remote-login-uri=https://login.agni.lindenlab.com/cgi-bin/login.cgi";
            else
                _LoginURI = "--proxy-remote-login-uri=" + loginUri;

            string[] args = { _Port, _ListenIP, _LoginURI };
            /*
                help
                proxy-help
                proxy-login-port
                proxy-client-facing-address
                proxy-remote-facing-address
                proxy-remote-login-uri
                verbose
                quiet
             */

            ProxyConfig pc = new ProxyConfig("LGG Par Plugins via GridProxy v64", "LordGregGreg Back", args);

            Proxy = new ProxyFrame(args, pc);

            Proxy.proxy.AddLoginRequestDelegate(new XmlRpcRequestDelegate(LoginRequest));
            Proxy.proxy.AddLoginResponseDelegate(new XmlRpcResponseDelegate(LoginResponse));

            Proxy.proxy.AddCapsDelegate("EventQueueGet", new CapsDelegate(EventQueueGetHandler));

            // this is so we are informed of any new capabilities that are added to the KnownCaps dictionary
            Proxy.proxy.KnownCaps.AddDelegate(OpenMetaverse.DictionaryEventAction.Add, new OpenMetaverse.DictionaryChangeCallback(KnownCapsAddedHandler));
        }