ufrisk / pcileech

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

pcileech library issue #50

Closed false closed 6 years ago

false commented 6 years ago

Hi,

I have been trying to use the pcileech library. My first issue was I could not get it to link from a c++ project, it would never find the correct symbols signature. Switch to C only code resolved the linking problems.

The second one is I basically can't pass the PCILeech_InitializeFPGA call. I use a pcie screamer card for info, x64 windows 10 system. I always get the "FAIL: PCILeech_InitializeFPGA" result. I was thinking, maybe that library is not meant to be used on Windows ?

Or is there anything else I could check to resolve my issues ?

ufrisk commented 6 years ago

Yes, it's a c-library. I'll look into possibly changing this.

About the 2nd issue, I believe it may be that FTD3XX.dll is missing. I forgot to put it in the documentation, but FTD3XX.dll needs to be put alongside the library just like it needs be alongside pcileech.exe. Can you please confirm that this is the issue (or if it's not please let me know as well).

false commented 6 years ago

I had indeed though about that fact after reading through the source, but unfortunatly it did not change anything. I am currently trying to execute your example code directly with the sources to have more traces. If you got any other idea where the error could come from, feel free to share :-)

ufrisk commented 6 years ago

1: I just updated the header files - C++ should now work without the c-workaround. Can you please try it.

2: Can you please try to run pcileech.exe -device fpga -max 0x0000008000000000 display (this is the same as the library does, except for the display command at the end). Or possibly pcileech.exe -device fpga -max 0x0000008000000000 display -v for verbose mode. Is it working or not?

false commented 6 years ago

wow, thanks for this reactivity and your time ; I am going to test right away.

false commented 6 years ago

Ok so :

  1. Tested the C++, it seems to work perfectly so far. Only thing I had to edit is force cast to LPSR the strings you pass in the PCILEEch methods. Exemple : PCILeech_VmmProcessGetFromName("explorer.exe", &dwPID) -> PCILeech_VmmProcessGetFromName((LPSTR)"explorer.exe", &dwPID) . I could not build otherwise.

  2. I don't exactly know how I fixed the issue but it works now. It seems I had a problem between launching directly my application.exe, and runing it in debug. Also, maybe it is one of my reboot that fixed the problem.

Thanks again for this library, now it is time for me to have fun with it :-)

ufrisk commented 6 years ago

Awesome that you got it to work.

Huge thanks for pointing out the c++ compatibility issue. I never tested it in a c++ build so I missed that one. Fortunately it was super easy to resolve, nevertheless thank you for reporting it.

About the casting, thanks for the info, I'll add the casts to the example code I have there. Even though it's not really necessary for the c-code I have it won't hurt to add it either. Edit: I won't add it since there were a lot of those places especially in all the printf statements. Since there are build errors otherwise I hope and think people will notice anyway.

Also, the current version have lousy debugging, error output (i.e. it has none). I'll have to add a function so that the user can enable pcileech printf-output logging to a file. Unfortunately proper error handling won't happen soon since this library is pretty much just bolted onto the existing pcileech.exe in the most ugly - but working way...

Anyway, since everything seems to be resolved now I'm closing this issue. Thank You!