Exemple #1
0
        static void Main(string[] args)
        {
            PS4RPC ps4 = new PS4RPC("192.168.1.107");

            ps4.Connect();

            ProcessList pl = ps4.GetProcessList();

            foreach (Process p in pl.processes)
            {
                Console.WriteLine(p.name);
            }

            Process p = pl.FindProcess("SceShellCore");

            ProcessInfo pi         = ps4.GetProcessInfo(p.pid);
            ulong       executable = 0;

            for (int i = 0; i < pi.entries.Length; i++)
            {
                MemoryEntry me = pi.entries[i];
                if (me.prot == 5)
                {
                    Console.WriteLine("executable base " + me.start.ToString("X"));
                    executable = me.start;
                    break;
                }
            }

            byte[] b = ps4.ReadMemory(p.pid, executable, 256);
            Console.Write(HexDump(b));

            ulong stub = ps4.InstallRPC(p.pid);

            ProcessInfo pi  = ps4.GetProcessInfo(p.pid);
            MemoryEntry vme = pi.FindEntry("libSceLibcInternal.sprx", true);

            // dissasemble libSceLibcInternal.sprx to get these offsets (4.05)
            int sys_getpid = (int)ps4.Call(p.pid, stub, vme.start + 0xE0);

            Console.WriteLine("sys_getpid: " + sys_getpid);

            int time = (int)ps4.Call(p.pid, stub, vme.start + 0x4430, 0);

            Console.WriteLine("time: " + time);

            ps4.Disconnect();

            Console.ReadKey();
        }
        public static ProcessInfo GetProcessInfo(int processID)
        {
            mutex.WaitOne();
            ProcessInfo processInfo = ps4.GetProcessInfo(processID);

            mutex.ReleaseMutex();
            return(processInfo);
        }
        public static void Notify(string text, int type = 222)
        {
            PS4 = main.PS4;
            ulong diff;

            if (version == 405)
            {
                diff = 0x300;
            }
            else if (version == 455)
            {
                diff = 0x350;
            }
            else if (version == 505)
            {
                diff = 0x330;
            }
            else
            {
                diff = 0x330;
            }

            PS4.Connect();

            if (notifyPid == -1)
            {
                ProcessList pl = PS4.GetProcessList();

                foreach (Process p in pl.processes)
                {
                    if (p.name == "SceSysCore.elf")
                    {
                        notifyPid = p.pid;
                    }
                }
            }

            ProcessInfo pi = PS4.GetProcessInfo(notifyPid);

            if (notifyStub == 0)
            {
                notifyStub         = PS4.InstallRPC(notifyPid);
                libSceLibcInternal = pi.FindEntry("libSceLibcInternal.sprx");
            }

            ulong stringbuf = malloc(text.Length + 1);

            PS4.WriteString(notifyPid, stringbuf, text);

            MemoryEntry libSceSysUtil = pi.FindEntry("libSceSysUtil.sprx");

            PS4.Call(notifyPid, notifyStub, libSceSysUtil.start + diff, type, stringbuf);

            free(stringbuf);
        }
        /// <summary>
        /// Allocate memory for function calls.
        /// </summary>
        /// <param name="size">Size of memory range to allocate</param>
        public static ulong malloc(int pid, ulong stub, int size)
        {
            ProcessInfo pi = ps4.GetProcessInfo(pid);
            MemoryEntry libSceLibcInternal = pi.FindEntry("libSceLibcInternal.sprx");

            if (version == 405)
            {
                return(ps4.Call(pid, stub, libSceLibcInternal.start + 0x382F0, size));
            }
            else if (version == 455)
            {
                return(ps4.Call(pid, stub, libSceLibcInternal.start + 0x2C2A0, size));
            }
            else if (version == 505)
            {
                return(ps4.Call(pid, stub, libSceLibcInternal.start + 0x23D90, size));
            }
            else
            {
                return(ps4.Call(pid, stub, libSceLibcInternal.start + 0x23D90, size));
            }
        }
Exemple #5
0
        public static string[] GameInfoArray()
        {
            PS4 = main.PS4;
            string procName  = "SceCdlgApp";
            string entryName = "libSceCdlgUtilServer.sprx";
            ulong  titleId   = 0xA0;
            ulong  version   = 0xC8;
            int    prot      = 3;

            string[] result = new string[2];

            try
            {
                PS4.Connect();
                ProcessList pl = PS4.GetProcessList();

                foreach (Process p in pl.processes)
                {
                    if (p.name == procName)
                    {
                        ProcessInfo pi = PS4.GetProcessInfo(p.pid);

                        for (int i = 0; i < pi.entries.Length; i++)
                        {
                            MemoryEntry me = pi.entries[i];

                            if (me.prot == prot && me.name == entryName)
                            {
                                result[0] = PS4.ReadString(p.pid, me.start + titleId);
                                result[1] = PS4.ReadString(p.pid, me.start + version);

                                return(result);
                            }
                        }
                    }
                }

                return(new string[] { null, null });
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.Source, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(new string[] { null, null });
            }
        }
Exemple #6
0
        static void Main(string[] args)
        {
            PS4RPC ps4 = new PS4RPC("192.168.1.107");

            ps4.Connect();

            ProcessList pl = ps4.GetProcessList();

            foreach (string a in pl.procnames)
            {
                Console.WriteLine(a);
            }

            int pid = pl.GetPidContainsName("SceShellCore");

            ProcessInfo pi         = ps4.GetProcessInfo(pid);
            ulong       executable = 0;

            for (int i = 0; i < pi.entries.Length; i++)
            {
                ProcessInfo.VirtualMemoryEntry vme = pi.entries[i];
                if (vme.prot == 5)
                {
                    Console.WriteLine("executable base " + vme.start.ToString("X"));
                    executable = vme.start;
                    break;
                }
            }

            byte[] b = ps4.ReadMemory(pid, executable, 256);
            Console.Write(HexDump(b));

            ps4.Disconnect();

            Console.ReadKey();
        }
Exemple #7
0
        public static ulong PointerBase(string input, int pid)
        {
            PS4 = main.PS4;
            string temp = input;

            if (temp.StartsWith("@") && temp.Contains("_") && temp.Contains("+"))
            {
                temp = temp.TrimStart('@');
                string[] snip   = temp.Split('_');
                int      ID     = Convert.ToInt32(snip[1]) + 1;
                string[] offset = snip[2].Split('+');

                ProcessInfo PI = PS4.GetProcessInfo(pid);

                ulong Val = Convert.ToUInt64(offset[0], 16);
                Val = Val + PI.entries[ID].start;
                /// MessageBox.Show("WTF "+Val.ToString("X"));
                return(Val);
            }
            else
            {
                return(0);
            }
        }
Exemple #8
0
        public static void attachToGame(string processName, string gameName, ref bool att, ref int pid, ref ulong procEntry, ref List <ulong> _entryList, ref ulong stub, ref ulong stringbuf, bool initRpc = false)
        {
            var cusa = GameInfoArray()[0]; var version = GameInfoArray()[1];

            PS4 = main.PS4;
            try
            {
                PS4.Connect();

                ProcessList pl = PS4.GetProcessList();
                ProcessInfo pi;

                foreach (Process p in pl.processes)
                {
                    if (p.name == processName)
                    {
                        pid = p.pid;
                        pi  = PS4.GetProcessInfo(p.pid);
                        _entryList.Clear();

                        for (int i = 0; i < pi.entries.Length; i++)
                        {
                            MemoryEntry me = pi.entries[i];
                            _entryList.Add(me.start);
                        }

                        for (int i = 0; i < pi.entries.Length; i++)
                        {
                            MemoryEntry me = pi.entries[i];
                            if (me.prot == 5)
                            {
                                procEntry = me.start;

                                if (initRpc)
                                {
                                    if (stub == 0)
                                    {
                                        stub = PS4.InstallRPC(pid);
                                        vme  = pi.FindEntry("libSceLibcInternal.sprx");

                                        if (Calling.version == 405)
                                        {
                                            stringbuf = PS4.Call(pid, stub, vme.start + 0x382F0, 0x1000);
                                        }
                                        else if (Calling.version == 455)
                                        {
                                            stringbuf = PS4.Call(pid, stub, vme.start + 0x2C2A0, 0x1000);
                                        }
                                        else if (Calling.version == 505)
                                        {
                                            stringbuf = PS4.Call(pid, stub, vme.start + 0x23D90, 0x1000);
                                        }
                                        else
                                        {
                                            stringbuf = PS4.Call(pid, stub, vme.start + 0x23D90, 0x1000);
                                        }
                                    }
                                }

                                Calling.Notify("PS4 Trainer by TylerMods\n\nAttached to " + gameName + "!\n\n\n\n\n\n", 210);
                                Launching.main.lblAttached.Text = "Attached : True";
                                var result = Regex.Replace(
                                    "Attached : True",        // input
                                    @"Attached",              // word to match
                                    @"<b>$0</b>",             // "wrap match in bold tags"
                                    RegexOptions.IgnoreCase); // ignore case when matching
                                Launching.main.lblCUSA.Text        = $"CUSA : {cusa}";
                                Launching.main.lblGameVersion.Text = $"Version : {version}";
                                Launching.main.lblGame.Text        = $"Game : {gameName}";
                                break;
                            }
                        }
                        //MessageBox.Show("Successfully detected game process.\n\nAttached to process (" + p.name + ", " + pid + ")!", "Game Detected", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        att = true;
                        return;
                    }
                }

                MessageBox.Show("Failed to detect game process.\nMake sure " + gameName + " is running!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                att = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.Source, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Launching.main.lblAttached.Text    = "Attached : False";
                Launching.main.lblCUSA.Text        = "CUSA : Not Attached";
                Launching.main.lblGameVersion.Text = "Version : Not Attached";
                Launching.main.lblGame.Text        = "Game : Not Attached";
            }
        }