CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Question about reverse engineering on main.hex

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
TonyN
Guest







Question about reverse engineering on main.hex
PostPosted: Fri Apr 10, 2009 4:03 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Apr 10, 2009 4:36 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Apr 10, 2009 11:23 pm     Reply with quote

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








PostPosted: Sat Apr 11, 2009 8:38 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Apr 11, 2009 8:55 am     Reply with quote

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

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Sat Apr 11, 2009 10:47 am     Reply with quote

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

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Sat Apr 11, 2009 11:33 am     Reply with quote

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

View user's profile Send private message

conversion of hex to c
PostPosted: Wed Feb 09, 2011 6:37 pm     Reply with quote

Is it possible to view the assembly code from program memory in C?
temtronic



Joined: 01 Jul 2010
Posts: 9246
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Feb 09, 2011 6:59 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Feb 09, 2011 8:55 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Feb 09, 2011 9:40 pm     Reply with quote

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'.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group