コード例 #1
0
        private void get_processes_btn_Click(object sender, EventArgs e)
        {
            try
            {
                PS4RPC ps4 = new PS4RPC(ip_box.Text);
                ps4.Connect();
                MemoryHelper memoryHelper = new MemoryHelper(ps4);

                this.processes_comboBox.Items.Clear();
                ProcessList pl = ps4.GetProcessList();
                foreach (Process process in pl.processes)
                {
                    this.processes_comboBox.Items.Add(process.name);
                }

                processManager = new ProcessManager();
                processManager.MemoryHelper = memoryHelper;

                this.processes_comboBox.SelectedIndex = 0;
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message, exception.Source, MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
        }
コード例 #2
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);
        }
コード例 #3
0
ファイル: Example.cs プロジェクト: kx001001/jkpatch
        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();
        }
コード例 #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            label1.Text = "Connecting...";
            PS4         = new PS4RPC(textBox1.Text);

            try {
                PS4.Connect();
                label1.Text     = "PS4 Connected";
                selectedProcess = null;
            }
            catch (Exception) {
                label1.Text = "Error";
                MessageBox.Show("Unable to connect to PS4");
            }
        }
コード例 #5
0
 public static Boolean initPS4RPC(String ipAddress)
 {
     try {
         mutex.WaitOne();
         if (ps4RPC != null)
         {
             ps4RPC.Disconnect();
         }
         ps4RPC = new PS4RPC(ipAddress);
         ps4RPC.Connect();
     } catch {
     } finally {
         mutex.ReleaseMutex();
     }
     return(ps4RPC != null);
 }
コード例 #6
0
ファイル: Util.cs プロジェクト: alirezazarghi/PS4-Trainer-C-
        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 });
            }
        }
コード例 #7
0
 public static void free(ulong address)
 {
     PS4 = main.PS4;
     if (version == 405)
     {
         PS4.Call(notifyPid, notifyStub, libSceLibcInternal.start + 0x38380, address);
     }
     else if (version == 455)
     {
         PS4.Call(notifyPid, notifyStub, libSceLibcInternal.start + 0x2C330, address);
     }
     else if (version == 505)
     {
         PS4.Call(notifyPid, notifyStub, libSceLibcInternal.start + 0x23E20, address);
     }
     else
     {
         PS4.Call(notifyPid, notifyStub, libSceLibcInternal.start + 0x23E20, address);
     }
 }
コード例 #8
0
 public static ulong malloc(int size)
 {
     PS4 = main.PS4;
     if (version == 405)
     {
         return(PS4.Call(notifyPid, notifyStub, libSceLibcInternal.start + 0x382F0, size));
     }
     else if (version == 455)
     {
         return(PS4.Call(notifyPid, notifyStub, libSceLibcInternal.start + 0x2C2A0, size));
     }
     else if (version == 505)
     {
         return(PS4.Call(notifyPid, notifyStub, libSceLibcInternal.start + 0x23D90, size));
     }
     else
     {
         return(PS4.Call(notifyPid, notifyStub, libSceLibcInternal.start + 0x23D90, size));
     }
 }
コード例 #9
0
ファイル: Util.cs プロジェクト: alirezazarghi/PS4-Trainer-C-
        public static ulong GetPointerAdress(string pointer, int pid)
        {
            PS4 = main.PS4;
            try
            {
                ulong currentAddress = 0;

                currentAddress = PS4.ReadUInt64(pid, PointerBase(pointer, pid));

                for (int i = 0; i < PointerLevels(pointer).Length - 1; i++)
                {
                    currentAddress = PS4.ReadUInt64(pid, currentAddress + PointerLevels(pointer)[i]);
                }

                currentAddress = currentAddress + PointerLevels(pointer)[PointerLevels(pointer).Length - 1];

                return(currentAddress);
            }
            catch
            {
                return(0);
            }
        }
コード例 #10
0
ファイル: example.cs プロジェクト: KG5RKI/jkpatch
        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();
        }
コード例 #11
0
ファイル: Util.cs プロジェクト: alirezazarghi/PS4-Trainer-C-
        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);
            }
        }
コード例 #12
0
ファイル: MemoryHelper.cs プロジェクト: caesarlzh/PS4_Cheater
 public static bool Connect(string ip)
 {
     ps4 = new PS4RPC(ip);
     ps4.Connect();
     return(false);
 }
コード例 #13
0
ファイル: Util.cs プロジェクト: alirezazarghi/PS4-Trainer-C-
        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";
            }
        }
コード例 #14
0
ファイル: MemoryHelper.cs プロジェクト: xspeedfly/PS4_Cheater
 public MemoryHelper(PS4RPC ps4)
 {
     mutex    = new Mutex();
     this.ps4 = ps4;
 }