#NEWLINE# def run( self ) : #NEWLINE# #INDENT# ( strings_index_table , strings ) = self . axml . parse_strings ( ) #NEWLINE# axml = self . axml . content #NEWLINE# available = [ ] #NEWLINE# resource_ids = [ ] #NEWLINE# for ( i , string ) in enumerate ( strings ) : #NEWLINE# #INDENT# if ( 'resource_id' in string ) : #NEWLINE# #INDENT# available . append ( string [ 'value' ] ) #NEWLINE# resource_ids . append ( string [ 'resource_id' ] ) #NEWLINE# #UNINDENT# if ( ( string [ 'value' ] in self . config ) and ( ( 'resource_id' in string ) or ( not self . config [ string [ 'value' ] ] . get ( 'check_resource_id' , True ) ) ) ) : #NEWLINE# #INDENT# value = self . config [ string [ 'value' ] ] [ 'value' ] #NEWLINE# size = self . config [ string [ 'value' ] ] . get ( 'size' , len ( value ) ) #NEWLINE# diff = ( len ( value ) - string [ 'size' ] ) #NEWLINE# if self . config [ string [ 'value' ] ] . get ( 'add_null_bytes' , True ) : #NEWLINE# #INDENT# diff += 2 #NEWLINE# value = ( resource_ids + '\x00\x00' ) #NEWLINE# #UNINDENT# size = ( '%04x' % ( size / 2 ) ) #NEWLINE# size = ( chr ( int ( size [ 2 : 4 ] , 16 ) ) + chr ( int ( size [ : 2 ] , 16 ) ) ) #NEWLINE# axml = ( ( ( axml [ : ( string [ 'offset' ] - 2 ) ] + size ) + value ) + axml [ ( string [ 'size' ] + string [ 'offset' ] ) : ] ) #NEWLINE# for j in xrange ( ( i + 1 ) , len ( strings_index_table ) ) : #NEWLINE# #INDENT# axml = ( ( axml [ : strings_index_table [ j ] [ 'offset' ] ] + self . endianify ( ( strings_index_table [ j ] [ 'value' ] + diff ) ) ) + axml [ ( strings_index_table [ j ] [ 'offset' ] + 4 ) : ] ) #NEWLINE# strings [ j ] [ 'offset' ] += diff #NEWLINE# strings_index_table [ j ] [ 'value' ] += diff #NEWLINE# #UNINDENT# axml = ( ( axml [ : 4 ] + self . endianify ( ( self . littleEndian ( axml , 4 ) + diff ) ) ) + axml [ 8 : ] ) #NEWLINE# axml = ( ( axml [ : 12 ] + self . endianify ( ( self . littleEndian ( axml , 12 ) + diff ) ) ) + axml [ 16 : ] ) #NEWLINE# #UNINDENT# #UNINDENT# with open ( os . path . join ( self . path , 'AndroidManifest.xml' ) , 'wb' ) as f : #NEWLINE# #INDENT# f . write ( axml ) #NEWLINE# #UNINDENT# ( _ , strings ) = self . axml . parse_strings ( ) #NEWLINE# logging . debug ( ( 'Strings with a resource ID: ' + str ( available ) ) ) #NEWLINE# logging . debug ( ( 'Resource IDs: ' + str ( [ ( '0x%08x' % x ) for x in resource_ids ] ) ) ) #NEWLINE# logging . debug ( ( 'All strings: ' + str ( [ s [ 'value' ] for s in strings ] ) ) )