View previous topic :: View next topic |
Author |
Message |
TonyN Guest
|
Question about reverse engineering on main.hex |
Posted: Fri Apr 10, 2009 4:03 pm |
|
|
hi,
My clients request me to give them the hex file so that they can burn it into the board. I just wonder if they have the main.hex file, can they do the reverse engineering to obtain to the source code? How is easy they can do that? is there a way i can do to prevent that happen?
I use PIC18F722 and my code space is about 64K and memory space is about 70% of the PIC18F722 RAM
Thanks, |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Apr 10, 2009 4:36 pm |
|
|
They can set the PIC type in MPLAB, then use the Import function to
load it. Then they can see the whole ASM code with View / Program
Memory. Any competent programmer can figure out what the code is
doing. Going to C source would be a little bit harder but not impossible.
But the ASM code is enough to reverse engineer the functionality. |
|
|
Sergio
Joined: 16 Oct 2003 Posts: 11 Location: Arkansas, USA
|
|
Posted: Fri Apr 10, 2009 11:23 pm |
|
|
It would be very hard but not impossible.
On the other hand why would they want to do that? They just paid you to create the program.
BTW, unless you specified in the contract, if they pay you then that source code belongs to them.
Cheers,
Sergio _________________ Sergio |
|
|
Guest
|
|
Posted: Sat Apr 11, 2009 8:38 am |
|
|
I have had a similar request.
What I do is remote desktop into their machine and I load with protect on, the hex file. So no reverse engineering can be done. |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Sat Apr 11, 2009 8:55 am |
|
|
Quote: | So no reverse engineering can be done. | The data stream can still be catched during download. |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1635 Location: Perth, Australia
|
|
Posted: Sat Apr 11, 2009 10:47 am |
|
|
Sergio wrote: | BTW, unless you specified in the contract, if they pay you then that source code belongs to them. |
No - this is not correct. It is the other way around. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1635 Location: Perth, Australia
|
|
Posted: Sat Apr 11, 2009 11:33 am |
|
|
FvM wrote: | Quote: | So no reverse engineering can be done. | The data stream can still be catched during download. |
The best solution to this problem is to supply the pre-programmed chips yourself or to use an Encrypted bootloader. Only the former is foolproof. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
ratheeshbr
Joined: 26 Jan 2011 Posts: 31
|
conversion of hex to c |
Posted: Wed Feb 09, 2011 6:37 pm |
|
|
Is it possible to view the assembly code from program memory in C? |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9246 Location: Greensville,Ontario
|
|
Posted: Wed Feb 09, 2011 6:59 pm |
|
|
Reverse enginneering from the .hex file into the source code is not that difficult as PICs only have 35 instructions compared to the 180+ the Z-80 had back 25+ years ago.
True, you won't get the author's labels but generic ones, and of course no comments. You also know the PIC type which helps, as well as any peripherals on the PCB.
When the 16c84s came out it became a challenge, more of a mind game, to reverse engineer the code. And like every 'lock' there is a 'key' to open the door.
The final question 'Is it possible to view the assembly code from program memory in C?' yes, if you mean, can I create a C program to read the program memory contents of another PIC. |
|
|
ratheeshbr
Joined: 26 Jan 2011 Posts: 31
|
|
Posted: Wed Feb 09, 2011 8:55 pm |
|
|
I am having a hex file. I use the import function in Mplab and I can now see the Assembly listing. But its difficult. Can I convert it into C, so that i can easily understand? |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9246 Location: Greensville,Ontario
|
|
Posted: Wed Feb 09, 2011 9:40 pm |
|
|
You'll get a much better education and appreciation for the PIC if you learn the 35 instructions of the PIC. Just grab the databook, open to the chapter on your PIC and printout the disassembled code.
It is NOT that hard, especially with the huge amount of information available on the Web.
Since you already know what the program does as well as the hardware you should be able to follow the 'flow of the code'.
Sure you could download a 'reassembler to C' but there's NO knowledge gained in that 'cheat'. |
|
|
|