private async void ProcessMapForm_Load(object sender, EventArgs e)
        {
            _map = await ApiBoundary.GetMap(_controller.State.Info.Name, _mapId);

            Text = _controller.State.Info.Name + " - " + _map.Name + " - Process Map";
            FillGraph();
        }
Exemple #2
0
        /// <summary>
        /// Converts dictionary into process map and saves it to database
        /// </summary>
        /// <param name="map"></param>
        /// <param name="labels"></param>
        /// <returns></returns>
        private static int SaveMap(Dictionary <string, long> map, List <LogLabel> labels)
        {
            ProcessMapRelation MakeRelation(KeyValuePair <string, long> kv)
            {
                string[] kbs = kv.Key.Split(DICT_SPLITTER);
                return(new ProcessMapRelation()
                {
                    count = kv.Value,
                    labelFrom = kbs[0],
                    labelTo = kbs[1]
                });
            }

            var relations  = map.OrderByDescending(t => t.Value).Select(MakeRelation).ToArray();
            var processMap = new ProcessMap()
            {
                _id       = Job.MapId.ToString(),
                Labels    = labels.Concat(new LogLabel[] { LogLabel.MakeStart(), LogLabel.MakeEnd() }).ToArray(),
                Name      = Job.MapName,
                Relations = relations
            };

            Database.AddMap(processMap);
            return(0);
        }
Exemple #3
0
        public void InitMemorySectionList(ProcessMap pm)
        {
            mapped_section_list.Clear();
            TotalMemorySize = 0;

            if (pm.entries == null)
            {
                return;
            }
            for (int i = 0; i < pm.entries.Length; i++)
            {
                MemoryEntry entry = pm.entries[i];
                if ((entry.prot & 0x1) == 0x1)
                {
                    ulong length   = entry.end - entry.start;
                    ulong start    = entry.start;
                    bool  isFilter = Util.SectionIsFilter(entry.name);

                    int   idx           = 0;
                    ulong buffer_length = 1024 * 1024 * 128;

                    //Executable section
                    if ((entry.prot & 0x5) == 0x5)
                    {
                        buffer_length = length;
                    }

                    while (length != 0)
                    {
                        ulong cur_length = buffer_length;

                        if (cur_length > length)
                        {
                            cur_length = length;
                            length     = 0;
                        }
                        else
                        {
                            length -= cur_length;
                        }

                        MappedSection mappedSection = new MappedSection();
                        mappedSection.Start  = start;
                        mappedSection.Length = (int)cur_length;
                        mappedSection.Name   = entry.name + "[" + idx + "]";
                        mappedSection.Check  = false;
                        mappedSection.Prot   = entry.prot;
                        mappedSection.Offset = entry.offset;
                        if (isFilter)
                        {
                            mappedSection.IsFilter = true;
                        }
                        mapped_section_list.Add(mappedSection);

                        start += cur_length;
                        ++idx;
                    }
                }
            }
        }
 protected override void OnModelCreating(ModelBuilder modelBuilder)
 {
     ApplicationSettingMap.Map(modelBuilder.Entity <ApplicationSetting>());
     ApplicationEntitiesMap.Map(modelBuilder.Entity <ApplicationEntities>());
     ApplicationProcessMap.Map(modelBuilder.Entity <ApplicationProcess>());
     ApplicationsMap.Map(modelBuilder.Entity <Applications>());
     DataPropertiesMap.Map(modelBuilder.Entity <DataProperties>());
     DataTypesMap.Map(modelBuilder.Entity <DataTypes>());
     EntitiesMap.Map(modelBuilder.Entity <EF.Entities.Entities>());
     EntityPropertiesMap.Map(modelBuilder.Entity <EntityProperties>());
     EntityRelationshipsMap.Map(modelBuilder.Entity <EntityRelationships>());
     EntityViewMap.Map(modelBuilder.Entity <EntityView>());
     EntityViewEntityPropertiesMap.Map(modelBuilder.Entity <EntityViewEntityProperties>());
     EntityViewPropertiesMap.Map(modelBuilder.Entity <EntityViewProperties>());
     EntityViewPropertyFunctionMap.Map(modelBuilder.Entity <EntityViewPropertyFunction>());
     EntityViewPropertyFunctionParameterMap.Map(modelBuilder.Entity <EntityViewPropertyFunctionParameter>());
     EntityViewViewPropertiesMap.Map(modelBuilder.Entity <EntityViewViewProperties>());
     FunctionBodyMap.Map(modelBuilder.Entity <FunctionBody>());
     FunctionParametersMap.Map(modelBuilder.Entity <FunctionParameters>());
     FunctionReturnTypeMap.Map(modelBuilder.Entity <FunctionReturnType>());
     FunctionsMap.Map(modelBuilder.Entity <Functions>());
     FunctionSetFunctionsMap.Map(modelBuilder.Entity <FunctionSetFunctions>());
     FunctionSetsMap.Map(modelBuilder.Entity <FunctionSets>());
     LayersMap.Map(modelBuilder.Entity <Layers>());
     LayoutMap.Map(modelBuilder.Entity <Layout>());
     ModelTypesMap.Map(modelBuilder.Entity <ModelTypes>());
     OperatorsMap.Map(modelBuilder.Entity <Operators>());
     ParametersMap.Map(modelBuilder.Entity <Parameters>());
     PartsMap.Map(modelBuilder.Entity <Parts>());
     PresentationPropertiesMap.Map(modelBuilder.Entity <PresentationProperties>());
     PrimaryKeyOptionsMap.Map(modelBuilder.Entity <PrimaryKeyOptions>());
     ProcessMap.Map(modelBuilder.Entity <Process>());
     ProcessStepsMap.Map(modelBuilder.Entity <ProcessSteps>());
     ProcessStepScreensMap.Map(modelBuilder.Entity <ProcessStepScreens>());
     ProjectsMap.Map(modelBuilder.Entity <Projects>());
     RelationshipTypesMap.Map(modelBuilder.Entity <RelationshipTypes>());
     ScreenLayoutsMap.Map(modelBuilder.Entity <ScreenLayouts>());
     ScreenPartsMap.Map(modelBuilder.Entity <ScreenParts>());
     ScreensMap.Map(modelBuilder.Entity <Screens>());
     ScreenViewsMap.Map(modelBuilder.Entity <ScreenViews>());
     SettingsMap.Map(modelBuilder.Entity <Settings>());
     SettingsNamesMap.Map(modelBuilder.Entity <SettingsNames>());
     StateMachinesMap.Map(modelBuilder.Entity <StateMachines>());
     StateMachineStatesMap.Map(modelBuilder.Entity <StateMachineStates>());
     StateMachineTriggersMap.Map(modelBuilder.Entity <StateMachineTriggers>());
     StatesMap.Map(modelBuilder.Entity <States>());
     StepsMap.Map(modelBuilder.Entity <Steps>());
     TestValuesMap.Map(modelBuilder.Entity <TestValues>());
     TriggersMap.Map(modelBuilder.Entity <Triggers>());
     ViewEntityMap.Map(modelBuilder.Entity <ViewEntity>());
     ViewsMap.Map(modelBuilder.Entity <Views>());
 }
        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");
            }
        }
Exemple #6
0
        private void processes_comboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                section_list_box.Items.Clear();
                result_list_view.Items.Clear();
                new_scan_btn.Enabled     = true;
                valueTypeList.Enabled    = true;
                compareTypeList.Enabled  = true;
                section_list_box.Enabled = true;

                ProcessInfo?maybeProcessInfo = processManager.GetProcessInfo(processes_comboBox.Text);
                if (maybeProcessInfo is null)
                {
                    msg.Text = "No process information found.";
                    return;
                }
                ProcessInfo processInfo = (ProcessInfo)maybeProcessInfo;

                Util.DefaultProcessID = processInfo.pid;
                ProcessMap processMap = MemoryHelper.GetProcessMaps(processInfo.pid);
                if (processMap is null)
                {
                    msg.Text = "No process maps found.";
                    return;
                }

                processManager.MappedSectionList.InitMemorySectionList(processMap);

                section_list_box.BeginUpdate();
                for (int i = 0; i < processManager.MappedSectionList.Count; ++i)
                {
                    section_list_box.Items.Add(processManager.MappedSectionList.GetSectionName(i), false);
                }
                section_list_box.EndUpdate();
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
        public MemoryMapView(ProcessInfo pi, ProcessMap processMap)
        {
            this.InitializeComponent();
            this.processinfo = pi;
            this.processMap  = processMap;



            for (int index = 0; index < this.processMap.entries.Length; ++index)
            {
                MemoryEntry entry = this.processMap.entries[index];
                ulong       num   = entry.end - entry.start;
                this.MemoryMapCheckedListBox.Items.Add((object)(entry.name +
                                                                " start: 0x" +
                                                                entry.start.ToString("X") +
                                                                " length: 0x" +
                                                                num.ToString("X") +
                                                                " prot: " +
                                                                (object)entry.prot));
            }
            this.AutoSelectButton_Click((object)null, (EventArgs)null);
        }
Exemple #8
0
        public GameInfo()
        {
            string process_name   = "";
            string section_name   = "";
            ulong  id_offset      = 0;
            ulong  version_offset = 0;
            int    section_prot   = 0;

            switch (Util.Version)
            {
            case 405:
                process_name   = GAME_INFO_4_05_PROCESS_NAME;
                section_name   = GAME_INFO_4_05_SECTION_NAME;
                id_offset      = GAME_INFO_4_05_ID_OFFSET;
                version_offset = GAME_INFO_4_05_VERSION_OFFSET;
                section_prot   = GAME_INFO_4_05_SECTION_PROT;
                break;

            case 455:
                process_name   = GAME_INFO_4_55_PROCESS_NAME;
                section_name   = GAME_INFO_4_55_SECTION_NAME;
                id_offset      = GAME_INFO_4_55_ID_OFFSET;
                version_offset = GAME_INFO_4_55_VERSION_OFFSET;
                section_prot   = GAME_INFO_4_55_SECTION_PROT;
                break;

            case 505:
                process_name   = GAME_INFO_5_05_PROCESS_NAME;
                section_name   = GAME_INFO_5_05_SECTION_NAME;
                id_offset      = GAME_INFO_5_05_ID_OFFSET;
                version_offset = GAME_INFO_5_05_VERSION_OFFSET;
                section_prot   = GAME_INFO_5_05_SECTION_PROT;
                break;

            default:
                break;
            }

            try
            {
                ProcessManager    processManager    = new ProcessManager();
                ProcessInfo       processInfo       = processManager.GetProcessInfo(process_name);
                int               pid               = processInfo.pid;
                MemoryHelper      memoryHelper      = new MemoryHelper(false, processInfo.pid);
                ProcessMap        processMap        = processManager.GetProcessMaps(pid);
                MappedSectionList mappedSectionList = processManager.MappedSectionList;
                mappedSectionList.InitMemorySectionList(processMap);
                List <MappedSection> sectionList = mappedSectionList.GetMappedSectionList(section_name, section_prot);

                if (sectionList.Count != 1)
                {
                    return;
                }

                GameID  = System.Text.Encoding.Default.GetString(memoryHelper.ReadMemory(sectionList[0].Start + id_offset, 16));
                GameID  = GameID.Trim(new char[] { '\0' });
                Version = System.Text.Encoding.Default.GetString(memoryHelper.ReadMemory(sectionList[0].Start + version_offset, 16));
                Version = Version.Trim(new char[] { '\0' });
            }
            catch
            {
            }
        }
        public ProcessMap GetProcessMaps(int pid)
        {
            ProcessMap processMap = MemoryHelper.GetProcessMaps(pid);

            return(processMap);
        }
Exemple #10
0
 public void AddMap(ProcessMap map)
 {
     GetMapsCollection().InsertOne(map);
 }
Exemple #11
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();
        }