It is currently Sun Sep 05, 2010 9:46 am

All times are UTC





Post new topic Reply to topic  [ 162 posts ]  Go to page 1, 2, 3, 4, 5 ... 11  Next
Author Message
 Post subject: Image updating script for m:robe 500i = READY!
PostPosted: Fri Apr 28, 2006 10:52 pm 
M:Veteran

Joined: Sat Dec 17, 2005 8:22 pm
Posts: 94
Offline
EDIT: THIS MESSAGE IS OUT DATE.
visit
http://mrobe.fan.googlepages.com/
for the latest version.

hi all,
a script that does everything for you!
it decrypts the file,
gets images by their number from m:robe, (then
you can change them).
use the updateimage function to upload them back. use CorrectCRC to render the new CRC, and Encrypt to create the final file.

use at your own risk!

(it works, i've managed to change some pictures, very cool).

if anyone has a good site where we can put this file let me know. meanwhile, you can just copy/paste this
python script, which does everything for you !

have fun,

shirour

mrobe500script.py:
------------------
Code:
#           m:robe 500i image updater script - Ver 0.95 BETA
# -------------------------------------------------------------------
# Created by: shirour                                        29/04/06
# Usage:
#
#   DISCLAIMER: USE THIS SCRIPT AT YOUR OWN RISK!
#    
# DecryptFile(inputfile,outputfile)
#    default inputfile  = "N5002-BD.BIN"
#    default outputfile = "N5002-BD.DEC"
#
#   Decrypts the original firmware file (inverse it and reorder the bits)
#
# CorrectCRC(inputfile,outputfile):
#
#   default inputfile  = "N5002-BD.DEC"
#   default outputfile = "N5002-BD.DEC"
#
#   Updates the CRC according to the updated _DECRYPTED_(!) file.
#
# EncryptFile(inputfile,outputfile)
#    default inputfile  = "N5002-BD.BIN"
#    default outputfile = "N5002-BD.DEC"
#
#   Encrypts the updated firmware file (inverse it and reorder the bits)
#
# GetImage(imagenum,inputfile,offset):
#   default inputfile = "N5002-BD.DEC"
#   default offset = 0x100000-0x18        DO NOT CHANGE THIS VALUE!
#
#   Reads the $imagenum$ (a number 0-389) from the decrypted
#   firmware and saves it to a file named "imagenum.ext"
#   (where the extension comes from the file type.
#
# UpdateImage(imagenum,imagefile,inputfile,outputfile,offset=0x100000-0x18):
#   default inputfile = "N5002-BD.DEC"
#   default outputfile = "N5002-BD.DEC"
#   default offset = 0x100000-0x18        DO NOT CHANGE THIS VALUE!
#
#   Updates the $imagenum$ image to $imagefile$.
#
#   Normal usage scenario:
#   put N5002-BD.BIN in the same directory as the script file.
#   run DecryptFile()
#   run GetImage(0)   where here you can choose whatever image number you
#            want, and do that as many times as you'd like...
#            change the images, as long as their sizes don't grow.
#   run CorrectCRC()
#   run EncryptFile()
#
#       have fun.
#
#

import binascii;
import array;

dec_dic = {
    0:3,
    1:2,
    2:1,
    3:0,
    4:5,
    5:6,
    6:4,
    7:7,
    8:9,
    9:11,
    10:8,
    11:10,
    12:14,
    13:12,
    14:15,
    15:13,
    };

enc_dic = {}
for i in dec_dic:
    enc_dic[dec_dic[i]] = i;
   
image_type_dic = {
    '0x3E8L':'jpg',
    '0x3E9L':'png',
    };

def DecryptFile(inputfile="N5002-BD.BIN",outputfile="N5002-BD.DEC"):
    ModifyFile(inputfile,outputfile,dec_dic);

def EncryptFile(inputfile="N5002-BD.DEC",outputfile="N5002-BD-NEW.BIN"):
    ModifyFile(inputfile,outputfile,enc_dic);
   
def CorrectCRC(inputfile="N5002-BD.DEC",outputfile="N5002-BD.DEC"):
    print "Opening file", inputfile;
    inpfile = file(inputfile,"r+b",1000);
    filearr = array.array('L', inpfile.read()).tolist()   # make integer list       

    print "Computing the CRC..."    #Note - the real file begins at 0x18 -> +5
    CRC = reduce(lambda x,y:x+filearr[y+5],range(0,len(filearr)-5-1));
    CRC = hex(CRC)[-9:-1];
    print "The updated CRC value is:", CRC
    inpfile.seek(0,0);
    filearr = inpfile.read();
   
    inpfile.close;
    del inpfile;
   
    print "Writing CRC to the file",outputfile
   
    outfile = file(outputfile,"w+b",1000);     
   
    filearr=filearr[:-4];
    for i in map(lambda x: dec_dic.get(x)-12,range(12,16)):
        filearr = filearr+ chr(eval('0x'+CRC[2*i]+CRC[2*i+1]) ^ 0xFF);

    outfile.write(filearr);
    filearr = "";
   
    outfile.close;
    del outfile;
    print "Done."
    return CRC;

def ModifyFile(inputfile,outputfile,thedic):
    print "Opening file", inputfile;
    inpfile = file(inputfile,"r+b",1000);
    filearr = array.array('B', inpfile.read()).tolist()   # make integer list       
    tmplist = (len(filearr)/16+1)*range(0,16);

    print "Reordering the file..."
    filearr = map(lambda x:filearr[thedic[tmplist[x]]+(x/16)*16]^0xFF,range(0,len(filearr)));

    print "Making output file",outputfile
    outfile = file(outputfile,"w+b",1000);   
    filearr = map(lambda x:chr(x),filearr);
    filearr = "".join(filearr);
    outfile.write(filearr);

    outfile.close;
    inpfile.close;
     
    tmplist = "";
    print "Done."
    return filearr;


def GetImage(imagenum,inputfile="N5002-BD.DEC",offset=0x100000-0x18):
    if (imagenum > 389) or (imagenum <0> 389) or (imagenum < 0):
        print "Wrong image number (0-389)";
        return -1;
    print "Reading input image file:",imagefile;
    imgfile = file(imagefile,"r+b",1000);
    imagestr = imgfile.read();
    imgfile.close();
    print "Reading input file:",inputfile;
    inpfile = file(inputfile,"r+b",1000);
    print "Extracting image details...";
    adr_table = 0x50d84c;
    inpfile.seek(adr_table+(imagenum)*4)
    image_adr = array.array('L', inpfile.read(4)).tolist()[0];
    inpfile.seek(image_adr-offset,0);
    image_type = image_type_dic[hex(array.array('L', inpfile.read(8)).tolist()[0])];
    image_max_size = array.array('L', inpfile.read(4)).tolist()[0];
    image_adr = array.array('L', inpfile.read(4)).tolist()[0] - offset;
    print "Checking image...";
    if image_max_size < len(imagestr):
        print "max image size:",image_max_size;
        return -1;
    imagestr = imagestr + (image_max_size-len(imagestr))*'\x00';    # add 00 if needed
    inpfile.seek(0,0);
    first_part = inpfile.read(image_adr);
    inpfile.seek(image_adr+image_max_size,0);
    second_part = inpfile.read();
    final_file = first_part+imagestr+second_part;
    inpfile.close();
    print "Writing image file."
    outfile = file(outputfile,"w+b",1000);   
    outfile.write(final_file);
    outfile.close;
    print "Done."
    return image_adr;
   
[/code]


Last edited by shirour on Sun Apr 30, 2006 9:22 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 28, 2006 11:09 pm 
M:Postwhore
User avatar

Joined: Fri Jan 13, 2006 2:53 am
Posts: 143
Location: Regina, Saskatchewan Canada
Offline
I don't have the brain power to add something like this to my m:robe, can we expect a user friendly way to modify our m:robes?

_________________
"Check check, ass, ass"


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 29, 2006 1:00 am 
M:Newbie

Joined: Sat Oct 22, 2005 9:16 pm
Posts: 25
Offline
If you read the post, youd know that thats the program code that does it for you.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 29, 2006 1:25 am 
M:Postwhore
User avatar

Joined: Tue Nov 29, 2005 12:54 am
Posts: 482
Offline
yo sh if you make it liek a file that is hopfuly an exe i can put it on the server!! which is

http://tdnet.ath.cx/mrobe/

or you you can just ftp it your self or like i said i can but the password is mrobe and so is the user name

but i can do it if you email me at: BigDan32509@gmail.com

_________________
Owner of the M:robe 500i
Image


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 29, 2006 1:55 am 
M:Postwhore
User avatar

Joined: Tue Nov 29, 2005 12:54 am
Posts: 482
Offline
but yea dood i dont do python so if you could compile and send to me like i said ill put it on our serve that i posted earlyer but yea thx yea dood plz compile the py script as a .exe and email to me or just ftp the server adn put it up there

_________________
Owner of the M:robe 500i
Image


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 29, 2006 2:58 am 
M:Postwhore

Joined: Thu Oct 20, 2005 6:26 pm
Posts: 372
Location: Los Angeles, California. 500i
Offline
what am i doing wrong?

i installed pythong 2.4.3 for windows. saved the script to mrobe500script.py and placed that in the same folder as N5002-BD.BIN. ive run it both by double-clicking and on commandline. nothing happens.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 29, 2006 4:59 am 
M:VIP
User avatar

Joined: Thu Oct 20, 2005 9:10 pm
Posts: 1125
Location: Canada
Offline
The script makes little sense to me, but I like it :D , I'll try to put it into action later... By the way if you need to host something, I can help you out with that, just email me the zipped files and I would PM you with the direct link. No problems at all, especially when it's for such a good cause.

_________________
(MR-500i)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 29, 2006 3:16 pm 
M:Veteran

Joined: Sat Dec 17, 2005 8:22 pm
Posts: 94
Offline
OK - i've made an exe file... now everyone
can change the firmware easily. take a look:

http://mrobe.fan.googlepages.com/

Image


Last edited by shirour on Sat Apr 29, 2006 7:30 pm, edited 2 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 29, 2006 3:19 pm 
M:Postwhore
User avatar

Joined: Sun Oct 30, 2005 3:29 pm
Posts: 659
Offline
this is cool. it better make front page news. there hasnt been an update in over 2 months. :cry:

_________________
[PRESENT] Owner Of Apple iPod Touch 16GB since:
April 20, 2008, ~12:00 PM (Mountain Standard Time)
[PAST] Owner Of Olympus m:robe MR-100 5GB since:
March 28, 2005, 10:30.53 AM (Australian Eastern Standard Time)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 29, 2006 4:49 pm 
M:Postwhore

Joined: Thu Oct 20, 2005 6:26 pm
Posts: 372
Location: Los Angeles, California. 500i
Offline
the exe works great though i havnt tried updating the firmware on my 500i.

good work


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 29, 2006 5:12 pm 
M:oderator
User avatar

Joined: Sun Sep 11, 2005 4:46 pm
Posts: 2197
Location: Montreal, Canada
Offline
Stickied. I'll PM Howie about putting it on the front page.

_________________
Proud owner of m:robe MR-100 since August 21st, 2005.


Top
 Profile  
 
 Post subject: Well done shirour!
PostPosted: Sat Apr 29, 2006 6:08 pm 
M:oderator
User avatar

Joined: Sat Feb 18, 2006 12:45 am
Posts: 5955
Location: oxford, U.K.
Offline
Don't have a 500i, yet...but well done shirour. Like many others, marvelling at how you guys do this sort of thing. I guess some of you do this sort of thing for a living. I know I'll be tempted to use your script/exe if and when I get the 500. Scary, as in bricking the robe if I do something wrong, but irresistible still. Glad you put 'Do It At Your Own Risk' in your guide.

Applause to you.

jamelikat

_________________
.
Image


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 30, 2006 5:48 am 
M:Postwhore
User avatar

Joined: Fri Oct 14, 2005 11:01 pm
Posts: 214
Location: Chicago
Offline
I followed the guide about 4-5 times doing something different each time but I still can't get it to decrypt. Any way you can make the guide any clearer or am i just plain ignorant and am not seeing something?

BTW Thank so incredibly much! What a great job you've done!


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 30, 2006 6:03 am 
M:oderator
User avatar

Joined: Sun Sep 11, 2005 4:46 pm
Posts: 2197
Location: Montreal, Canada
Offline
Howie's put the guide up on the front page.

_________________
Proud owner of m:robe MR-100 since August 21st, 2005.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 30, 2006 6:34 am 
M:Postwhore
User avatar

Joined: Sat Oct 15, 2005 7:33 am
Posts: 154
Location: Melbourne
Offline
I want a 500 and I want it NOW!

(good work mate)


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 162 posts ]  Go to page 1, 2, 3, 4, 5 ... 11  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 0 guests



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 post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group