python or bash snapshot current cpu realtime binary calculations

For discussions about programming, and for programming questions and advice


Moderator: Forum moderators

Post Reply
blumenwesen
Posts: 37
Joined: Sun Apr 10, 2022 10:02 pm

python or bash snapshot current cpu realtime binary calculations

Post by blumenwesen »

Hi, can the current pc work be displayed in binary with bash or python?
A snapshot of the current realtime cpu calculations in binary, i.e. the complete system working code from the processor.
Only a short excerpt may be possible at intervals, otherwise the work of the selection program would consume exponentially more resources and the pc crashes.

blumenwesen
Posts: 37
Joined: Sun Apr 10, 2022 10:02 pm

Re: python or bash snapshot current cpu realtime binary calculations

Post by blumenwesen »

Ok, it seems to be impossible.
But how can I read out the memory in a short moment?

williams2
Posts: 1061
Joined: Sat Jul 25, 2020 5:45 pm
Been thanked: 304 times

Re: python or bash snapshot current cpu realtime binary calculations

Post by williams2 »

can the current pc work be displayed in binary with bash or python?

Python is very slow.

Bash is very, very slow.

I do not think either would work to write what seems to be a monitor program.
https://en.wikipedia.org/wiki/Machine_code_monitor

If you are trying to watch micro code as it is executing,
it would probably be easier to examine the (open source) source code.

There are, of course, various reverse engineering tools.

One thing to consider: any code running in user space will have strict limits of what ram you can access.
Trying to access ram memory that you are not permitted to access will result in an immediate seg fault or memory access error.

You can examine the ram memory in /proc or /sys or in /dev
But the kernel will not let you read more than a few megs,
to prevent you from doing what you seem to want to do..

For example, cat /dev/mem | hd

blumenwesen
Posts: 37
Joined: Sun Apr 10, 2022 10:02 pm

Re: python or bash snapshot current cpu realtime binary calculations

Post by blumenwesen »

It should be just a short excerpt, and show a few recent reactions of the program code processing.
A few MB is more than enough, where /proc or /sys or in /dev can the kernel be read?

williams2
Posts: 1061
Joined: Sat Jul 25, 2020 5:45 pm
Been thanked: 304 times

Re: python or bash snapshot current cpu realtime binary calculations

Post by williams2 »

I think /dev/mem is what ram that the kernel can access.
But the kernel will not allow you to see all of the ram in /dev/mem in case you are a hacker with evil intentions.

For example:

https://bakhi.github.io/devmem/

Directly Access Your Physical Memory (dev/mem) - Heejin Park bakhi.github.io/devmem/ 2020-12-10T00:00:00.0000000 "/dev/mem" is a character device file, image of the main memory of system. It allows to directly access any phys address. 2 How to use 2.1 Requisites. To use /dev/mem, your kernel must be configured with "CONFIG_STRICT_DEVMEM=n", or it prevent access from even privileged user.

blumenwesen
Posts: 37
Joined: Sun Apr 10, 2022 10:02 pm

Re: python or bash snapshot current cpu realtime binary calculations

Post by blumenwesen »

Ok I was hoping there is a way to read out current data directly without assambler. Thanks anyway.

Post Reply

Return to “Programming”