Example #1
0
        private User[] GetUsers()
        {
            List <User> users = new List <User>();
            var         mem   = ps4.AllocateMemory(pid, 0x1);
            var         ret   = (int)ps4.Call(pid, stub, GetUsersAddr, mem);

            if (ret != -1 && ret != 0)
            {
                var buffer = ps4.ReadMemory(pid, mem, (21) * 4);
                for (int i = 0; i < 4; i++)
                {
                    var id = BitConverter.ToInt32(buffer, 21 * i);
                    if (id == 0)
                    {
                        continue;
                    }
                    var name = System.Text.Encoding.UTF8.GetString(PS4DBG.SubArray(buffer, i * 21 + 4, 16));
                    users.Add(new User {
                        id = id, name = name
                    });
                }
            }
            ps4.FreeMemory(pid, mem, 0x1);
            return(users.ToArray());
        }
 private void connectButton_Click(object sender, EventArgs e)
 {
     SetStatus("Connecting...");
     try
     {
         if (!checkIP(ipTextBox.Text))
         {
             SetStatus("Invalid IP");
             return;
         }
         ps4 = new PS4DBG(ipTextBox.Text);
         ps4.Connect();
         if (!ps4.IsConnected)
         {
             throw new Exception();
         }
         SetStatus("Connected - Make sure the correct FW version is selected in payload dropdown and press Setup.");
         Properties.Settings.Default.ip = ipTextBox.Text;
         Properties.Settings.Default.Save();
     }
     catch
     {
         SetStatus("Failed to connect. Check IP and make sure PS4Debug payload is already loaded on the PS4.");
     }
 }
Example #3
0
 private void connectButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (!checkIP(ipTextBox.Text))
         {
             SetStatus("Invalid IP");
             return;
         }
         ps4 = new PS4DBG(ipTextBox.Text);
         ps4.Connect();
         if (!ps4.IsConnected)
         {
             throw new Exception();
         }
         SetStatus("Connected");
         if (!File.Exists("ip"))
         {
             File.WriteAllText("ip", ipTextBox.Text);
         }
         else
         {
             using (var sw = File.CreateText(@"log.txt"))
             {
                 sw.Write(ipTextBox.Text);
             }
         }
     }
     catch
     {
         SetStatus("Failed To Connect");
     }
 }
Example #4
0
        private void ConnectButton_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = DialogResult.Yes;

            if (this.ps4 == null)
            {
                this.ps4 = new PS4DBG(this.IpTextBox.Text);
                this.ps4.Connect();
            }

            /*else if (this.ps4 != null && this.ps4.IsConnected) {
             *      dialogResult = MessageBox.Show("You are already connected...\nWould you like to reconnect?",
             *          "Debug Watch", MessageBoxButtons.YesNo, MessageBoxIcon.Hand);
             * }*/
            if (dialogResult != DialogResult.Yes)
            {
                return;
            }
            this.ps4.Notify(210, "debug watch");
            this.AttachButton.Enabled  = true;
            this.RefreshButton.Enabled = true;
            this.RebootButton.Enabled  = true;
            this.MainPanel.Enabled     = false;
            Settings.ip     = this.IpTextBox.Text;
            Settings.filter = this.FilterProcessListCheckBox.Checked;
            this.RefreshButton_Click((object)null, (EventArgs)null);
        }
Example #5
0
            public GameInfo(PS4DBG PS4)
            {
                string procName   = "SceCdlgApp";
                string entryName  = "libSceCdlgUtilServer.sprx";
                string uProcName  = "SceShellUI";
                string uEntryName = "SceLoginMgrSmallStackJobQueue";
                ulong  _userName  = 0xEA494;
                ulong  _titleId   = 0xA0;
                ulong  _version   = 0xC8;
                int    prot       = 3;

                string[] result = new string[3];

                try
                {
                    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);
                                }
                            }
                        }
                        if (p.name == uProcName)
                        {
                            ProcessInfo p2 = PS4.GetProcessInfo(p.pid);
                            for (int i = 0; i < p2.entries.Length; i++)
                            {
                                MemoryEntry m = p2.entries[i];
                                if (m.prot == prot && m.name == uEntryName)
                                {
                                    result[2] = PS4.ReadString(p.pid, m.start + _userName);
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    //MessageBox.Show(ex.Message, ex.Source, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                titleID  = result[0];
                version  = result[1];
                username = result[2];
            }
 private void FindIP_Button_Click(object sender, EventArgs e)
 {
     try
     {
         IP_TextBox.Text = PS4DBG.FindPlayStation();
     }
     catch
     {
         MessageBox.Show("Couldn't find ps4", "Failed");
     }
 }
Example #7
0
 private void button1_Click(object sender, EventArgs e)
 {
     PS4 = new PS4DBG(IPBox.Text);
     try
     {
         PS4.Connect();
         atch.Enabled = PS4.IsConnected;
     }
     catch (Exception ex)
     {
         //MessageBox.Show(ex.Message);
     }
 }
Example #8
0
 public void attachDebug(PS4DBG ps4, int pid, string ip, object sender, EventArgs e)
 {
     this.ps4            = ps4;
     this.IpTextBox.Text = ip;
     this.ConnectButton_Click(sender, e);
     this.ConnectButton.Dispose();
     this.DetachButton.Dispose();
     if (pid > 0)
     {
         int index = this.ProcessComboBox.FindString(pid + ":");
         this.ProcessComboBox.SelectedIndex = index;
         this.AttachButton_Click(sender, e);
     }
 }
        private void btConnect_Click(object sender, EventArgs e)
        {
            try
            {
                ps4 = new PS4DBG(tbIPAddress.Text);
                ps4.Connect();

                ProcessList pl = ps4.GetProcessList();

                p = pl.FindProcess("SceShellUI");

                ProcessMap pi = ps4.GetProcessMaps(p.pid);
                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;
                    }
                }

                stub = ps4.InstallRPC(p.pid);

                sceRegMgrGetInt_addr = executable + 0x3D55C0;
                sceRegMgrGetStr_addr = executable + 0x846B00;
                sceRegMgrGetBin_addr = executable + 0x848640;

                sceRegMgrSetInt_addr = executable + 0x848FB0;
                sceRegMgrSetStr_addr = executable + 0x84CFF0;
                sceRegMgrSetBin_addr = executable + 0x848650;


                if (ps4.IsConnected)
                {
                    toolStripStatusLabel1.Text = "Connected to " + tbIPAddress.Text + ". Click Get Users";
                    btGetUsers.Enabled         = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "Something went wrong and it's probably your fault ;-P");
            }
        }
Example #10
0
        private string[] GetSaveDirectories()
        {
            var dirs   = new List <string>();
            var mem    = ps4.AllocateMemory(pid, 0x8000);
            var path   = mem;
            var buffer = mem + 0x101;

            ps4.WriteMemory(pid, path, $"/user/home/{GetUser():x}/savedata/");
            var ret = (int)ps4.Call(pid, stub, GetSaveDirectoriesAddr, path, buffer);

            if (ret != -1 && ret != 0)
            {
                var bDirs = ps4.ReadMemory(pid, buffer, ret * 0x10);
                for (var i = 0; i < ret; i++)
                {
                    var sDir = System.Text.Encoding.UTF8.GetString(PS4DBG.SubArray(bDirs, i * 10, 9));
                    dirs.Add(sDir);
                }
            }
            ps4.FreeMemory(pid, mem, 0x8000);
            return(dirs.ToArray());
        }
Example #11
0
        private SearchEntry[] Find(SceSaveDataDirNameSearchCond searchCond, SceSaveDataDirNameSearchResult searchResult)
        {
            var searchCondAddr   = ps4.AllocateMemory(pid, Marshal.SizeOf(typeof(SceSaveDataDirNameSearchCond)) + Marshal.SizeOf(typeof(SceSaveDataDirNameSearchResult)));
            var searchResultAddr = searchCondAddr + (uint)Marshal.SizeOf(typeof(SceSaveDataDirNameSearchCond));

            ps4.WriteMemory(pid, searchCondAddr, searchCond);
            ps4.WriteMemory(pid, searchResultAddr, searchResult);
            var ret = ps4.Call(pid, stub, libSceSaveDataBase + offsets.sceSaveDataDirNameSearch, searchCondAddr, searchResultAddr);

            WriteLog($"sceSaveDataDirNameSearch ret = 0x{ret:X}");
            if (ret == 0)
            {
                searchResult = ps4.ReadMemory <SceSaveDataDirNameSearchResult>(pid, searchResultAddr);
                SearchEntry[] sEntries       = new SearchEntry[searchResult.hitNum];
                var           paramMemory    = ps4.ReadMemory(pid, searchResult.param, (int)searchResult.hitNum * Marshal.SizeOf(typeof(SceSaveDataParam)));
                var           dirNamesMemory = ps4.ReadMemory(pid, searchResult.dirNames, (int)searchResult.hitNum * 32);
                for (int i = 0; i < searchResult.hitNum; i++)
                {
                    SceSaveDataParam tmp = (SceSaveDataParam)PS4DBG.GetObjectFromBytes(PS4DBG.SubArray(paramMemory, i * Marshal.SizeOf(typeof(SceSaveDataParam)), Marshal.SizeOf(typeof(SceSaveDataParam))), typeof(SceSaveDataParam));
                    sEntries[i] = new SearchEntry
                    {
                        dirName  = System.Text.Encoding.UTF8.GetString(PS4DBG.SubArray(dirNamesMemory, i * 32, 32)),
                        title    = System.Text.Encoding.UTF8.GetString(tmp.title),
                        subtitle = System.Text.Encoding.UTF8.GetString(tmp.subTitle),
                        detail   = System.Text.Encoding.UTF8.GetString(tmp.detail),
                        time     = new DateTime(1970, 1, 1).ToLocalTime().AddSeconds(tmp.mtime).ToString(),
                    };
                }
                ps4.FreeMemory(pid, searchCondAddr, Marshal.SizeOf(typeof(SceSaveDataDirNameSearchCond)) + Marshal.SizeOf(typeof(SceSaveDataDirNameSearchResult)));
                return(sEntries);
            }

            ps4.FreeMemory(pid, searchCondAddr, Marshal.SizeOf(typeof(SceSaveDataDirNameSearchCond)) + Marshal.SizeOf(typeof(SceSaveDataDirNameSearchResult)));

            return(new SearchEntry[0]);
        }
 private void Connect_Button_Click(object sender, EventArgs e)
 {
     ps4 = new PS4DBG(IP_TextBox.Text);
     ps4.Connect();
 }
Example #13
0
        static void Main(string[] args)
        {
            Registry r = new Registry();

            // Put your PS4 IP address here
            ps4 = new PS4DBG("192.168.1.85");
            ps4.Connect();

            ProcessList pl = ps4.GetProcessList();

            p = pl.FindProcess("SceShellUI");

            ProcessMap pi = ps4.GetProcessMaps(p.pid);

            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;
                }
            }

            stub = ps4.InstallRPC(p.pid);

            sceRegMgrGetInt_addr = executable + 0x3ADF80;
            sceRegMgrGetStr_addr = executable + 0x81BC20;
            sceRegMgrGetBin_addr = executable + 0x81D6A0;

            sceRegMgrSetInt_addr = executable + 0x81DFB0;
            sceRegMgrSetStr_addr = executable + 0x821A10;
            sceRegMgrSetBin_addr = executable + 0x81D6B0;

            int outValue = 0;

            // A number from 1 to 16
            int   userNumber = 1;
            ulong errorCode  = 0;

            string outString = null;

            byte[] psnAccountId = null;

            // Put your PSN account id here. Two different methods for obtaining your PSN account id:
            //
            // 1. It's string you see when exporting (from an activated PS4) save data in the usb folder but byte reversed. Example: PS4\savedata\0102030405060708 (reversing it you get 0807060504030201)
            // 2. On a computer delete your browser cache. Press Ctrl+Shift+I to open the developer tools.
            //    Browse the PSN store on your computer and log in to your account.
            //    Some of the JSON files the browser downloads contain an "accountId" field. It's a decimal number. Just convert it to hex and reverse the bytes.

            psnAccountId = new byte[] { 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01 };
            errorCode    = SetBinNative((uint)r.KEY_account_id(userNumber), psnAccountId, Registry.SIZE_account_id);
            //errorCode = GetBinNative((uint)r.KEY_account_id(userNumber), out psnAccountId, Registry.SIZE_account_id);

            string text = "np";

            errorCode = SetStrNative((uint)r.KEY_NP_env(userNumber), text, (uint)text.Length);
            //errorCode = GetStrNative((uint)r.KEY_NP_env(userNumber), out outString, Registry.SIZE_NP_env); Console.WriteLine("SCE_REGMGR_ENT_KEY_USER_01_16_NP_env              {0} - {1}", userNumber, outString);

            errorCode = SetIntNative((uint)r.KEY_login_flag(userNumber), 6);
            //errorCode = GetIntNative((uint)r.KEY_login_flag(userNumber), out outValue); Console.WriteLine("SCE_REGMGR_ENT_KEY_USER_01_16_login_flag                      {0} - {1}", userNumber, outValue);


            ps4.Disconnect();

            Console.ReadKey();
        }