Exemple #1
0
        public ClientCSharpShell(Evaluator evaluator, int pid)
            : base(evaluator)
        {
            // Create a server socket we listen on whose address is passed to the agent
            TcpListener listener = new TcpListener(new IPEndPoint(IPAddress.Loopback, 0));

            listener.Start();
            TcpListener interrupt_listener = new TcpListener(new IPEndPoint(IPAddress.Loopback, 0));

            interrupt_listener.Start();

            string agent_assembly = typeof(ClientCSharpShell).Assembly.Location;
            string agent_arg      = String.Format("--agent:{0}:{1}",
                                                  ((IPEndPoint)listener.Server.LocalEndPoint).Port,
                                                  ((IPEndPoint)interrupt_listener.Server.LocalEndPoint).Port);

            var vm = new Attach.VirtualMachine(pid);

            vm.Attach(agent_assembly, agent_arg);

            /* Wait for the client to connect */
            TcpClient client = listener.AcceptTcpClient();

            ns = client.GetStream();
            TcpClient interrupt_client = interrupt_listener.AcceptTcpClient();

            interrupt_stream = interrupt_client.GetStream();

            Console.WriteLine("Connected.");
        }
Exemple #2
0
		protected virtual void OnAttachToProcessActionActivated (object sender, System.EventArgs e)
		{
			ProcessSelector p = new ProcessSelector ();
			int c = p.Run ();
			if (c == (int) ResponseType.Ok){
				VirtualMachine vm = new VirtualMachine (p.PID);

				vm.Attach (typeof (MainWindow).Assembly.Location, "--agent");
			}
			
			p.Destroy ();
		}
Exemple #3
0
		public ClientCSharpShell (Evaluator evaluator, int pid)
			: base (evaluator)
		{
			// Create a server socket we listen on whose address is passed to the agent
			TcpListener listener = new TcpListener (new IPEndPoint (IPAddress.Loopback, 0));
			listener.Start ();
			TcpListener interrupt_listener = new TcpListener (new IPEndPoint (IPAddress.Loopback, 0));
			interrupt_listener.Start ();
	
			string agent_assembly = typeof (ClientCSharpShell).Assembly.Location;
			string agent_arg = String.Format ("--agent:{0}:{1}" ,
							  ((IPEndPoint)listener.Server.LocalEndPoint).Port,
							  ((IPEndPoint)interrupt_listener.Server.LocalEndPoint).Port);
	
			var vm = new Attach.VirtualMachine (pid);
			vm.Attach (agent_assembly, agent_arg);
	
			/* Wait for the client to connect */
			TcpClient client = listener.AcceptTcpClient ();
			ns = client.GetStream ();
			TcpClient interrupt_client = interrupt_listener.AcceptTcpClient ();
			interrupt_stream = interrupt_client.GetStream ();
	
			Console.WriteLine ("Connected.");
		}