コード例 #1
3
ファイル: Connection.cs プロジェクト: hyo2012/VitaDefiler
        public static void CreateFromWireless(string package, out Exploit exploit, out string host, out int port)
        {
            string _host = string.Empty;
            int _port = 0;
            ManualResetEvent doneinit = new ManualResetEvent(false);
            exploit = new Exploit((serial) =>
            {
                ConnectionFinder.PlayerInfo info = ConnectionFinder.GetPlayerForWireless();
                Console.WriteLine("Found: {0}", info);
                Socket debugsock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                Socket logsock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                try
                {
                    debugsock.Connect(info.m_IPEndPoint.Address, (int)info.m_DebuggerPort);
                    logsock.Connect(info.m_IPEndPoint);
                }
                catch (Exception)
                {
                    Console.WriteLine("Unable to connect to {0}:{1}", info.m_IPEndPoint.Address, info.m_DebuggerPort);
                    throw;
                }

                // get network connection
                _host = info.m_IPEndPoint.Address.ToString();
                _port = VITADEFILER_PORT;

                // connect to console output
                (new Thread(() =>
                {
                    string line;
                    using (StreamReader read = new StreamReader(new NetworkStream(logsock)))
                    {
                        try
                        {
                            while ((line = read.ReadLine()) != null)
                            {
                                if (line.Contains("kernel avail main") || line.Contains("Not in scene!"))
                                {
                                    continue; // skip unity logs
                                }
                                /*
                                if (line.StartsWith("\t"))
                                {
                                    continue; // skip unity stack traces
                                }
                                 */

                                int index = line.LastIndexOf('\0'); // Unity output has some crazy garbage in front of it, so get rid of that.
                                if (index >= 0)
                                {
                                    line = line.Substring(index);
                                }

                                Console.Error.WriteLine("[Vita] {0}", line);
                            }
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e.ToString()); // We want to know what went wrong.
                        }
                    }
                })).Start();

                // ready for network connection
                doneinit.Set();

                // return debug connection
                return new TcpConnection(debugsock);
            }, package, null);
            exploit.Connect(false, (text) =>
            {
                Console.WriteLine("[Vita] {0}", text);
            });
            Console.Error.WriteLine("Waiting for network connection...");
            doneinit.WaitOne();
            // suspend
            exploit.SuspendVM();
            host = _host;
            port = _port;
        }
コード例 #2
0
        public static void CreateFromUSB(string package, out Exploit exploit, out string host, out int port)
        {
            exploit = new Exploit(ConnectionFinder.GetConnectionForUSB, package, null);
            ManualResetEvent doneinit = new ManualResetEvent(false);
            string           _host    = string.Empty;
            int _port = 0;

            exploit.Connect(true, (text) =>
            {
                if (text.StartsWith("XXVCMDXX:"))
                {
#if DEBUG
                    Console.Error.WriteLine("[Vita] {0}", text);
#endif
                    string[] cmd = text.Trim().Split(':');
                    switch (cmd[1])
                    {
                    case "IP":
                        _host = cmd[2];
                        _port = Int32.Parse(cmd[3]);
                        Console.Error.WriteLine("Found Vita network at {0}:{1}", _host, _port);
                        break;

                    case "DONE":
                        Console.Error.WriteLine("Vita done initializing");
                        doneinit.Set();
                        break;

                    default:
                        Console.Error.WriteLine("Unrecognized startup command");
                        break;
                    }
                }
                else
                {
                    Console.Error.WriteLine("[Vita] {0}", text);
                }
            });
            Console.Error.WriteLine("Waiting for app to finish launching...");
            doneinit.WaitOne();
            host = _host;
            port = _port;
        }
コード例 #3
0
        public static void CreateFromWireless(string package, out Exploit exploit, out string host, out int port)
        {
            string           _host    = string.Empty;
            int              _port    = 0;
            ManualResetEvent doneinit = new ManualResetEvent(false);

            exploit = new Exploit((serial) =>
            {
                ConnectionFinder.PlayerInfo info = ConnectionFinder.GetPlayerForWireless();
                Console.WriteLine("Found: {0}", info);
                Socket debugsock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                Socket logsock   = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                try
                {
                    debugsock.Connect(info.m_IPEndPoint.Address, (int)info.m_DebuggerPort);
                    logsock.Connect(info.m_IPEndPoint);
                }
                catch (Exception)
                {
                    Console.WriteLine("Unable to connect to {0}:{1}", info.m_IPEndPoint.Address, info.m_DebuggerPort);
                    throw;
                }

                // get network connection
                _host = info.m_IPEndPoint.Address.ToString();
                _port = VITADEFILER_PORT;

                // connect to console output
                (new Thread(() =>
                {
                    string line;
                    using (StreamReader read = new StreamReader(new NetworkStream(logsock)))
                    {
                        try
                        {
                            while ((line = read.ReadLine()) != null)
                            {
                                if (line.Contains("kernel avail main") || line.Contains("Not in scene!"))
                                {
                                    continue; // skip unity logs
                                }

                                /*
                                 * if (line.StartsWith("\t"))
                                 * {
                                 *  continue; // skip unity stack traces
                                 * }
                                 */

                                int index = line.LastIndexOf('\0'); // Unity output has some crazy garbage in front of it, so get rid of that.
                                if (index >= 0)
                                {
                                    line = line.Substring(index);
                                }

                                Console.Error.WriteLine("[Vita] {0}", line);
                            }
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e.ToString()); // We want to know what went wrong.
                        }
                    }
                })).Start();

                // ready for network connection
                doneinit.Set();

                // return debug connection
                return(new TcpConnection(debugsock));
            }, package, null);
            exploit.Connect(false, (text) =>
            {
                Console.WriteLine("[Vita] {0}", text);
            });
            Console.Error.WriteLine("Waiting for network connection...");
            doneinit.WaitOne();
            // suspend
            exploit.SuspendVM();
            host = _host;
            port = _port;
        }
コード例 #4
0
ファイル: Connection.cs プロジェクト: hyo2012/VitaDefiler
 public static void CreateFromUSB(string package, out Exploit exploit, out string host, out int port)
 {
     exploit = new Exploit(ConnectionFinder.GetConnectionForUSB, package, null);
     ManualResetEvent doneinit = new ManualResetEvent(false);
     string _host = string.Empty;
     int _port = 0;
     exploit.Connect(true, (text) =>
     {
         if (text.StartsWith("XXVCMDXX:"))
         {
     #if DEBUG
             Console.Error.WriteLine("[Vita] {0}", text);
     #endif
             string[] cmd = text.Trim().Split(':');
             switch (cmd[1])
             {
                 case "IP":
                     _host = cmd[2];
                     _port = Int32.Parse(cmd[3]);
                     Console.Error.WriteLine("Found Vita network at {0}:{1}", _host, _port);
                     break;
                 case "DONE":
                     Console.Error.WriteLine("Vita done initializing");
                     doneinit.Set();
                     break;
                 default:
                     Console.Error.WriteLine("Unrecognized startup command");
                     break;
             }
         }
         else
         {
             Console.Error.WriteLine("[Vita] {0}", text);
         }
     });
     Console.Error.WriteLine("Waiting for app to finish launching...");
     doneinit.WaitOne();
     host = _host;
     port = _port;
 }