android - Is it possible to replace a string (zipped) code from apk dalvik -


i replace single string hex/dalvik apk code. realize entail finding how string gets encoded when converted android class project signed apk file.

is possible? well, know in code, anythings possible.. here know how it? have learned it's possible delete , add .apk files on windows platform simple zip archive (such replacing icons systemui.apk), without breaking apk.. how 1 programmatically? in python?

does have ideas on how this?

i have tried:

import zipfile zf=zipfile.zipfile('apk.apk') # zip file filename in ['classes.dex']: # zipped file content file  data=zf.read(filename) data=data.replace('mystring','newstring') #replace string within content file file=open('classes.dex','wb') file.write(data) # write new content file local disk file.close() zin=zipfile.zipfile('apk.apk','r')       # create zip in , zip out zout=zipfile.zipfile('apk.apk','w')      # iterate through zipped contents , item in zin.infolist():              # copy except 'classes.dex' content file   buffer=zin.read(item.filename)   if (item.filename!='classes.dex'):     zout.writestr(item,buffer) zout.close() zin.close() zf=zipfile.zipfile('apk.apk',mode='a')   # finally, add new content file local disk zf.write('classes.dex',arcname='classes.dex') zf.close() 

this takes original apk.apk file, , rewrites string within 1 of zipped content files, repacking apk.apk. problem is: original apk.apk = 170 kb new apk.apk = 399 kb , not installable, apk "broken", , android system won't install apk.

you can't add string higher bytes original.. have replace string of particular size same size of string. try lucky patcher. replaces string in android only.. no need bring pc. :-)


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -