Shop OBEX P1 Docs P2 Docs Learn Events
Help!!! Need to read & decompile program FROM prop. (Virus emergency!!) — Parallax Forums

Help!!! Need to read & decompile program FROM prop. (Virus emergency!!)

m.r.b.m.r.b. Posts: 36
edited 2007-10-04 12:47 in Propeller 1
I· have a major problem....

I have been working on some source code for a few weeks in the evenings.... as time permits.. And it worked fantastically...
I have just been doing minor mods here and there to streamline it, before burn to CD for permanent archiving.
As a matter of course, I·archive·some software changes to zip files, on my HDD, as I went along.. to be on the carefull side!!

... and I normally backup files to external HDD, but the one time I·didn't (still work in progress!!) I landed in trouble!!

Anyway .... As is SO easily done, I opened an email (with a·{??·spoofed}·friends email address), opened an attachment and, well.. the rest is history..
but in the process, 'lost' a few files (my source code+zipped archives) {well actually A LOT more than that but I restored from external HDD}... I used antivirus software, cleaned up my PC.. then tried to recover the files with a file recovery program... but, they are gone beyond recovery!!! (can open them in Prop tool,·some of the·source code is still visable, the rest is jibberish!!)

Can I / What is available to / How do I ... "Read back from the prop chip, through the prop plug interface... then decompile to recover my source code???"

Thanks in advance..

M.R.B.

Comments

  • mcstarmcstar Posts: 144
    edited 2007-09-28 19:01
    The good news is that while rewriting the 2nd version of your software, you'll do a much better job! The code will likely be cleaner and better organized. You will find that the time you spend writing it will be much less than the first time as you won't have to debug as much. Perhaps you'll find yourself refactoring it to create some reusable modules where before you had large blocks of functionality. When you are done, you'll look back and think "Man, I'm glad I rewrote that".
  • Mike GreenMike Green Posts: 23,101
    edited 2007-09-28 19:03
    You could write a program to read the EEPROM using one of the I2C routines in the Object Exchange. It could use one of the serial I/O routines to communicate through the Prop Plug interface to dump the EEPROM to the PC. The program would be run from RAM so it wouldn't overwrite the contents of the EEPROM. You could use BoeBotBasic which has statements that can read the EEPROM and communicates already over the programming interface to a terminal program on the PC.

    As far as decompiling ... there is nothing that will give you back your source code. There are some programs, like GEAR, that will interpret the byte codes and display them, they're not in any form that you can use to reconstruct your source program.
  • RaymanRayman Posts: 14,162
    edited 2007-09-28 19:08
    You know the .SPIN files are just text files. If you can see some if it in the Prop tool, try renaming the extension to ".txt" and open with Notepad or Word or something... Maybe then you can see more of it... This is maybe a long shot, but worth a try.
  • rjo_rjo_ Posts: 1,825
    edited 2007-09-28 19:43
    My entire computer died during a storm... and never came back to life. I now e-mail my important spin files to myself...hope I don't give myself a virus[noparse]:)[/noparse]
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-09-28 19:50
    This is a long shot, but do a Search for *.spin beginning in your c:\Documents and Settings\ folder. You may find a copy of your lost program there.

    -Phil
  • Ken PetersonKen Peterson Posts: 806
    edited 2007-09-29 14:17
    I like mcstar's response. It's not good news, but sometimes it's a silver lining. I guess it depends on how good your notes are, and what your deadlines are!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    The more I know, the more I know I don't know.· Is this what they call Wisdom?
  • Paul_HPaul_H Posts: 85
    edited 2007-10-03 01:19
    MRB,
    I work in the computer security area (just on hat that I wear) and recommend that you try spinrite. This is a great hard drive recovery tool from grc.com. Its about $90 at their website. This isn't an ad, and I don't get anything back from them other than satisfaction that they might get a sale to make up for the, ahh, lets say lag with my initial purchase, which has been rectified! I have recovered a few HD after the OS though they were dead, most recently my sisters.

    It's not meant to be a deleted file recovery tool, but it does a good job of uncovering damaged data.

    I hope it helps.
    g/l!

    Paul
  • hippyhippy Posts: 1,981
    edited 2007-10-03 18:52
    I've been looking at the Spin bytecode and it is notable that various syntactical elements generate specific bytecode sequences, and, vice-versa, bytecodes used point towards particular syntax. It should therefore be possible to generate a very close representation of original Spin source code from an Eeprom dump.

    I'm prepared to put my neck on the line if someone wants to post a .binary file which I've never seen before for decompilation. This will be by-hand decompilation so please don't get carried away with "crack this, sucker". Let's start with just one short .binary, ~100 bytes / ~25 longs, of reasonably sensible code and see where I get to. It should be enough that I can get a feel for how easy or hard it actually is to do.
  • m.r.b.m.r.b. Posts: 36
    edited 2007-10-04 11:39
    There is no deadline as such, since this is a personal project... I was just frustrated to see my work 'go up in smoke' ... So...

    I have 2/3rds re-written my source code... in 1 saturday + sunday afternoon + a few hours here-and-there in the evenings...

    It looks a LOT better structured than my first attempt... There are now more features included, that I wanted to include in the old version, but couldn't due to the structuring of the old version being so bad!!!.. The consensus was right, it does turn out better, and in half the time (or less!!) if re-written from scratch!!

    In a way... Things appear to have turned out OK... and .. I have learned to program the propeller 'better' (used to PIC + Z80 ETC..)

    I am ALLWAYS saving EACH software change to external USB HDD, so that I can...
    1) Roll back if I don't like changes I make
    2) For data security, if I were to lose the source again.

    Regards MRB
  • hippyhippy Posts: 1,981
    edited 2007-10-04 12:18
    Indeed, as already said, and you're proving here ( and it's my experience as well ), a complete re-write can often be far better than the first attempt and achieved in a much shorter timeframe.

    It usually takes a lot of courage to throw away what one has, especially after a protracted development period, and you actually got an opportunity to capitalise on as you're finding now. If nothing else, all those 'nasty hacks' and kludges needed to make the old version work can be rolled into a new design from the ground up giving a much improved version.

    I was thinking more of decompilation as an academic exercise rather than a fix for your particular problem, and I'd still be grateful if someone would be kind enough to throw me a bit of .binary I can have a go at decompiling.
  • RDL2004RDL2004 Posts: 2,554
    edited 2007-10-04 12:47
    USB Flash drives are so cheap these days that it wouldn't hurt to also get one of those to make redundant back-ups. I use one of those MicroSD cards (1GB) that slides into a USB adapter. You can carry it on a keychain. I paid $8 for it and the adapter came with the 2GB card I bought for my phone.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Rick
Sign In or Register to comment.