[android-developers] Re: Modifying an String of Android Resource File (*.arsc)

2013-07-25 Thread giles ian
please find below link for understanding the entire structure binary xml 
ans .arsc

http://justanapplication.wordpress.com/android-internals/

My question is don't we have to move the bytes when we replace the string 
with bigger one, apart from changing the values you mentioned below



On Tuesday, June 21, 2011 8:09:12 PM UTC-7, Illyoung Choi wrote:
>
> Hi All. 
>
> Last day, I made a simple application for parsing an Android Resource 
> File (*.arsc) and modifying resource strings. 
>
> I think this thing might be a help for someone, so I'll share the 
> structure of *.arsc that I understood. 
>
> Since I could not spend many hours for this, my understanding is not 
> perfect and might be slightly wrong. 
>
>
> I patched string resource from *.apk. 
> Simply extracted *.apk with 7zip and got the resources.arsc file. 
>
> Below are the structure of *.arsc 
>
> struct ANDROID_RESOURCE_HEADER 
> { 
> int signature; // 0x000c0002, I assume this is a signature 
> int nImageLength; // total ARSC file size (bytes) 
> int nUnknown1[2]; // still unknown (not important for modifying 
> strings) 
> int nStringBlockLength; // total StringBlock(see below) size 
> int nStringCount; // total number of String Resources 
> int nUnknown2[4]; // still unknown  (not important for modifying 
> strings) 
> } 
>
> "struct ANDROID_RESOURCE_HEADER" is a header of ARSC file image. 
> So simply you can read this header information from file. 
>
> After this header, you will meet the StringBlock 
>
> StringBlock has 2Sections 
> { 
> [String Offset] 
> [String Data] 
> } 
>
> String Offset Section has Offset Values of Specific Strings from 
> StringBlock Start Address. 
>
> String Data Section has 2 Part 
>
> String Data 
> { 
> [Length] 
> [String] 
> } 
>
> Length part is 2byte. but, in AscII Mode, uses only 1byte. 
> Before reading String, you must check whether it is "Unicode" or 
> "AscII" format. 
>
> in Unicode format, Length part will be used with 2bytes. 
> normally it is "0x??, 0x00" (only if it is not longer than 256 bytes) 
>
> in AscII format, Length part will be used with 1bytes. but, they also 
> used second byte for mirroring. 
> if string length has a value 7, you will meet "0x07, 0x07" 
>
> So, I checked whether both bytes have same value to check string 
> format. 
>
>
> Lastly, actual string data will be after this length part with "Zero 
> Terminal" 
> in Unicode format, surely, Zero Terminal will be 2 byte of zero. 
>
>
>
> Whenever you change the string of this ARSC file, you should 
> recalculate these. 
> Length Part of String Data 
> String Offset of StringBlock 
> nImageLength of Header 
> nStringBlockLength of Header 
>
>
> After doing these all. 
> Simply, remove all JAR Signature (META-INF folder) from package. 
> Re-Archive with Zip and rename with *.apk. 
> Resign with your certificate by using "jarsigner" of JDK 
>
>
>
> Thanks.

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Re: Modifying an String of Android Resource File (*.arsc)

2013-07-11 Thread Yaron Reinharts

As far as I know the apktool can be ported but I haven't tried it myself.
Let us know :)
/Yaron
On 07/11/2013 08:30 PM, giles ian wrote:
Thanks Yaron, but my requirement is parsing and modifying arsc file at 
runtime on the device.


So my next question is can apktool be ported on device. What I mean is 
since the source code is available are there any lib/frameworks (that 
apktool) which are only available for desktop and not for android.



On Thu, Jul 11, 2013 at 8:13 AM, Yaron Reinharts 
mailto:yaron.reinha...@gmail.com>> wrote:


No need to reinvent the wheel:
https://code.google.com/p/android-apktool/

Hope this helps
Yaron

On 07/11/2013 02:13 AM, giles ian wrote:

Hi Illyoung Choi,
*
*
*Is it possible for you to share the code for the entire thing.
i.e. *
*
*
*1.Parsing*
*2. Modifying
*
On Tuesday, June 21, 2011 8:09:12 PM UTC-7, Illyoung Choi wrote:

Hi All.

Last day, I made a simple application for parsing an Android
Resource
File (*.arsc) and modifying resource strings.

I think this thing might be a help for someone, so I'll share
the
structure of *.arsc that I understood.

Since I could not spend many hours for this, my understanding
is not
perfect and might be slightly wrong.


I patched string resource from *.apk.
Simply extracted *.apk with 7zip and got the resources.arsc
file.

Below are the structure of *.arsc

struct ANDROID_RESOURCE_HEADER
{
int signature; // 0x000c0002, I assume this is a signature
int nImageLength; // total ARSC file size (bytes)
int nUnknown1[2]; // still unknown (not important for modifying
strings)
int nStringBlockLength; // total StringBlock(see below) size
int nStringCount; // total number of String Resources
int nUnknown2[4]; // still unknown  (not important for modifying
strings)
}

"struct ANDROID_RESOURCE_HEADER" is a header of ARSC file image.
So simply you can read this header information from file.

After this header, you will meet the StringBlock

StringBlock has 2Sections
{
[String Offset]
[String Data]
}

String Offset Section has Offset Values of Specific Strings from
StringBlock Start Address.

String Data Section has 2 Part

String Data
{
[Length]
[String]
}

Length part is 2byte. but, in AscII Mode, uses only 1byte.
Before reading String, you must check whether it is "Unicode" or
"AscII" format.

in Unicode format, Length part will be used with 2bytes.
normally it is "0x??, 0x00" (only if it is not longer than
256 bytes)

in AscII format, Length part will be used with 1bytes. but,
they also
used second byte for mirroring.
if string length has a value 7, you will meet "0x07, 0x07"

So, I checked whether both bytes have same value to check string
format.


Lastly, actual string data will be after this length part
with "Zero
Terminal"
in Unicode format, surely, Zero Terminal will be 2 byte of zero.



Whenever you change the string of this ARSC file, you should
recalculate these.
Length Part of String Data
String Offset of StringBlock
nImageLength of Header
nStringBlockLength of Header


After doing these all.
Simply, remove all JAR Signature (META-INF folder) from package.
Re-Archive with Zip and rename with *.apk.
Resign with your certificate by using "jarsigner" of JDK



Thanks.

-- 
-- 
You received this message because you are subscribed to the Google

Groups "Android Developers" group.
To post to this group, send email to
android-developers@googlegroups.com

To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com

For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the
Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to android-developers+unsubscr...@googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.





-- 
Yaron Reinharts

Smart Drive Applications
http://www.poncho.co.il/gateaway.php
https://market.android.com/details?id=com.poncho.gsm.gate.activities


-- 
-- 
You received this message because you are subscribed to the Google

Groups "And

Re: [android-developers] Re: Modifying an String of Android Resource File (*.arsc)

2013-07-11 Thread giles ian
Thanks Yaron, but my requirement is parsing and modifying arsc file at
runtime on the device.

So my next question is can apktool be ported on device. What I mean is
since the source code is available are there any lib/frameworks (that
apktool) which are only available for desktop and not for android.


On Thu, Jul 11, 2013 at 8:13 AM, Yaron Reinharts
wrote:

>  No need to reinvent the wheel:
> https://code.google.com/p/android-apktool/
>
> Hope this helps
> Yaron
>
> On 07/11/2013 02:13 AM, giles ian wrote:
>
> Hi Illyoung Choi,
> *
> *
> *Is it possible for you to share the code for the entire thing. i.e. *
> *
> *
> *1.Parsing*
> *2. Modifying
> *
> On Tuesday, June 21, 2011 8:09:12 PM UTC-7, Illyoung Choi wrote:
>>
>> Hi All.
>>
>> Last day, I made a simple application for parsing an Android Resource
>> File (*.arsc) and modifying resource strings.
>>
>> I think this thing might be a help for someone, so I'll share the
>> structure of *.arsc that I understood.
>>
>> Since I could not spend many hours for this, my understanding is not
>> perfect and might be slightly wrong.
>>
>>
>> I patched string resource from *.apk.
>> Simply extracted *.apk with 7zip and got the resources.arsc file.
>>
>> Below are the structure of *.arsc
>>
>> struct ANDROID_RESOURCE_HEADER
>> {
>> int signature; // 0x000c0002, I assume this is a signature
>> int nImageLength; // total ARSC file size (bytes)
>> int nUnknown1[2]; // still unknown (not important for modifying
>> strings)
>> int nStringBlockLength; // total StringBlock(see below) size
>> int nStringCount; // total number of String Resources
>> int nUnknown2[4]; // still unknown  (not important for modifying
>> strings)
>> }
>>
>> "struct ANDROID_RESOURCE_HEADER" is a header of ARSC file image.
>> So simply you can read this header information from file.
>>
>> After this header, you will meet the StringBlock
>>
>> StringBlock has 2Sections
>> {
>> [String Offset]
>> [String Data]
>> }
>>
>> String Offset Section has Offset Values of Specific Strings from
>> StringBlock Start Address.
>>
>> String Data Section has 2 Part
>>
>> String Data
>> {
>> [Length]
>> [String]
>> }
>>
>> Length part is 2byte. but, in AscII Mode, uses only 1byte.
>> Before reading String, you must check whether it is "Unicode" or
>> "AscII" format.
>>
>> in Unicode format, Length part will be used with 2bytes.
>> normally it is "0x??, 0x00" (only if it is not longer than 256 bytes)
>>
>> in AscII format, Length part will be used with 1bytes. but, they also
>> used second byte for mirroring.
>> if string length has a value 7, you will meet "0x07, 0x07"
>>
>> So, I checked whether both bytes have same value to check string
>> format.
>>
>>
>> Lastly, actual string data will be after this length part with "Zero
>> Terminal"
>> in Unicode format, surely, Zero Terminal will be 2 byte of zero.
>>
>>
>>
>> Whenever you change the string of this ARSC file, you should
>> recalculate these.
>> Length Part of String Data
>> String Offset of StringBlock
>> nImageLength of Header
>> nStringBlockLength of Header
>>
>>
>> After doing these all.
>> Simply, remove all JAR Signature (META-INF folder) from package.
>> Re-Archive with Zip and rename with *.apk.
>> Resign with your certificate by using "jarsigner" of JDK
>>
>>
>>
>> Thanks.
>
>  --
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Android Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to android-developers+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>
>
> --
> Yaron Reinharts
> Smart Drive 
> Applicationshttp://www.poncho.co.il/gateaway.phphttps://market.android.com/details?id=com.poncho.gsm.gate.activities
>
>   --
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Android Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to android-developers+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to t

Re: [android-developers] Re: Modifying an String of Android Resource File (*.arsc)

2013-07-11 Thread Yaron Reinharts

No need to reinvent the wheel:
https://code.google.com/p/android-apktool/

Hope this helps
Yaron
On 07/11/2013 02:13 AM, giles ian wrote:

Hi Illyoung Choi,
*
*
*Is it possible for you to share the code for the entire thing. i.e. *
*
*
*1.Parsing*
*2. Modifying
*
On Tuesday, June 21, 2011 8:09:12 PM UTC-7, Illyoung Choi wrote:

Hi All.

Last day, I made a simple application for parsing an Android Resource
File (*.arsc) and modifying resource strings.

I think this thing might be a help for someone, so I'll share the
structure of *.arsc that I understood.

Since I could not spend many hours for this, my understanding is not
perfect and might be slightly wrong.


I patched string resource from *.apk.
Simply extracted *.apk with 7zip and got the resources.arsc file.

Below are the structure of *.arsc

struct ANDROID_RESOURCE_HEADER
{
int signature; // 0x000c0002, I assume this is a signature
int nImageLength; // total ARSC file size (bytes)
int nUnknown1[2]; // still unknown (not important for modifying
strings)
int nStringBlockLength; // total StringBlock(see below) size
int nStringCount; // total number of String Resources
int nUnknown2[4]; // still unknown  (not important for modifying
strings)
}

"struct ANDROID_RESOURCE_HEADER" is a header of ARSC file image.
So simply you can read this header information from file.

After this header, you will meet the StringBlock

StringBlock has 2Sections
{
[String Offset]
[String Data]
}

String Offset Section has Offset Values of Specific Strings from
StringBlock Start Address.

String Data Section has 2 Part

String Data
{
[Length]
[String]
}

Length part is 2byte. but, in AscII Mode, uses only 1byte.
Before reading String, you must check whether it is "Unicode" or
"AscII" format.

in Unicode format, Length part will be used with 2bytes.
normally it is "0x??, 0x00" (only if it is not longer than 256 bytes)

in AscII format, Length part will be used with 1bytes. but, they also
used second byte for mirroring.
if string length has a value 7, you will meet "0x07, 0x07"

So, I checked whether both bytes have same value to check string
format.


Lastly, actual string data will be after this length part with "Zero
Terminal"
in Unicode format, surely, Zero Terminal will be 2 byte of zero.



Whenever you change the string of this ARSC file, you should
recalculate these.
Length Part of String Data
String Offset of StringBlock
nImageLength of Header
nStringBlockLength of Header


After doing these all.
Simply, remove all JAR Signature (META-INF folder) from package.
Re-Archive with Zip and rename with *.apk.
Resign with your certificate by using "jarsigner" of JDK



Thanks.

--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google 
Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to android-developers+unsubscr...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.





--
Yaron Reinharts
Smart Drive Applications
http://www.poncho.co.il/gateaway.php
https://market.android.com/details?id=com.poncho.gsm.gate.activities


--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups "Android Developers" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[android-developers] Re: Modifying an String of Android Resource File (*.arsc)

2013-07-10 Thread giles ian
Hi Illyoung Choi,
*
*
*Is it possible for you to share the code for the entire thing. i.e. *
*
*
*1.Parsing*
*2. Modifying
*
On Tuesday, June 21, 2011 8:09:12 PM UTC-7, Illyoung Choi wrote:
>
> Hi All. 
>
> Last day, I made a simple application for parsing an Android Resource 
> File (*.arsc) and modifying resource strings. 
>
> I think this thing might be a help for someone, so I'll share the 
> structure of *.arsc that I understood. 
>
> Since I could not spend many hours for this, my understanding is not 
> perfect and might be slightly wrong. 
>
>
> I patched string resource from *.apk. 
> Simply extracted *.apk with 7zip and got the resources.arsc file. 
>
> Below are the structure of *.arsc 
>
> struct ANDROID_RESOURCE_HEADER 
> { 
> int signature; // 0x000c0002, I assume this is a signature 
> int nImageLength; // total ARSC file size (bytes) 
> int nUnknown1[2]; // still unknown (not important for modifying 
> strings) 
> int nStringBlockLength; // total StringBlock(see below) size 
> int nStringCount; // total number of String Resources 
> int nUnknown2[4]; // still unknown  (not important for modifying 
> strings) 
> } 
>
> "struct ANDROID_RESOURCE_HEADER" is a header of ARSC file image. 
> So simply you can read this header information from file. 
>
> After this header, you will meet the StringBlock 
>
> StringBlock has 2Sections 
> { 
> [String Offset] 
> [String Data] 
> } 
>
> String Offset Section has Offset Values of Specific Strings from 
> StringBlock Start Address. 
>
> String Data Section has 2 Part 
>
> String Data 
> { 
> [Length] 
> [String] 
> } 
>
> Length part is 2byte. but, in AscII Mode, uses only 1byte. 
> Before reading String, you must check whether it is "Unicode" or 
> "AscII" format. 
>
> in Unicode format, Length part will be used with 2bytes. 
> normally it is "0x??, 0x00" (only if it is not longer than 256 bytes) 
>
> in AscII format, Length part will be used with 1bytes. but, they also 
> used second byte for mirroring. 
> if string length has a value 7, you will meet "0x07, 0x07" 
>
> So, I checked whether both bytes have same value to check string 
> format. 
>
>
> Lastly, actual string data will be after this length part with "Zero 
> Terminal" 
> in Unicode format, surely, Zero Terminal will be 2 byte of zero. 
>
>
>
> Whenever you change the string of this ARSC file, you should 
> recalculate these. 
> Length Part of String Data 
> String Offset of StringBlock 
> nImageLength of Header 
> nStringBlockLength of Header 
>
>
> After doing these all. 
> Simply, remove all JAR Signature (META-INF folder) from package. 
> Re-Archive with Zip and rename with *.apk. 
> Resign with your certificate by using "jarsigner" of JDK 
>
>
>
> Thanks.

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[android-developers] Re: Modifying an String of Android Resource File (*.arsc)

2013-07-10 Thread giles ian
Thanks Illyoung Choi for sharing your findings, great help... and dont 
bother narrow minded people like Zsolt Vasvari

On Tuesday, June 21, 2011 8:09:12 PM UTC-7, Illyoung Choi wrote:
>
> Hi All. 
>
> Last day, I made a simple application for parsing an Android Resource 
> File (*.arsc) and modifying resource strings. 
>
> I think this thing might be a help for someone, so I'll share the 
> structure of *.arsc that I understood. 
>
> Since I could not spend many hours for this, my understanding is not 
> perfect and might be slightly wrong. 
>
>
> I patched string resource from *.apk. 
> Simply extracted *.apk with 7zip and got the resources.arsc file. 
>
> Below are the structure of *.arsc 
>
> struct ANDROID_RESOURCE_HEADER 
> { 
> int signature; // 0x000c0002, I assume this is a signature 
> int nImageLength; // total ARSC file size (bytes) 
> int nUnknown1[2]; // still unknown (not important for modifying 
> strings) 
> int nStringBlockLength; // total StringBlock(see below) size 
> int nStringCount; // total number of String Resources 
> int nUnknown2[4]; // still unknown  (not important for modifying 
> strings) 
> } 
>
> "struct ANDROID_RESOURCE_HEADER" is a header of ARSC file image. 
> So simply you can read this header information from file. 
>
> After this header, you will meet the StringBlock 
>
> StringBlock has 2Sections 
> { 
> [String Offset] 
> [String Data] 
> } 
>
> String Offset Section has Offset Values of Specific Strings from 
> StringBlock Start Address. 
>
> String Data Section has 2 Part 
>
> String Data 
> { 
> [Length] 
> [String] 
> } 
>
> Length part is 2byte. but, in AscII Mode, uses only 1byte. 
> Before reading String, you must check whether it is "Unicode" or 
> "AscII" format. 
>
> in Unicode format, Length part will be used with 2bytes. 
> normally it is "0x??, 0x00" (only if it is not longer than 256 bytes) 
>
> in AscII format, Length part will be used with 1bytes. but, they also 
> used second byte for mirroring. 
> if string length has a value 7, you will meet "0x07, 0x07" 
>
> So, I checked whether both bytes have same value to check string 
> format. 
>
>
> Lastly, actual string data will be after this length part with "Zero 
> Terminal" 
> in Unicode format, surely, Zero Terminal will be 2 byte of zero. 
>
>
>
> Whenever you change the string of this ARSC file, you should 
> recalculate these. 
> Length Part of String Data 
> String Offset of StringBlock 
> nImageLength of Header 
> nStringBlockLength of Header 
>
>
> After doing these all. 
> Simply, remove all JAR Signature (META-INF folder) from package. 
> Re-Archive with Zip and rename with *.apk. 
> Resign with your certificate by using "jarsigner" of JDK 
>
>
>
> Thanks.

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Re: Modifying an String of Android Resource File (*.arsc)

2011-06-21 Thread Nikolay Elenkov
On Wed, Jun 22, 2011 at 1:35 PM, Illyoung Choi  wrote:
> Normally, bad purpose and good purpose share same technology.
>
> It is up to your choice.
>

Of course. The Internet can be used for all sorts of nasty
stuff, that doesn't mean we should 'delete' it. In any case,
you might want to look at APK tool, it does resource reversing
pretty well.

http://code.google.com/p/android-apktool/

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Modifying an String of Android Resource File (*.arsc)

2011-06-21 Thread Illyoung Choi
Normally, bad purpose and good purpose share same technology.

It is up to your choice.



On Jun 22, 12:17 pm, Zsolt Vasvari  wrote:
> What exactly would the use for this be, besides piracy?
>
> I suggest this post for deletion.
>
> On Jun 22, 11:09 am, Illyoung Choi  wrote:
>
>
>
> > Hi All.
>
> > Last day, I made a simple application for parsing an Android Resource
> > File (*.arsc) and modifying resource strings.
>
> > I think this thing might be a help for someone, so I'll share the
> > structure of *.arsc that I understood.
>
> > Since I could not spend many hours for this, my understanding is not
> > perfect and might be slightly wrong.
>
> > I patched string resource from *.apk.
> > Simply extracted *.apk with 7zip and got the resources.arsc file.
>
> > Below are the structure of *.arsc
>
> > struct ANDROID_RESOURCE_HEADER
> > {
> > int signature; // 0x000c0002, I assume this is a signature
> > int nImageLength; // total ARSC file size (bytes)
> > int nUnknown1[2]; // still unknown (not important for modifying
> > strings)
> > int nStringBlockLength; // total StringBlock(see below) size
> > int nStringCount; // total number of String Resources
> > int nUnknown2[4]; // still unknown  (not important for modifying
> > strings)
>
> > }
>
> > "struct ANDROID_RESOURCE_HEADER" is a header of ARSC file image.
> > So simply you can read this header information from file.
>
> > After this header, you will meet the StringBlock
>
> > StringBlock has 2Sections
> > {
> > [String Offset]
> > [String Data]
>
> > }
>
> > String Offset Section has Offset Values of Specific Strings from
> > StringBlock Start Address.
>
> > String Data Section has 2 Part
>
> > String Data
> > {
> > [Length]
> > [String]
>
> > }
>
> > Length part is 2byte. but, in AscII Mode, uses only 1byte.
> > Before reading String, you must check whether it is "Unicode" or
> > "AscII" format.
>
> > in Unicode format, Length part will be used with 2bytes.
> > normally it is "0x??, 0x00" (only if it is not longer than 256 bytes)
>
> > in AscII format, Length part will be used with 1bytes. but, they also
> > used second byte for mirroring.
> > if string length has a value 7, you will meet "0x07, 0x07"
>
> > So, I checked whether both bytes have same value to check string
> > format.
>
> > Lastly, actual string data will be after this length part with "Zero
> > Terminal"
> > in Unicode format, surely, Zero Terminal will be 2 byte of zero.
>
> > Whenever you change the string of this ARSC file, you should
> > recalculate these.
> > Length Part of String Data
> > String Offset of StringBlock
> > nImageLength of Header
> > nStringBlockLength of Header
>
> > After doing these all.
> > Simply, remove all JAR Signature (META-INF folder) from package.
> > Re-Archive with Zip and rename with *.apk.
> > Resign with your certificate by using "jarsigner" of JDK
>
> > Thanks.- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Modifying an String of Android Resource File (*.arsc)

2011-06-21 Thread Zsolt Vasvari
What exactly would the use for this be, besides piracy?

I suggest this post for deletion.

On Jun 22, 11:09 am, Illyoung Choi  wrote:
> Hi All.
>
> Last day, I made a simple application for parsing an Android Resource
> File (*.arsc) and modifying resource strings.
>
> I think this thing might be a help for someone, so I'll share the
> structure of *.arsc that I understood.
>
> Since I could not spend many hours for this, my understanding is not
> perfect and might be slightly wrong.
>
> I patched string resource from *.apk.
> Simply extracted *.apk with 7zip and got the resources.arsc file.
>
> Below are the structure of *.arsc
>
> struct ANDROID_RESOURCE_HEADER
> {
> int signature; // 0x000c0002, I assume this is a signature
> int nImageLength; // total ARSC file size (bytes)
> int nUnknown1[2]; // still unknown (not important for modifying
> strings)
> int nStringBlockLength; // total StringBlock(see below) size
> int nStringCount; // total number of String Resources
> int nUnknown2[4]; // still unknown  (not important for modifying
> strings)
>
> }
>
> "struct ANDROID_RESOURCE_HEADER" is a header of ARSC file image.
> So simply you can read this header information from file.
>
> After this header, you will meet the StringBlock
>
> StringBlock has 2Sections
> {
> [String Offset]
> [String Data]
>
> }
>
> String Offset Section has Offset Values of Specific Strings from
> StringBlock Start Address.
>
> String Data Section has 2 Part
>
> String Data
> {
> [Length]
> [String]
>
> }
>
> Length part is 2byte. but, in AscII Mode, uses only 1byte.
> Before reading String, you must check whether it is "Unicode" or
> "AscII" format.
>
> in Unicode format, Length part will be used with 2bytes.
> normally it is "0x??, 0x00" (only if it is not longer than 256 bytes)
>
> in AscII format, Length part will be used with 1bytes. but, they also
> used second byte for mirroring.
> if string length has a value 7, you will meet "0x07, 0x07"
>
> So, I checked whether both bytes have same value to check string
> format.
>
> Lastly, actual string data will be after this length part with "Zero
> Terminal"
> in Unicode format, surely, Zero Terminal will be 2 byte of zero.
>
> Whenever you change the string of this ARSC file, you should
> recalculate these.
> Length Part of String Data
> String Offset of StringBlock
> nImageLength of Header
> nStringBlockLength of Header
>
> After doing these all.
> Simply, remove all JAR Signature (META-INF folder) from package.
> Re-Archive with Zip and rename with *.apk.
> Resign with your certificate by using "jarsigner" of JDK
>
> Thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en