Code playing method and device
By executing the sorting and gap-filled code data in the terminal simulator, the code execution process is dynamically displayed, and the problem of inefficient auditing in the prior art is solved, and efficient analysis and display of user operation records is achieved.
Patent Information
- Application Number
- CN202510045586.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-10
- Publication Date
- 2025-05-02
AI Technical Summary
The prior art is difficult to effectively display and analyze user's operational records in web applications, especially when tracking specific user sessions or events, auditing is inefficient.
By executing sorted and gap-filled code data in the terminal simulator, the code execution process is dynamically displayed, thereby real-time analysis and auditing of user operations.
It improves audit efficiency, enables auditors to analyze operation records faster, and enhances the understanding of user operation processes and displays system responses.
Smart Images

Figure CN119917397A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of Internet Web applications, and in particular to a code playing method and device. Background Art
[0002] In the operation and maintenance process of Web applications, audit management is an important part of information system security, which means that user operation records need to be audited.
[0003] User operation records are usually in the form of code snippets, screenshots or log files. However, auditing code snippets, screenshots or log files cannot effectively obtain the user's operation process and cross-cloud operations, especially when it is necessary to track specific user sessions or events. At the same time, existing code demonstration tools and session auditing tools cannot display the user's operation process and system response, which is not easy to analyze and interpret, resulting in low audit efficiency.
[0004] Therefore, how to improve audit efficiency is an issue that needs to be addressed urgently. Summary of the invention
[0005] The embodiment of the present invention provides a code playback method and device, which is used to execute code data corresponding to operation records that need to be audited based on a terminal simulator, and dynamically display the execution process of the code, so that auditors can analyze the operation records more quickly and improve audit efficiency.
[0006] In a first aspect, an embodiment of the present invention provides a code playback method, including:
[0007] receiving an audit request and determining first code data corresponding to the audit request, wherein the audit request is used to indicate an operation record that needs to be audited, and the first code data includes at least two code fragments and timestamps corresponding to the at least two code fragments;
[0008] sorting the at least two code fragments based on the timestamps corresponding to the at least two code fragments, and performing gap filling on the time period between the timestamps corresponding to the at least two code fragments to obtain second code data;
[0009] The second code data is input into a terminal simulator for execution to obtain the execution process of the second code data, and the execution process is sent to a user terminal so that the user terminal displays the execution process to the user for audit based on a web page. The terminal simulator is used to simulate a terminal for executing code data in a web page.
[0010] In the above technical solution, when the user needs to audit the operation record of the Web page, an audit request will be initiated. After receiving the audit request, the server will determine the first code data corresponding to the operation record indicated by the audit request. Then, at least two code fragments in the first code data are sorted, and the time period between the timestamps corresponding to the at least two code fragments is gap-filled to ensure that the code can be executed in sequence and the smoothness of the code execution can be ensured. After obtaining the second code data, the second code data is input into the terminal simulator for execution to obtain the execution process of the second code data, and the execution process is sent to the user end. After the user end obtains the execution process, the execution process is displayed to the user based on the simulated terminal interface in the Web page, and the user can view the dynamic code, understand the user's operation, and improve the audit efficiency.
[0011] Optionally, after receiving the audit request, the method further includes:
[0012] A speed instruction is received, where the speed instruction is used to indicate an execution speed of the second code data in the terminal emulator.
[0013] Optionally, sorting the at least two code fragments based on the timestamps corresponding to the at least two code fragments, and performing gap filling on the time period between the timestamps corresponding to the at least two code fragments to obtain the second code data includes:
[0014] detecting the format, type and source of the at least two code snippets;
[0015] If the detection passes, sorting the at least two code fragments based on the timestamps corresponding to the at least two code fragments;
[0016] It is detected whether there is a blank time period between the timestamps corresponding to the at least two code fragments, and if there is a blank time period, the timestamp and the placeholder corresponding to the timestamp are filled in the blank time period to obtain the second code data.
[0017] In the above technical solution, gap detection and filling are performed between the timestamps corresponding to at least two code fragments, so that the execution process of the code data output in the terminal simulator is smoother, which is convenient for users to audit based on the execution process.
[0018] Optionally, the second code data is input into a terminal simulator for execution to obtain an execution process of the second code data, including:
[0019] Extracting each code fragment and placeholder in sequence based on the timestamp in the second code data;
[0020] The code fragments and the placeholders are sequentially input into a terminal emulator, and are executed at an execution speed indicated by the speed instruction to obtain an execution process of the second code data.
[0021] Optionally, after sending the execution process to the user terminal so that the client terminal displays the execution process to the user for audit based on a Web page, the method further includes:
[0022] receiving a first instruction, where the first instruction may be used to instruct to pause execution of the second code data, or to start execution of the second code data, or to adjust execution progress of the second code data, or to adjust execution speed of the second code data;
[0023] In response to the first instruction, the execution of the second code data in the terminal emulator is controlled, the execution process of the second code data is updated, and sent to the user terminal.
[0024] In the above technical solution, the server responds to the first instruction to control the execution of the second code data in the terminal emulator, allowing the user to start, pause, replay or jump to a specific part of the code at any time, and supports adjusting the playback speed to adapt to the understanding and auditing speed of different users.
[0025] In a second aspect, an embodiment of the present invention provides a code playback device, including:
[0026] an acquisition module, configured to receive an audit request and determine first code data corresponding to the audit request, wherein the audit request is used to indicate an operation record that needs to be audited, and the first code data includes at least two code fragments and timestamps corresponding to the at least two code fragments;
[0027] a processing module, configured to sort the at least two code fragments based on the timestamps corresponding to the at least two code fragments, and fill the gap between the time periods corresponding to the timestamps corresponding to the at least two code fragments to obtain second code data;
[0028] The second code data is input into a terminal simulator for execution to obtain the execution process of the second code data, and the execution process is sent to a user terminal so that the user terminal displays the execution process to the user for audit based on a web page. The terminal simulator is used to simulate a terminal for executing code data in a web page.
[0029] Optionally, the processing module is further used for:
[0030] A speed instruction is received, where the speed instruction is used to indicate an execution speed of the second code data in the terminal emulator.
[0031] Optionally, the processing module is specifically used for:
[0032] detecting the format, type and source of the at least two code snippets;
[0033] If the detection passes, sorting the at least two code fragments based on the timestamps corresponding to the at least two code fragments;
[0034] It is detected whether there is a blank time period between the timestamps corresponding to the at least two code fragments, and if there is a blank time period, the timestamp and the placeholder corresponding to the timestamp are filled in the blank time period to obtain the second code data.
[0035] Optionally, the processing module is specifically used for:
[0036] Extracting each code fragment and placeholder in sequence based on the timestamp in the second code data;
[0037] The code fragments and the placeholders are sequentially input into a terminal emulator, and are executed at an execution speed indicated by the speed instruction to obtain an execution process of the second code data.
[0038] Optionally, the processing module is further used for:
[0039] receiving a first instruction, where the first instruction may be used to instruct to pause execution of the second code data, or to start execution of the second code data, or to adjust execution progress of the second code data, or to adjust execution speed of the second code data;
[0040] In response to the first instruction, the execution of the second code data in the terminal emulator is controlled, the execution process of the second code data is updated, and sent to the user terminal.
[0041] In a third aspect, an embodiment of the present invention further provides a computer device, including:
[0042] A memory for storing program instructions;
[0043] The processor is used to call the program instructions stored in the memory and execute the above-mentioned code playing method according to the obtained program.
[0044] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the above-mentioned code playback method.
[0045] In a fifth aspect, an embodiment of the present invention further provides a computer program product, wherein the computer program product includes an executable program, and the executable program is executed by a processor to perform the above-mentioned code playback method. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0047] Figure 1 A schematic diagram of a system architecture provided by an embodiment of the present invention;
[0048] Figure 2 A schematic diagram of a flow chart of a code playback method provided by an embodiment of the present invention;
[0049] Figure 3 A schematic diagram of the structure of a code playback device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0050] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0051] The application scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions protected by the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. It is known to those of ordinary skill in the art that with the emergence of new application scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems. The terms "first" and "second" in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In the description of the present application, unless otherwise specified, the meaning of "multiple" is two or more.
[0052] Before introducing a code playback method provided in an embodiment of the present application, for ease of understanding, the following terms related to the embodiment of the present application are first introduced.
[0053] Xterm: An open source terminal emulator library that can simulate a terminal environment in web applications. It allows developers to display and run command line programs on web pages to interact with backend systems.
[0054] FitAddon: It is a plugin for Xterm that automatically resizes the terminal view to fit the dimensions of the container element.
[0055] Gap filling: aims to create a continuous and ordered set of timestamps to simplify time series data analysis. In a data set, some timestamps may have no corresponding data points, and these timestamps are called "gaps". Gap filling makes the data set more complete and continuous by filling these missing data points.
[0056] Figure 1 A system architecture applicable to an embodiment of the present invention is exemplarily shown, and the system architecture includes a server 110 and a user 120 .
[0057] The server 110 is used to receive an audit request initiated by the user end and determine the first code data corresponding to the audit request. Then, at least two code fragments are sorted based on the timestamps corresponding to at least two code fragments in the first code data, and the time period between the timestamps corresponding to at least two code fragments is gap-filled to obtain the second code data. Finally, the second code data is input into the terminal emulator for execution, the execution process of the second code data is obtained, and the execution process is sent to the user end 110. Among them, the terminal emulator is a terminal emulator instance created using the Xterm.js library, and it is embedded in the web page, and the FitAddon plug-in is used to ensure that the simulated terminal interface in the user end 120 can adapt to the page size. The terminal emulator also includes a playback control engine that can support recording key states during code execution and allow starting, pausing, replaying or jumping to a specific part of the code at any time. In addition, the engine also supports adjusting the playback speed to adapt to the understanding and audit speed of different users. Therefore, the server 110 is also used to receive the first instruction initiated by the user end 120, and control the execution of the second code data in the terminal emulator in response to the first instruction.
[0058] The user terminal 120 is used for the user to generate an audit request based on the operation record that needs to be audited, and send it to the server terminal 110. Then, the execution process of the second code data sent by the server is received, and the simulated terminal interface in the web page is displayed to the user. It is also used to trigger the first instruction based on the user's operation on the simulated terminal interface and send it to the server 110. It can be understood that the simulated terminal interface provides intuitive control elements such as play / pause buttons, progress sliders, speed selectors and status displays, allowing users to easily interact and customize the playback experience. The user terminal can be a terminal device used by the user, and the terminal device can be a mobile phone, a tablet computer, a laptop computer, a netbook, a car-mounted device, and a business intelligent terminal (including: videophone, conference desktop intelligent terminal, etc.), a personal digital assistant (personal digital assistant, PDA), an augmented reality (augmented reality, AR)\virtual reality (virtual reality, VR) device, etc. The embodiment of the present application does not limit the specific form of the terminal device.
[0059] It should be noted that the above Figure 1 The structure shown is only an example and is not limited to this embodiment of the present invention.
[0060] Based on the above description, Figure 2 A schematic flow chart of a code playback method provided by an embodiment of the present invention is exemplarily shown, and the flow chart can be executed by a code playback device.
[0061] like Figure 2 As shown in the figure, the process specifically includes:
[0062] Step 210, receiving an audit request and determining first code data corresponding to the audit request, wherein the audit request is used to indicate an operation record that needs to be audited, and the first code data includes at least two code fragments and timestamps corresponding to the at least two code fragments.
[0063] In an embodiment of the present invention, when a user needs to audit operation records within any time period, an audit request will be initiated to the server based on the user terminal. The audit request is used to indicate the operation records that need to be audited. The operation records are stored in the form of timestamps and code snippets. Specifically, based on the web page in the user terminal, the user fills in the operation records that need to be audited into the form data, and sends the form data as an audit request to the server. The form data is used to indicate the user that needs to be audited and the operation records of the user that need to be audited. For example, the form data indicates the operation records of user A from 11:00 to 11:30 on January 20, 2024.
[0064] After the server receives the audit request sent by the user, it obtains the first code data corresponding to the audit request from the backend through the API interface. The first code data includes at least two code snippets and timestamps corresponding to the at least two code snippets. The backend can be a database for storing code data and timestamps corresponding to operation records. In some possible embodiments, the code data and timestamps corresponding to the operation records can also be stored in the server of the server. Therefore, after the server receives the audit request sent by the user, the first code data corresponding to the audit request is filtered out from the stored code data and timestamps.
[0065] In a possible implementation, after receiving the audit request sent by the client, the server also receives a speed instruction, wherein the speed instruction is used to indicate the execution speed of the code data in the terminal simulator, such as 0.75 times speed, 0.5 times speed, 1 times speed, 2 times speed, etc.
[0066] Step 220: sort the at least two code fragments based on the timestamps corresponding to the at least two code fragments, and fill the gap between the time periods corresponding to the timestamps corresponding to the at least two code fragments to obtain second code data.
[0067] In the embodiment of the present invention, after determining the first code data corresponding to the audit request, the server first pre-processes the first code data to obtain the second code data. The pre-processing may include trust detection, sorting, and gap filling.
[0068] Specifically, the format, type and source of at least two code snippets are detected. Exemplarily, a regular detection algorithm is set based on the compliant format, type and source of the code snippets. After obtaining at least two code snippets, the format, type and source of the at least two code snippets are detected based on the set regular detection algorithm. It can be understood that other methods can also be used to detect the format, type and source of at least two code snippets, and the specific detection method is not limited here.
[0069] If the detection passes, at least two code snippets are sorted based on the timestamps corresponding to the at least two code snippets. Exemplarily, the first code data includes 3 code snippets. The 3 code snippets are sorted based on the corresponding timestamps, and finally the timestamp corresponding to the first code snippet is 11:10 on January 20, 2024, the timestamp corresponding to the second code snippet is 11:11 on January 20, 2024, and the timestamp corresponding to the third code snippet is 11:15 on January 20, 2024. It can be understood that sorting the code snippets based on the corresponding timestamps can ensure that the execution process of the code data obtained based on the terminal emulator is presented in the order in which it actually occurs.
[0070] Then, detect whether there is a blank time period between the timestamps corresponding to at least two code snippets, and if there is a blank time period, fill the timestamp and the placeholder corresponding to the timestamp in the blank time period to obtain the second code data. Exemplarily, the timestamp unit is minute, there is no blank time period between the timestamp 11:10 on January 20, 2024 corresponding to the first code snippet and the timestamp 11:11 on January 20, 2024 corresponding to the second code snippet, and there is a blank time period from 11:12 on January 20, 2024 to 11:14 on January 20, 2024 between the timestamp 11:11 on January 20, 2024 corresponding to the second code snippet and the timestamp 11:15 on January 20, 2024 corresponding to the third code snippet. Then fill the blank time period with the timestamps 11:12 on January 20, 2024, 11:13 on January 20, 2024, and 11:14 on January 20, 2024, and the placeholders corresponding to the timestamps, and finally obtain the second code data. The second code data includes a series of continuous timestamps, and the code fragments or placeholders corresponding to the timestamps. It can be understood that filling the gaps between the timestamps corresponding to at least two code fragments can ensure the continuity of the data, and can ensure that the progress bar of the execution process of the code data obtained based on the terminal simulator is continuous and can be played smoothly.
[0071] Step 230, input the second code data into the terminal simulator for execution, obtain the execution process of the second code data, and send the execution process to the user end, so that the user end displays the execution process to the user for audit based on the Web page. The terminal simulator is used to simulate the terminal used to execute the code data in the Web page.
[0072] In an embodiment of the present invention, after obtaining the second code data, the server inputs the second code data into a terminal simulator for execution, and obtains the execution process of the second code data. Specifically, based on the timestamp in the second code data, each code snippet and placeholder is extracted in sequence. Then, each code snippet and placeholder is input into the terminal simulator in sequence, and is executed at the execution speed indicated by the speed instruction, to obtain the execution process of the second code data. Exemplarily, continuing with the above example, based on the timestamp, the first code snippet, the second code snippet, placeholder 1, placeholder 2, placeholder 3, and the third code snippet are extracted in sequence, and are input into the terminal simulator in sequence to obtain the execution process. It can be understood that the terminal simulator is used to simulate a terminal for executing code data in a Web page, so the obtained execution process looks like the second code data is executed line by line in a real terminal.
[0073] Finally, the server sends the execution process of the second code data to the client. After receiving the execution process of the second code data, the client displays the execution process to the user based on the simulated terminal interface in the Web page for the user to audit.
[0074] In a possible implementation, after the server sends the execution process of the second code data to the user end, it may receive a first instruction sent by the user end. Among them, the first instruction can be used to instruct to pause the execution of the second code data, or to start the execution of the second code data, or to adjust the execution progress of the second code data, or to adjust the execution speed of the second code data. Specifically, the simulation terminal interface in the web page of the user end includes a progress bar, a play / pause button, an increase / decrease button, and a replay button. The progress bar is used to fast forward or rewind the execution process of the code by dragging; the play / pause button is used to control the execution status of the code, click the play button to start playing, and click the pause button to stop playing; the increase / decrease button is used to adjust the playback speed to achieve accelerated or decelerated playback; the replay button is used to restart the code playback, and the server will reset all states, including the playback speed, progress bar position, and terminal output, and then play the code from the beginning. Exemplarily, the terminal simulator is bidirectionally bound to the button on the simulation terminal interface, and the terminal simulator is bidirectionally bound to the progress bar on the simulation terminal interface. The user clicks the button on the simulation terminal interface or drags the progress bar to trigger the corresponding first instruction.
[0075] Finally, the server side controls the execution of the second code data in the terminal emulator in response to the first instruction, updates the execution process of the second code data, and sends it to the user side.
[0076] It is understandable that in practice, the embodiments of the present invention can be implemented in multiple scenarios. The embodiments of the present invention are highly adaptable and have broad application prospects because they can provide real-time and dynamic code execution display. This method can be considered in situations where it is necessary to display, educate, analyze or audit the code execution process. For example, it is more prominent in scenarios with large user differences such as various training, technical support, vulnerability reproduction, and remote operation records.
[0077] In an embodiment of the present invention, the code data corresponding to the operation records that need to be audited are sorted based on the timestamp, which can ensure that the execution process of the code data obtained based on the terminal simulator is presented in the order in which it actually occurred. Then, the timestamps corresponding to the code data are gap-filled to ensure that the progress bar of the execution process of the code data obtained based on the terminal simulator is continuous and can be played smoothly when displayed to the user. By integrating the terminal simulator, the code data is executed to obtain the execution process of the code data, and the code execution process is dynamically replayed, providing users with a more intuitive audit experience and improving audit efficiency. In addition, during the audit process, the user can interact with the execution process in real time, control the playback, pause and speed adjustment of the code execution process, improve interactivity, and enable users to view, control the code and reproduction process more flexibly, which is of great significance for security monitoring and post-audit.
[0078] Based on the same technical concept, Figure 3 The schematic diagram of the structure of a code playback device provided by an embodiment of the present invention is exemplarily shown, and the device can execute the process of the code playback method.
[0079] like Figure 3 As shown, the device specifically includes:
[0080] The acquisition module 310 is used to receive an audit request and determine first code data corresponding to the audit request, wherein the audit request is used to indicate an operation record that needs to be audited, and the first code data includes at least two code fragments and timestamps corresponding to the at least two code fragments;
[0081] A processing module 320, configured to sort the at least two code fragments based on the timestamps corresponding to the at least two code fragments, and fill the gap between the time periods corresponding to the timestamps corresponding to the at least two code fragments to obtain second code data;
[0082] The second code data is input into a terminal simulator for execution to obtain the execution process of the second code data, and the execution process is sent to a user terminal so that the user terminal displays the execution process to the user for audit based on a web page. The terminal simulator is used to simulate a terminal for executing code data in a web page.
[0083] Optionally, the processing module 320 is further used for:
[0084] A speed instruction is received, where the speed instruction is used to indicate an execution speed of the second code data in the terminal emulator.
[0085] Optionally, the processing module 320 is specifically used for:
[0086] detecting the format, type and source of the at least two code snippets;
[0087] If the detection passes, sorting the at least two code fragments based on the timestamps corresponding to the at least two code fragments;
[0088] It is detected whether there is a blank time period between the timestamps corresponding to the at least two code fragments, and if there is a blank time period, the timestamp and the placeholder corresponding to the timestamp are filled in the blank time period to obtain the second code data.
[0089] Optionally, the processing module 320 is specifically used for:
[0090] Extracting each code fragment and placeholder in sequence based on the timestamp in the second code data;
[0091] The code fragments and the placeholders are sequentially input into a terminal emulator, and are executed at an execution speed indicated by the speed instruction to obtain an execution process of the second code data.
[0092] Optionally, the processing module 320 is further used for:
[0093] receiving a first instruction, where the first instruction may be used to instruct to pause execution of the second code data, or to start execution of the second code data, or to adjust execution progress of the second code data, or to adjust execution speed of the second code data;
[0094] In response to the first instruction, the execution of the second code data in the terminal emulator is controlled, the execution process of the second code data is updated, and sent to the user terminal.
[0095] Based on the same technical concept, an embodiment of the present invention further provides a computer device, including:
[0096] A memory for storing program instructions;
[0097] The processor is used to call the program instructions stored in the memory and execute the above code playing method according to the obtained program.
[0098] Based on the same technical concept, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the above-mentioned code playback method.
[0099] Based on the same technical concept, an embodiment of the present invention further provides a computer program product, characterized in that the computer program product includes an executable program, and the executable program is executed by a processor to perform the above-mentioned code playback method.
[0100] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0101] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0102] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0103] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0104] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A code playing method, characterized in that: include: receiving an audit request and determining first code data corresponding to the audit request, wherein the audit request is used to indicate an operation record that needs to be audited, and the first code data includes at least two code fragments and timestamps corresponding to the at least two code fragments; sorting the at least two code fragments based on the timestamps corresponding to the at least two code fragments, and performing gap filling on the time period between the timestamps corresponding to the at least two code fragments to obtain second code data; The second code data is input into a terminal simulator for execution to obtain the execution process of the second code data, and the execution process is sent to a user terminal so that the user terminal displays the execution process to the user for audit based on a web page. The terminal simulator is used to simulate a terminal for executing code data in a web page.
2. The method according to claim 1, characterized in that After receiving the audit request, the method further includes: A speed instruction is received, where the speed instruction is used to indicate an execution speed of the second code data in the terminal emulator.
3. The method according to claim 1, characterized in that The method comprises: sorting the at least two code fragments based on the timestamps corresponding to the at least two code fragments, and performing gap filling on the time period between the timestamps corresponding to the at least two code fragments to obtain second code data, including: detecting the format, type and source of the at least two code snippets; If the detection passes, sorting the at least two code fragments based on the timestamps corresponding to the at least two code fragments; It is detected whether there is a blank time period between the timestamps corresponding to the at least two code fragments, and if there is a blank time period, the timestamp and the placeholder corresponding to the timestamp are filled in the blank time period to obtain the second code data.
4. The method according to any one of claims 1 to 3, characterized in that Inputting the second code data into a terminal simulator for execution to obtain an execution process of the second code data includes: Extracting each code fragment and placeholder in sequence based on the timestamp in the second code data; The code fragments and the placeholders are sequentially input into a terminal emulator, and are executed at an execution speed indicated by the speed instruction to obtain an execution process of the second code data.
5. The method according to claim 1, characterized in that After sending the execution process to the user terminal so that the client terminal displays the execution process to the user for audit based on a Web page, the method further includes: receiving a first instruction, where the first instruction may be used to instruct to pause execution of the second code data, or to start execution of the second code data, or to adjust execution progress of the second code data, or to adjust execution speed of the second code data; In response to the first instruction, the execution of the second code data in the terminal emulator is controlled, the execution process of the second code data is updated, and sent to the user terminal.
6. A code playback device, characterized in that: include: an acquisition module, configured to receive an audit request and determine first code data corresponding to the audit request, wherein the audit request is used to indicate an operation record that needs to be audited, and the first code data includes at least two code fragments and timestamps corresponding to the at least two code fragments; a processing module, configured to sort the at least two code fragments based on the timestamps corresponding to the at least two code fragments, and fill the gap between the time periods corresponding to the timestamps corresponding to the at least two code fragments to obtain second code data; The second code data is input into a terminal simulator for execution to obtain the execution process of the second code data, and the execution process is sent to a user terminal so that the user terminal displays the execution process to the user for audit based on a web page. The terminal simulator is used to simulate a terminal for executing code data in a web page.
7. The device according to claim 6, characterized in that The processing module is specifically used for: detecting the format, type and source of the at least two code snippets; If the detection passes, sorting the at least two code fragments based on the timestamps corresponding to the at least two code fragments; It is detected whether there is a blank time period between the timestamps corresponding to the at least two code fragments, and if there is a blank time period, the timestamp and the placeholder corresponding to the timestamp are filled in the blank time period to obtain the second code data.
8. A computer device, characterized in that: include: A memory for storing program instructions; A processor, configured to call the program instructions stored in the memory, and execute the method according to any one of claims 1 to 5 according to the obtained program.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the method according to any one of claims 1 to 5.
10. A computer program product, characterized in that The computer program product comprises an executable program, which is executed by a processor to implement the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Multi-viewpoint video playing control method and device, electronic equipment and storage medium
CN111866525A
Code auditing method and device, electronic equipment and readable storage medium
CN117786686A
Method for monitoring program code execution behavior, and computer device
WO2021164271A1