ufrisk / pcileech

Direct Memory Access (DMA) Attack Software
GNU Affero General Public License v3.0
4.72k stars 706 forks source link

Reading memory data update is slow #242

Closed Monday-Leo closed 1 year ago

Monday-Leo commented 1 year ago

Hi, I use the python api to read the memory through FPGA,the data is corroct and the speed is very high. But the data read in almost one second are all the same just like picture shows.This means that although my reads are fast, the data I read is all the same. In fact, the memory is dynamically changing, and it is impossible to keep the data unchanged within one second. What's wrong? How can i solve this problem?

D@SF18WG5U8K)V79$%VM0B5

ufrisk commented 1 year ago

By default there is a data cache to speed things up. This gets partially cleared every second or so.

If you wish to avoid reading cached data there is a NOCACHE flag that you may use.

Monday-Leo commented 1 year ago

How can i set the NOCACHE flag in python api? my code is like this:

vmm = memprocfs.Vmm(['-device', 'fpga'])
process_explorer = vmm.process('xxxxx.exe')
Monday-Leo commented 1 year ago

Oh, i guess i find it. is it right? process_explorer.memory.read(address,size,memprocfs.FLAG_NOCACHE)

ufrisk commented 1 year ago

Did it work better with the flag?

Monday-Leo commented 1 year ago

Yes,i have already solved the problem. It works well.

ufrisk commented 1 year ago

Awesome! Thanks for letting me know and best wishes with your DMA attacking.

Let me know if you should run into more issues or require addtional features in the API.