Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request for automated remapping of resource id in smali files. #244

Closed
iBotPeaches opened this issue Mar 18, 2015 · 4 comments
Closed

Comments

@iBotPeaches
Copy link
Owner

Original issue 133 created by AdamRosas1972 on 2011-02-06T04:30:35.000Z:

so the problem I'm trying to solve with this is to replace the apps
that come with proprietary ROM's with apps from the SDK or other OEM's
what have you. usually all the resources are in framework-res.apk
just the id's have changed and I find myself with 3 instances of
notepad++ remapping the resource id's to the target ROM by copy and
pasting id's in one search box too get the resource name then pasting
the resource name into another search box the get the resource id on
the target ROM to then finely paste that id back into the smail file

so today I prototyped some code to remap the resource id's and thought
that it would make a great addition to apktool. how it works is you
pass it the source public.xml the target public.xml and the smali file
you wish to "port" to the target device and it does all the work and
writes out the file with the remapped resource id's.

I have attached the java source for your consideration.

@iBotPeaches
Copy link
Owner Author

Comment #1 originally posted by AdamRosas1972 on 2011-02-06T05:32:11.000Z:

<empty>

@iBotPeaches
Copy link
Owner Author

Comment #2 originally posted by Brut.alll on 2011-05-03T16:04:30.000Z:

Hmm... interesting. Thanks :-)

I have some ideas that requires me to remap resIds, but smali files are the worst - I'm afraid simple pattern matching isn't reliable enough. First, you may remap normal literal by accident. Second, you may miss some true resIds. Actually, I can already say you that you miss some of them for sure, because literals ending with 0x0000 are set using const/high16, not const. And every apk has at least few of such resources. Worst thing is: you will never know that modified apk is screwed up, it will run and look normally, but some of its functionalities may fail or work differently.

Ahh and you should group resources by type-name pair, not just name. There may be @string/foo, @integer/foo, @bool/foo, @id/foo, etc. - each one with different resId.

@iBotPeaches
Copy link
Owner Author

Comment #3 originally posted by AdamRosas1972 on 2011-05-04T05:40:12.000Z:

I have done a little more work on this since I made the feature request,
and have added alerting the user if a possible short resource id is encountered
and support for resource arrays, the new version also adds a comment to the modified
line for later review if a problem is encountered, good point about the value/type
issue and I have attached an updated version that takes data type in to account.

iBotPeaches added a commit that referenced this issue Apr 6, 2018
 - refs: #244
 - Regular expressions are not the way to fix this. Too many situations
 in smali where patterns won't work. Correct fix would be to hook dexlib
iBotPeaches added a commit that referenced this issue Apr 6, 2018
@iBotPeaches
Copy link
Owner Author

The ROADMAP.md file will serve as entry point for this. This ticket will remain closed, but suitable for discussions on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant