Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
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();
        }
Exemplo n.º 3
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";
            }
        }