[Q] How p6810 battery notification bar display text - Galaxy Tab 7.7 Q&A, Help & Troubleshooting

I decompile SystemUI.apk, modify the tw_status_bar_notification_area.xml, if you add <TextView the android: textSize = the "18.0dip" android: textColor = "# ffffffff" the android: gravity = "center_vertical" android: id = "_AT_ id / battery_text android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: text = "@ string / status_bar_settings_settings_button" android: singleLine = "true" android: includeFontPadding = "false" android: layout_toLeftOf = "@ id / systemnoti" android: layout_alignBaseline = "@ id / signal_cluster" />, notification bar only shows "set", rather than a percentage of the electricity. Should also modify the dex file? However, decompile the smail file I do not understand. Who can tell me to modify which files I slowly study. Or there are other ways?

Too techi
Screen shots and can you please upload the updated systemUI.apk so i can just replace in my tab

Related

how to read data from file???

hi,
i want to get data from a specified directory. how to write it???
PS: i use win32
Which File?
Use an opendialogbox to select it first, then ReadFile() to get the data.
Code:
// Variables required
OPENFILENAME ofn; // File dialog box structure
HANDLE hFile; // File Load/Save handle
TCHAR szFile[MAX_PATH] = TEXT("\0");
// Respond to your 'Open' menu item
case ID_MENU_OPEN: // Depends on the value the Menu creator has given it, or what you have changed it to.
memset(&(ofn), 0, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hWnd;
ofn.lpstrFile = szFile;
ofn.nMaxFileTitle = MAX_PATH;
ofn.nMaxFile = MAX_PATH;
ofn.lpstrFilter = TEXT("Text Files\0*.TXT\0"); // Set filter here if required
ofn.lpstrTitle = TEXT("Open File");
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST;
if (GetOpenFileName(&ofn))
{
hFile=CreateFile(szFile,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,0,NULL);
if(hFile == INVALID_HANDLE_VALUE)
{
//Error!!!! Do something
}
else
{
// Use function ReadFile() here using file handle hFile to read your data.
// What you do here depends on the file structure.
// If it is binary data read a block/record at a time into a buffer/structure,
// If it is CR/LF delimited text read it a byte at a time and transfer it into another text buffer. Parse for the CR/LF end of line then do whatever with it.
CloseHandle(hFile);
}
Saving is the same as the above but instead use
Code:
ofn.Flags = OFN_EXPLORER | OFN_OVERWRITEPROMPT;
hFile=CreateFile(szFile,GENERIC_WRITE,FILE_SHARE_WRITE,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
and WriteFile() to save the data.

[EASY][GUIDE]Aroma Installer for any Rom, any Device[TUTORIAL][ONE CLICK]

This can also be found here .
The guide above was also made by me.
Hi guys,
Follow instructions to have Aroma Installer on your Rom.
Topics covered
1.1 How To Add
1.2. a)Change theme, b)Add Rom Name & c)Add Features
1.3. Make your own theme
1.1.
720p HD Video Tutorial
1. Download - Aroma Easy Installer (Password:awesomearoma)
2. Extract it.
3. Copy Meta-inf rom a custom rom. I'm using Decption V3 for Micromax A87.
4. Now, run the batch file.
5. Press "Enter" to begin.
6. Read everything on the screen.
7. Press "Enter" to end.(It will redirect you to this forum. It was added purposely, no bug)
8. The META-INF file is the Aroma Installer, original_META-INF is the original.
9. Replace the "META-INF" folder with the one in your rom.
1.2.
a)
Open META-INF/com/google/android/aroma-config with Notepad++
Here line 7 represents theme - theme("miui4");
This means that miui4 is the theme used. Replace this line with any of these -
For Ice Cream Sandwich theme
Code:
theme("ics");
For HTC Sense theme
Code:
theme("sense");
For MIUI theme
Code:
theme("miui");
Click to expand...
Click to collapse
b)
Open META-INF/com/google/android/aroma-config with Notepad++
Change all text "Custom Rom" to your Rom's name.
c)
Open META-INF/com/google/android/aroma/changelogs.txt with Notepad or Notepad++
And start filling your Rom's features.
1.3.
Navigate to META-INF\com\google\android\aroma\themes\
Here you'll find four folders. You are going to create your them, so, create a "New Folder" with the name of your theme.(No Caps).
Open Notepad++ and create a new file. Fill in this
Note: In Line 65 and 66, replace mytheme by the name of the folder you created in previous step. Replace "yourname" with your name.
Code:
img.background=bg
img.titlebar=titlebar.9
img.navbar=navbar.9
img.dialog=dialog.9
img.dialog.titlebar=dialog_titlebar.9
img.progress=button.9
img.prograss.fill=button_press.9
img.selection=list.9
img.selection.push=list.9
img.button=button.9
img.button.focus=button_focus.9
img.button.push=button_press.9
img.checkbox=cb
img.checkbox.focus=cb_focus
img.checkbox.push=cb_press
img.checkbox.on=cb_on
img.checkbox.on.focus=cb_on_focus
img.checkbox.on.push=cb_on_press
img.radio=radio
img.radio.focus=radio_focus
img.radio.push=radio_press
img.radio.on=radio_on
img.radio.on.focus=radio_on_focus
img.radio.on.push=radio_on_press
color.winbg = #000
color.winbg_g = #444
color.winfg = #fff
color.winfg_gray = #666
color.dialogbg = #000
color.dialogbg_g = #444
color.dialogfg = #fff
color.textbg = #000
color.textfg = #fff
color.textfg_gray = #aaa
color.controlbg = #999
color.controlbg_g = #999
color.controlfg = #fff
color.selectbg = #33B5E5
color.selectbg_g = #33B5E5
color.selectfg = #fff
color.titlebg = #000
color.titlebg_g = #000
color.titlefg = #fff
color.dlgtitlebg = #fff
color.dlgtitlebg_g = #000
color.dlgtitlefg = #fff
color.scrollbar = #ccc
color.navbg = #000
color.navbg_g = #000
color.border = #666
color.border_g = #666
color.progressglow = #33B5E5
config.roundsize = 1
config.button_roundsize = 1
config.window_roundsize = 1
config.transition_frame = 5
font.small = font.roboto.small
font.big = font.roboto.big
info.themename = mytheme
info.description = mytheme for Aroma
info.author = yourname
Download this - Aroma Theme PNGs
Copy all the PNGs in the downloaded file to your theme folder. Modify them.
Note: For modifying .9.PNGs, take special care. A video on how to edit .9.PNGs is available in my Making a Rom Guide. Check my signature for the link to it.
Modify them to your liking.
Tip: All lines with
color.* = #*** follow 3 char color hexes.
Some of the 3 char hexes for colours are
Code:
White=#fff
Black=#000
Red=#f00
Green=#0f0
Blue=#00f
You may also try 6 Hex,but, I haven't so far as these colors fulfill my needs.
Now,
In line 7 of META-INF/com/google/android/aroma-config, change the characters within "-" to the name of your folder created. Test.
Credits: amarullz at xda for Aroma Installer.
All files except Aroma are created by me. You can use them anywhere, anytime without asking me, but you have to hit thanks to get this privilege.
Sent from my GT-I9082 using Tapatalk 2
Easiest Guide
Good Going :good:
Keep it up
Download link error in aroma-tut.rar
Please update it.
i am getting xxxECHO is not recognised a internal or external command, operable program or batch file. where xxx is some weird symbol. I am using windows 8.1 64-bit.
Pls reply asap.
Awsome!
Adhi1419 said:
This can also be found here .
The guide above was also made by me.
Hi guys,
Follow instructions to have Aroma Installer on your Rom.
Topics covered
1.1 How To Add
1.2. a)Change theme, b)Add Rom Name & c)Add Features
1.3. Make your own theme
1.1.
720p HD Video Tutorial
1. Download - Aroma Easy Installer (Password:awesomearoma)
2. Extract it.
3. Copy Meta-inf rom a custom rom. I'm using Decption V3 for Micromax A87.
4. Now, run the batch file.
5. Press "Enter" to begin.
6. Read everything on the screen.
7. Press "Enter" to end.(It will redirect you to this forum. It was added purposely, no bug)
8. The META-INF file is the Aroma Installer, original_META-INF is the original.
9. Replace the "META-INF" folder with the one in your rom.
1.2.
a)
Open META-INF/com/google/android/aroma-config with Notepad++
Here line 7 represents theme - theme("miui4");
This means that miui4 is the theme used. Replace this line with any of these -
b)
Open META-INF/com/google/android/aroma-config with Notepad++
Change all text "Custom Rom" to your Rom's name.
c)
Open META-INF/com/google/android/aroma/changelogs.txt with Notepad or Notepad++
And start filling your Rom's features.
1.3.
Navigate to META-INF\com\google\android\aroma\themes\
Here you'll find four folders. You are going to create your them, so, create a "New Folder" with the name of your theme.(No Caps).
Open Notepad++ and create a new file. Fill in this
Note: In Line 65 and 66, replace mytheme by the name of the folder you created in previous step. Replace "yourname" with your name.
Code:
img.background=bg
img.titlebar=titlebar.9
img.navbar=navbar.9
img.dialog=dialog.9
img.dialog.titlebar=dialog_titlebar.9
img.progress=button.9
img.prograss.fill=button_press.9
img.selection=list.9
img.selection.push=list.9
img.button=button.9
img.button.focus=button_focus.9
img.button.push=button_press.9
img.checkbox=cb
img.checkbox.focus=cb_focus
img.checkbox.push=cb_press
img.checkbox.on=cb_on
img.checkbox.on.focus=cb_on_focus
img.checkbox.on.push=cb_on_press
img.radio=radio
img.radio.focus=radio_focus
img.radio.push=radio_press
img.radio.on=radio_on
img.radio.on.focus=radio_on_focus
img.radio.on.push=radio_on_press
color.winbg = #000
color.winbg_g = #444
color.winfg = #fff
color.winfg_gray = #666
color.dialogbg = #000
color.dialogbg_g = #444
color.dialogfg = #fff
color.textbg = #000
color.textfg = #fff
color.textfg_gray = #aaa
color.controlbg = #999
color.controlbg_g = #999
color.controlfg = #fff
color.selectbg = #33B5E5
color.selectbg_g = #33B5E5
color.selectfg = #fff
color.titlebg = #000
color.titlebg_g = #000
color.titlefg = #fff
color.dlgtitlebg = #fff
color.dlgtitlebg_g = #000
color.dlgtitlefg = #fff
color.scrollbar = #ccc
color.navbg = #000
color.navbg_g = #000
color.border = #666
color.border_g = #666
color.progressglow = #33B5E5
config.roundsize = 1
config.button_roundsize = 1
config.window_roundsize = 1
config.transition_frame = 5
font.small = font.roboto.small
font.big = font.roboto.big
info.themename = mytheme
info.description = mytheme for Aroma
info.author = yourname
Download this - Aroma Theme PNGs
Copy all the PNGs in the downloaded file to your theme folder. Modify them.
Note: For modifying .9.PNGs, take special care. A video on how to edit .9.PNGs is available in my Making a Rom Guide. Check my signature for the link to it.
Modify them to your liking.
Tip: All lines with
color.* = #*** follow 3 char color hexes.
Some of the 3 char hexes for colours are
Code:
White=#fff
Black=#000
Red=#f00
Green=#0f0
Blue=#00f
You may also try 6 Hex,but, I haven't so far as these colors fulfill my needs.
Now,
In line 7 of META-INF/com/google/android/aroma-config, change the characters within "-" to the name of your folder created. Test.
Credits: amarullz at xda for Aroma Installer.
All files except Aroma are created by me. You can use them anywhere, anytime without asking me, but you have to hit thanks to get this privilege.
Sent from my GT-I9082 using Tapatalk 2
Click to expand...
Click to collapse
Awesome Guide ! Easiest one !:good:
---------- Post added at 05:12 PM ---------- Previous post was at 05:11 PM ----------
Adhi1419 said:
This can also be found here .
The guide above was also made by me.
Hi guys,
Follow instructions to have Aroma Installer on your Rom.
Topics covered
1.1 How To Add
1.2. a)Change theme, b)Add Rom Name & c)Add Features
1.3. Make your own theme
1.1.
720p HD Video Tutorial
1. Download - Aroma Easy Installer (Password:awesomearoma)
2. Extract it.
3. Copy Meta-inf rom a custom rom. I'm using Decption V3 for Micromax A87.
4. Now, run the batch file.
5. Press "Enter" to begin.
6. Read everything on the screen.
7. Press "Enter" to end.(It will redirect you to this forum. It was added purposely, no bug)
8. The META-INF file is the Aroma Installer, original_META-INF is the original.
9. Replace the "META-INF" folder with the one in your rom.
1.2.
a)
Open META-INF/com/google/android/aroma-config with Notepad++
Here line 7 represents theme - theme("miui4");
This means that miui4 is the theme used. Replace this line with any of these -
b)
Open META-INF/com/google/android/aroma-config with Notepad++
Change all text "Custom Rom" to your Rom's name.
c)
Open META-INF/com/google/android/aroma/changelogs.txt with Notepad or Notepad++
And start filling your Rom's features.
1.3.
Navigate to META-INF\com\google\android\aroma\themes\
Here you'll find four folders. You are going to create your them, so, create a "New Folder" with the name of your theme.(No Caps).
Open Notepad++ and create a new file. Fill in this
Note: In Line 65 and 66, replace mytheme by the name of the folder you created in previous step. Replace "yourname" with your name.
Code:
img.background=bg
img.titlebar=titlebar.9
img.navbar=navbar.9
img.dialog=dialog.9
img.dialog.titlebar=dialog_titlebar.9
img.progress=button.9
img.prograss.fill=button_press.9
img.selection=list.9
img.selection.push=list.9
img.button=button.9
img.button.focus=button_focus.9
img.button.push=button_press.9
img.checkbox=cb
img.checkbox.focus=cb_focus
img.checkbox.push=cb_press
img.checkbox.on=cb_on
img.checkbox.on.focus=cb_on_focus
img.checkbox.on.push=cb_on_press
img.radio=radio
img.radio.focus=radio_focus
img.radio.push=radio_press
img.radio.on=radio_on
img.radio.on.focus=radio_on_focus
img.radio.on.push=radio_on_press
color.winbg = #000
color.winbg_g = #444
color.winfg = #fff
color.winfg_gray = #666
color.dialogbg = #000
color.dialogbg_g = #444
color.dialogfg = #fff
color.textbg = #000
color.textfg = #fff
color.textfg_gray = #aaa
color.controlbg = #999
color.controlbg_g = #999
color.controlfg = #fff
color.selectbg = #33B5E5
color.selectbg_g = #33B5E5
color.selectfg = #fff
color.titlebg = #000
color.titlebg_g = #000
color.titlefg = #fff
color.dlgtitlebg = #fff
color.dlgtitlebg_g = #000
color.dlgtitlefg = #fff
color.scrollbar = #ccc
color.navbg = #000
color.navbg_g = #000
color.border = #666
color.border_g = #666
color.progressglow = #33B5E5
config.roundsize = 1
config.button_roundsize = 1
config.window_roundsize = 1
config.transition_frame = 5
font.small = font.roboto.small
font.big = font.roboto.big
info.themename = mytheme
info.description = mytheme for Aroma
info.author = yourname
Download this - Aroma Theme PNGs
Copy all the PNGs in the downloaded file to your theme folder. Modify them.
Note: For modifying .9.PNGs, take special care. A video on how to edit .9.PNGs is available in my Making a Rom Guide. Check my signature for the link to it.
Modify them to your liking.
Tip: All lines with
color.* = #*** follow 3 char color hexes.
Some of the 3 char hexes for colours are
Code:
White=#fff
Black=#000
Red=#f00
Green=#0f0
Blue=#00f
You may also try 6 Hex,but, I haven't so far as these colors fulfill my needs.
Now,
In line 7 of META-INF/com/google/android/aroma-config, change the characters within "-" to the name of your folder created. Test.
Credits: amarullz at xda for Aroma Installer.
All files except Aroma are created by me. You can use them anywhere, anytime without asking me, but you have to hit thanks to get this privilege.
Sent from my GT-I9082 using Tapatalk 2
Click to expand...
Click to collapse
Awesome Guide ! Easiest one !:good:
Does this work with lollipop? (dat system files).

Where to write a file in Tomcat 8 and Servlet /JSP on my Hard Disk ?

Hi all,
I want to write my.properties file. My query is that “In which path it should be created”. I have installed glassfish on my Linux 14.04 machine on this path: /opt/glassfish4 and created the file my.properties at: /opt/glassfish4/glassfish/domains/swManzana/config/my.properties
This is my Java Code:
PHP:
Boolean wflag = false;
String wnomfile="my.properties"
Properties prop = new Properties();
OutputStream output = null;
System.out.println("Inicio Archivo Properties.. " + wnomfile);
try {
// output = new FileOutputStream("config.properties");
output = new FileOutputStream(wnomfile);
System.out.println("Archivo Creado Properties..");
// set the properties value
prop.setProperty("database", "localhost");
prop.setProperty("dbuser","mkyong");
prop.setProperty("dbpassword","password");
// save properties to project root folder
prop.store(output,null);
System.out.println("Archivo Creado/Grabado Properties..");
wflag=true;
}catch(IOExceptionio){
System.out.println("Error Archivo Properties Exception..");
io.printStackTrace();
}finally{
System.out.println("Archivo Properties inicio Finally..");
if(output!=null){
try{
System.out.println("Archivo Properties Antes de CLOSE Finally..");
output.close();
System.out.println("Archivo Properties Grabado Finally..");
}catch(IOExceptione){
System.out.println("Archivo Properties Exception-Finally..");
e.printStackTrace();
}
}
}
returnwflag;
While executing the above code my.properties file not created. Why Tomcat is not creating this file. I have properly checked my tomcat installation and found no issues in access web Pages and ports.
Can anyone suggest me some knowledgeable tutorials URL Links on Java questions and answers, so that I can get my query resolved faster.
Thanks

Decrypting WhatsApp crypt12 files

I will just leave this here. :good:
Python:
Code:
#!/usr/bin/env python
""" decrypt12.py: Decrypts WhatsApp msgstore.db.crypt12 files. """
""" Requires pycrypto and pycryptodome packages. """
__author__ = 'TripCode'
__copyright__ = 'Copyright (C) 2016'
__license__ = 'GPLv3'
__status__ = 'Production'
__version__ = '1.0'
from Crypto.Cipher import AES
import os
import sys
import zlib
def keyfile(kf):
global t1, key
if os.path.isfile(kf) == False:
quit('The specified input key file does not exist.')
elif os.path.getsize(kf) != 158:
quit('The specified input key file is invalid.')
with open(kf, 'rb') as keyfile:
keyfile.seek(30)
t1 = keyfile.read(32)
keyfile.seek(126)
key = keyfile.read(32)
return True
def decrypt12(cf, of):
global t2, iv
if os.path.isfile(cf) == False:
quit('The specified input crypt12 file does not exist.')
tf = cf+'.tmp'
with open(cf, 'rb') as crypt12:
crypt12.seek(3)
t2 = crypt12.read(32)
if t1 != t2:
quit('Key file mismatch or crypt12 file is corrupt.')
crypt12.seek(51)
iv = crypt12.read(16)
crypt12.seek(67)
primer(tf, crypt12, 20)
cipher = AES.new(key, AES.MODE_GCM, iv)
sqlite = zlib.decompress(cipher.decrypt(open(tf, 'rb').read()))
with open(of, 'wb') as msgstore:
msgstore.write(sqlite)
msgstore.close()
os.remove(tf)
return True
def primer(tf, crypt12, sb):
with open(tf, 'wb') as header:
header.write(crypt12.read())
header.close()
with open(tf, 'rb+') as footer:
footer.seek(-sb, os.SEEK_END)
footer.truncate()
footer.close()
def validate(ms):
with open(ms, 'rb') as msgstore:
if msgstore.read(6).decode('ascii').lower() != 'sqlite':
os.remove(ms)
msg = 'Decryption of crypt12 file has failed.'
else:
msg = 'Decryption of crypt12 file was successful.'
msgstore.close()
quit(msg)
def main():
if len(sys.argv) > 2 and len(sys.argv) < 5:
if len(sys.argv) == 3:
outfile = 'msgstore.db'
else:
outfile = sys.argv[3]
if keyfile(sys.argv[1]) and decrypt12(sys.argv[2], outfile):
validate(outfile)
else:
print('\nWhatsApp Crypt12 Database Decrypter '+__version__+' '+__copyright__+' by '+__author__+'\n')
print('\tUsage: python '+str(sys.argv[0])+' key msgstore.db.crypt12 msgstore.db\n')
if __name__ == "__main__":
main()
Code:
Usage: python decrypt12.py key msgstore.db.crypt12 msgstore.db
Java:
Code:
package decrypt12;
/*
*
*** decrypt12.jar: Decrypts WhatsApp msgstore.db.crypt12 files. ***
*
* Author : TripCode
* Copyright : Copyright (C) 2016
* License : GPLv3
* Status : Production
* Version : 1.0
*
*/
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.security.Security;
import java.util.zip.Inflater;
import java.util.zip.InflaterInputStream;
import javax.crypto.Cipher;
import javax.crypto.CipherInputStream;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
// import org.spongycastle.jce.provider.BouncyCastleProvider; // Android
public class decrypt12 {
static {
Security.insertProviderAt(new org.bouncycastle.jce.provider.BouncyCastleProvider(), 1);
// Security.insertProviderAt(new org.spongycastle.jce.provider.BouncyCastleProvider(), 1); // Android
}
public static void decrypt(String KeyFile, String C12File, String SQLFile) throws Exception {
final File tempFile = new File(System.getProperty("java.io.tmpdir") + "/"
+ (int) (System.currentTimeMillis() / 1000L) + "-msgstore.enc");
if (!new File(KeyFile).isFile())
quit("The specified input key file does not exist.");
else if (new File(KeyFile).length() != 158)
quit("The specified input key file is invalid.");
else if (!new File(C12File).isFile())
quit("The specified input crypt12 file does not exist.");
InputStream KeyIn = new FileInputStream(KeyFile);
InputStream WdbIn = new BufferedInputStream(new FileInputStream(C12File));
byte[] KeyData = new byte[158];
KeyIn.read(KeyData);
byte[] T1 = new byte[32];
System.arraycopy(KeyData, 30, T1, 0, 32);
byte[] KEY = new byte[32];
System.arraycopy(KeyData, 126, KEY, 0, 32);
KeyIn.close();
byte[] C12Data = new byte[67];
WdbIn.read(C12Data);
byte[] T2 = new byte[32];
System.arraycopy(C12Data, 3, T2, 0, 32);
byte[] IV = new byte[16];
System.arraycopy(C12Data, 51, IV, 0, 16);
if (!new String(T1, 0, T1.length, "ASCII").equals(new String(T2, 0, T2.length, "ASCII")))
quit("Key file mismatch or crypt12 file is corrupt.");
int InputLength = WdbIn.available();
RandomAccessFile raf = new RandomAccessFile(tempFile, "rw");
byte[] tempBuffer = new byte[1024];
int I;
while ((I = WdbIn.read(tempBuffer)) != -1)
raf.write(tempBuffer, 0, I);
raf.setLength(InputLength - 20);
raf.close();
WdbIn.close();
InputStream PdbSt = new BufferedInputStream(new FileInputStream(tempFile));
Cipher cipher;
Security.addProvider(new BouncyCastleProvider());
cipher = Cipher.getInstance("AES/GCM/NoPadding", "BC"); // BouncyCastle
// cipher = Cipher.getInstance("AES/GCM/NoPadding", "SC"); // SpongyCastle (Android)
cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(KEY, "AES"), new IvParameterSpec(IV));
CipherInputStream CipherStream = new CipherInputStream(PdbSt, cipher);
InflaterInputStream CryptOutput = new InflaterInputStream(CipherStream, new Inflater(false));
try {
FileOutputStream InflateBuffer = new FileOutputStream(SQLFile);
int N = 0;
byte[] CryptBuffer = new byte[8192];
while ((N = CryptOutput.read(CryptBuffer)) != -1) {
InflateBuffer.write(CryptBuffer, 0, N);
}
InflateBuffer.close();
} catch (IOException ex) {
quit("Fatal error:" + ex);
}
CipherStream.close();
tempFile.delete();
InputStream SqlDB = new FileInputStream(SQLFile);
byte[] SqlData = new byte[6];
SqlDB.read(SqlData);
byte[] MS = new byte[6];
System.arraycopy(SqlData, 0, MS, 0, 6);
SqlDB.close();
if (!new String(MS, 0, MS.length, "ASCII").toLowerCase().equals("sqlite")) {
new File(SQLFile).delete();
quit("Decryption of crypt12 file has failed.");
}
else
quit("Decryption of crypt12 file was successful.");
}
private static void quit(String Msg) {
System.out.println(Msg);
System.exit(0);
}
public static void main(String[] args) throws Exception {
String outFile;
if (args.length > 1 && args.length < 4) {
if (args.length == 3)
outFile = args[2];
else
outFile = "msgstore.db";
decrypt(args[0], args[1], outFile);
} else {
System.out.println("\nWhatsApp Crypt12 Database Decrypter 1.0 Copyright (C) 2016 by TripCode");
System.out.println("\tUsage: java -jar decrypt12.jar key msgstore.db.crypt12 msgstore.db\n");
}
}
}
Code:
Usage: java -jar decrypt12.jar key msgstore.db.crypt12 msgstore.db
GitHub Repository: WhatsApp-Crypt12-Decrypter
Just a quick question: My phone was swapped by a repair shop and the other person who got my phone didn't realize this at first. She did a factory reset, and probably installed Whatsapp with her SIM card before I got my phone back. I'm so angry right now...
I guess my key file is gone - either deleted by the factory reset or overwritten with her Whatsapp's key file. I have several backups of the Whatsapp directory and still the same Google account, IMEI and phone number. Can I restore my messages or are any attempts futile?
(I see that the code asks for a key file, so if I cannot get it/extract it somewhere, there is probably no chance anymore?)
hi, realy great tool
with that i could open the msgstore.db and see my chats
but is it possible to convert this file into a .db.crypt12 file or something like that, so i can open it with whatsapp an have my chats back?
or are there other ways, i can use this msgstore.db + wa.db to recover the chats?
Hi!
I have a crypt12 database but no key...is there anyone out there able to decrypt it?
How much will it cost to me to do this? Can anyone do it for me?
Is the code written here above working in decrypting a crypt12 database?
I don't want to root or install any spyware, just trying to decrypt the file.
anyone interested in trying?
Please write dawn here if you're interested and we'll get in contact...
ettorebonfanti said:
Hi!
I have a crypt12 database but no key...is there anyone out there able to decrypt it?
How much will it cost to me to do this? Can anyone do it for me?
Is the code written here above working in decrypting a crypt12 database?
I don't want to root or install any spyware, just trying to decrypt the file.
anyone interested in trying?
Please write dawn here if you're interested and we'll get in contact...
Click to expand...
Click to collapse
There is a program out there which claims to obtain the key file without root. If it's still working today, I don't know. Here: https://forum.xda-developers.com/showthread.php?t=2770982
If you want the key file, it's better to root your phone and get it. It's not that hard. You can even unroot your phone after catching the key.
And no, someone can't just decrypt the database, because the key is there for a reason, and this reason is security.
Excellent! Just used this to fix a Whatapp DB.
---------- Post added at 10:57 AM ---------- Previous post was at 10:50 AM ----------
This is great thanks! How do I encrypt the database again with crypt12?
I have both, the DB and the key.
TripCode said:
I will just leave this here. :good:
Python:
Code:
#!/usr/bin/env python
""" decrypt12.py: Decrypts WhatsApp msgstore.db.crypt12 files. """
""" Requires pycrypto and pycryptodome packages. """
__author__ = 'TripCode'
__copyright__ = 'Copyright (C) 2016'
__license__ = 'GPLv3'
__status__ = 'Production'
__version__ = '1.0'
from Crypto.Cipher import AES
import os
import sys
import zlib
def keyfile(kf):
global t1, key
if os.path.isfile(kf) == False:
quit('The specified input key file does not exist.')
elif os.path.getsize(kf) != 158:
quit('The specified input key file is invalid.')
with open(kf, 'rb') as keyfile:
keyfile.seek(30)
t1 = keyfile.read(32)
keyfile.seek(126)
key = keyfile.read(32)
return True
def decrypt12(cf, of):
global t2, iv
if os.path.isfile(cf) == False:
quit('The specified input crypt12 file does not exist.')
tf = cf+'.tmp'
with open(cf, 'rb') as crypt12:
crypt12.seek(3)
t2 = crypt12.read(32)
if t1 != t2:
quit('Key file mismatch or crypt12 file is corrupt.')
crypt12.seek(51)
iv = crypt12.read(16)
crypt12.seek(67)
primer(tf, crypt12, 20)
cipher = AES.new(key, AES.MODE_GCM, iv)
sqlite = zlib.decompress(cipher.decrypt(open(tf, 'rb').read()))
with open(of, 'wb') as msgstore:
msgstore.write(sqlite)
msgstore.close()
os.remove(tf)
return True
def primer(tf, crypt12, sb):
with open(tf, 'wb') as header:
header.write(crypt12.read())
header.close()
with open(tf, 'rb+') as footer:
footer.seek(-sb, os.SEEK_END)
footer.truncate()
footer.close()
def validate(ms):
with open(ms, 'rb') as msgstore:
if msgstore.read(6).decode('ascii').lower() != 'sqlite':
os.remove(ms)
msg = 'Decryption of crypt12 file has failed.'
else:
msg = 'Decryption of crypt12 file was successful.'
msgstore.close()
quit(msg)
def main():
if len(sys.argv) > 2 and len(sys.argv) < 5:
if len(sys.argv) == 3:
outfile = 'msgstore.db'
else:
outfile = sys.argv[3]
if keyfile(sys.argv[1]) and decrypt12(sys.argv[2], outfile):
validate(outfile)
else:
print('\nWhatsApp Crypt12 Database Decrypter '+__version__+' '+__copyright__+' by '+__author__+'\n')
print('\tUsage: python '+str(sys.argv[0])+' key msgstore.db.crypt12 msgstore.db\n')
if __name__ == "__main__":
main()
Code:
Usage: python decrypt12.py key msgstore.db.crypt12 msgstore.db
Java:
Code:
package decrypt12;
/*
*
*** decrypt12.jar: Decrypts WhatsApp msgstore.db.crypt12 files. ***
*
* Author : TripCode
* Copyright : Copyright (C) 2016
* License : GPLv3
* Status : Production
* Version : 1.0
*
*/
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.security.Security;
import java.util.zip.Inflater;
import java.util.zip.InflaterInputStream;
import javax.crypto.Cipher;
import javax.crypto.CipherInputStream;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
// import org.spongycastle.jce.provider.BouncyCastleProvider; // Android
public class decrypt12 {
static {
Security.insertProviderAt(new org.bouncycastle.jce.provider.BouncyCastleProvider(), 1);
// Security.insertProviderAt(new org.spongycastle.jce.provider.BouncyCastleProvider(), 1); // Android
}
public static void decrypt(String KeyFile, String C12File, String SQLFile) throws Exception {
final File tempFile = new File(System.getProperty("java.io.tmpdir") + "/"
+ (int) (System.currentTimeMillis() / 1000L) + "-msgstore.enc");
if (!new File(KeyFile).isFile())
quit("The specified input key file does not exist.");
else if (new File(KeyFile).length() != 158)
quit("The specified input key file is invalid.");
else if (!new File(C12File).isFile())
quit("The specified input crypt12 file does not exist.");
InputStream KeyIn = new FileInputStream(KeyFile);
InputStream WdbIn = new BufferedInputStream(new FileInputStream(C12File));
byte[] KeyData = new byte[158];
KeyIn.read(KeyData);
byte[] T1 = new byte[32];
System.arraycopy(KeyData, 30, T1, 0, 32);
byte[] KEY = new byte[32];
System.arraycopy(KeyData, 126, KEY, 0, 32);
KeyIn.close();
byte[] C12Data = new byte[67];
WdbIn.read(C12Data);
byte[] T2 = new byte[32];
System.arraycopy(C12Data, 3, T2, 0, 32);
byte[] IV = new byte[16];
System.arraycopy(C12Data, 51, IV, 0, 16);
if (!new String(T1, 0, T1.length, "ASCII").equals(new String(T2, 0, T2.length, "ASCII")))
quit("Key file mismatch or crypt12 file is corrupt.");
int InputLength = WdbIn.available();
RandomAccessFile raf = new RandomAccessFile(tempFile, "rw");
byte[] tempBuffer = new byte[1024];
int I;
while ((I = WdbIn.read(tempBuffer)) != -1)
raf.write(tempBuffer, 0, I);
raf.setLength(InputLength - 20);
raf.close();
WdbIn.close();
InputStream PdbSt = new BufferedInputStream(new FileInputStream(tempFile));
Cipher cipher;
Security.addProvider(new BouncyCastleProvider());
cipher = Cipher.getInstance("AES/GCM/NoPadding", "BC"); // BouncyCastle
// cipher = Cipher.getInstance("AES/GCM/NoPadding", "SC"); // SpongyCastle (Android)
cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(KEY, "AES"), new IvParameterSpec(IV));
CipherInputStream CipherStream = new CipherInputStream(PdbSt, cipher);
InflaterInputStream CryptOutput = new InflaterInputStream(CipherStream, new Inflater(false));
try {
FileOutputStream InflateBuffer = new FileOutputStream(SQLFile);
int N = 0;
byte[] CryptBuffer = new byte[8192];
while ((N = CryptOutput.read(CryptBuffer)) != -1) {
InflateBuffer.write(CryptBuffer, 0, N);
}
InflateBuffer.close();
} catch (IOException ex) {
quit("Fatal error:" + ex);
}
CipherStream.close();
tempFile.delete();
InputStream SqlDB = new FileInputStream(SQLFile);
byte[] SqlData = new byte[6];
SqlDB.read(SqlData);
byte[] MS = new byte[6];
System.arraycopy(SqlData, 0, MS, 0, 6);
SqlDB.close();
if (!new String(MS, 0, MS.length, "ASCII").toLowerCase().equals("sqlite")) {
new File(SQLFile).delete();
quit("Decryption of crypt12 file has failed.");
}
else
quit("Decryption of crypt12 file was successful.");
}
private static void quit(String Msg) {
System.out.println(Msg);
System.exit(0);
}
public static void main(String[] args) throws Exception {
String outFile;
if (args.length > 1 && args.length < 4) {
if (args.length == 3)
outFile = args[2];
else
outFile = "msgstore.db";
decrypt(args[0], args[1], outFile);
} else {
System.out.println("\nWhatsApp Crypt12 Database Decrypter 1.0 Copyright (C) 2016 by TripCode");
System.out.println("\tUsage: java -jar decrypt12.jar key msgstore.db.crypt12 msgstore.db\n");
}
}
}
Code:
Usage: java -jar decrypt12.jar key msgstore.db.crypt12 msgstore.db
GitHub Repository: WhatsApp-Crypt12-Decrypter
Click to expand...
Click to collapse
error message..line 84..intended error
hi tripcode...i used the python script in python3.6...it showed an intended error..error line 84...can u please help me in this issue..or can u guid me to decrypt the file..am not having that key file..thats y..mobile lost..i retrieved the files from drive..so plz help me in this issue..
error the key file not found
hi it was fine till it shows the key file is not found...plz help me in this issues
GURUMOORTHI said:
hi it was fine till it shows the key file is not found...plz help me in this issues
Click to expand...
Click to collapse
w/o key file ...there is no way to brake the crytp12...
mmmm but i don`t know if there is any chace using brute force to brake the encrytion
Can someone share pycrypto also pycryptodome? or java for Android thanks
gbwhatsapp
Fusseldieb said:
There is a program out there which claims to obtain the key file without root. If it's still working today, I don't know. Here: https://forum.xda-developers.com/showthread.php?t=2770982
If you want the key file, it's better to root your phone and get it. It's not that hard. You can even unroot your phone after catching the key.
And no, someone can't just decrypt the database, because the key is there for a reason, and this reason is security.
Click to expand...
Click to collapse
You can try:
a tutorial from Ik Teach:
https://www.youtube.com/watch?v=4b1f2iTnoO8
link to the file gbwhatsapp:
https://idescargar.com/gbwhatsapp/descargar/
It give you de key file whithout root. It worked for me. But it is a little tricky. and you end up with this modded whatsapp.
Cheers!
hii tripcode
I am not having that key file..
i lost my mobile....i retrieved the files from drive..so plz help me to decrypt my database.
shanya_creation said:
hii tripcode
I am not having that key file..
i lost my mobile....i retrieved the files from drive..so plz help me to decrypt my database.
Click to expand...
Click to collapse
You need to re-download WhatsApp in another phone and use your old number. (Yes, you'll need to recover your phone number before recovering your chats). Once you have WhatsApp installed you can take out the Key file from /data/data/com.whatsapp/files
To do that stuff i recommend to use a old phone that can be easily rooted or one that has already rooted.
Good luck :good:
Hello,
Does anyone know if by any chance KEY file gets deleted on old phone when whatsapp is activated on a new phone and old phone whatsapp gets locked asking for conf code by SMS?
I rooted android 4.x.x
I then searched using ez file manager in root and in data/data /com.whatsapp but i do not see a KEY file.
download WhatsApp Plus8.30 it will work for you
https://goapk.org/whatsapp-plus/
Need Help!
I have whatsapp db.crypt12 file. I am novice in Mobile. Can anybody make that file readable professionally for me? I am ready to pay for this.
HI,
I have extracted the key by the procedure of "WhatsApp Key/DB Extractor 4.7 Enhanced 1.0" (https://forum.xda-developers.com/showthread.php?t=2770982&page=55), but eventually your JAVA code failed with message:
Key file mismatch or crypt12 file is corrupt.
Why is that?
Somewhere (guess at Elcomsoft Explorer) I have read, that the key can only decrypt backups taken from a previous time. This should true in my case, isnt?
1) Is the key somehow related to the phone device itself? (I have used a spare phone for this analysis, so not the original WA was regularly running on.)
Since end of August (when an Upgrade of WA has destroyed my chat history database) I have tried several attempts to restore it by downgrading WA to 2.20.64 and 2.20.89, so the key I have now is not the original of what the crypted backup was created with.
Moreover, due to a database schema error my chat history can only be loaded with WA version previous to 2.20.89 (this is why: https://medium.com/@leonardocezaryc...hatsapp-windows-phone-to-android-6b225918af55)
My experiments now led to the situation, that I not any more can register any pre-2.20.89 version by the SMS verification process, even though I dated my phone back to mid of August.
Thus I currently have no working installation with all my chat history where I could extract a crypto key from.
2) Any ideas how i can bypass Whatsapp to complain about its expired versions and register by SMS again?
3) Is it a hard-coded deadline in the binaries of the app?
4) Does the crypt key change between installations and become incompatible? I wonder, how to restore any old backup then...
Thanks!
samruthstom said:
Hello,
Does anyone know if by any chance KEY file gets deleted on old phone when whatsapp is activated on a new phone and old phone whatsapp gets locked asking for conf code by SMS?
I rooted android 4.x.x
I then searched using ez file manager in root and in data/data /com.whatsapp but i do not see a KEY file.
Click to expand...
Click to collapse
Yes - upon inactivation WA 2.20.89+ destroys the "key" file and instead creates a "backup_token" file.
It is recoverable by activating it via SMS code.
---------- Post added at 07:40 PM ---------- Previous post was at 07:26 PM ----------
heyvijay said:
I have whatsapp db.crypt12 file. I am novice in Mobile. Can anybody make that file readable professionally for me? I am ready to pay for this.
Click to expand...
Click to collapse
What kind of problem can't you solve so far?
There is a commercial solution called "Elcomsoft eXplorer for WhatsApp ".
I also would like and am about to try it out, if you are interested, we can share the costs of it.
After years of successfully using this to access MY chat data, this week it stopped working :-(
WhatsApp on my phone looks to have updated to v2.21.8.17 and is now generating local backups with a .crypt14 extension instead of .crypt12.
Unsurprisingly, this chokes on this with the error Key file mismatch or crypt12 file is corrupt.
However, armed with hexdump and a bit cunning, I've worked out how to tweak the python so that it successfully decodes .crypt14 files.
in a .crypt14 file ... [.py hacks in decrypt12 function shown below in square brackets]
... t2 is at offset 14 [so change to crypt12.seek(14) t2 = crypt12.read(32)]
... iv is at offset 66 [change to crypt12.seek(66) iv = crypt12.read(16)]
... encrypted content starts at offset 99, (I haven't yet worked out the correct amount of footer to remove, but removing 0 seems to result in a successful decryption so far) [change to crypt12.seek(99) primer(tf, crypt12, 0)]
I've also noticed that the 16 bytes at offset 62 to 77 in the key file also appear in the .cryptX file, just like the t bytes at offset 30 to 61 do.
In a .crypt12 file they are at offset 35 to 50.
In a .crypt14 file they are at offset 48 to 63.
In my code I've called these x1 and x2 and do the same equality check as happens for t1 and t2.
In addition, in the .crypt14 file, bytes at 86 to 94 look to contain the WA version number, so in my case 2.21.8.17 - presumably the version that wrote the .crypt14 file. I suspect that when the version number rolls over to more digits (e.g. 2.21.10.10) then the offset to the start of the encrypted content (currently 99 in my backup files) might well change?
adflyer said:
After years of successfully using this to access MY chat data, this week it stopped working :-(
WhatsApp on my phone looks to have updated to v2.21.8.17 and is now generating local backups with a .crypt14 extension instead of .crypt12.
Unsurprisingly, this chokes on this with the error Key file mismatch or crypt12 file is corrupt.
However, armed with hexdump and a bit cunning, I've worked out how to tweak the python so that it successfully decodes .crypt14 files.
in a .crypt14 file ... [.py hacks in decrypt12 function shown below in square brackets]
... t2 is at offset 14 [so change to crypt12.seek(14) t2 = crypt12.read(32)]
... iv is at offset 66 [change to crypt12.seek(66) iv = crypt12.read(16)]
... encrypted content starts at offset 99, (I haven't yet worked out the correct amount of footer to remove, but removing 0 seems to result in a successful decryption so far) [change to crypt12.seek(99) primer(tf, crypt12, 0)]
I've also noticed that the 16 bytes at offset 62 to 77 in the key file also appear in the .cryptX file, just like the t bytes at offset 30 to 61 do.
In a .crypt12 file they are at offset 35 to 50.
In a .crypt14 file they are at offset 48 to 63.
In my code I've called these x1 and x2 and do the same equality check as happens for t1 and t2.
In addition, in the .crypt14 file, bytes at 86 to 94 look to contain the WA version number, so in my case 2.21.8.17 - presumably the version that wrote the .crypt14 file. I suspect that when the version number rolls over to more digits (e.g. 2.21.10.10) then the offset to the start of the encrypted content (currently 99 in my backup files) might well change?
Click to expand...
Click to collapse
It's not working for me for some reason. I don't know what I am missing here. Can you provide the modified code itself?

Obfuscated apk decompile/recompile tool

Obfuscated apk decompile/recompile tool​This tool is modified from "iBotPeaches/apktool" to handle resource obfuscated(by ResGuard or any) apps like Wechat, Tiktok, MT Manager ...
About​
Renaming
Illegal name like "r/e/a_.xml" -> "res/layout/layout_01ab.xml"
Names containing non latin characters
For stripped file extension names, it guesses from file magic and data patterns
Ignores unique un-obfuscated names
Decompiling
Handles apktool known issues of "Invalid chunk type ***"
Merges splitted apk files
Compiling
The builtin aapt/aapt2 can handle "illegal java class names" (for linux only)
How to use​
All commands are the same as apktool
For splitted apk files pass the directory path containing your apk files and rename the main apk to "base.apk"
example: java -jar kikfox.jar "d" "-p" "/home/user/framework" "-o" "/home/user/tiktok_decompiled" "/home/user/tiktok_splits"
Update 2.6.1​
Handles multiple packages
Smart refactoring the obfuscated names will be renamed to more meaningful names like:
☆Color, Integer, Strings ... renaming is based on value e.g. #FFC0CB -> @ color/pink_ffc0 , 《No connection tap again to retry》-> @ string/no_connection_tap_again
☆ Layout & xml names is based on the root tag name e.g. if you have xml with <LinearLayout ...> then the resource name will be @ layout/linearLayout_12ab , or <paths ...> to @ xml/xml_paths_123
☆Other known variables from apk info, e.g. in AndroidManifest.xml android:icon is for app icon so the corresponding resource name will be @ drawable/app_icon
Downloads​V 2.4.0
Attachement
Github
Mega.nz
V 2.6.1
Github
UPDATE-1 (2.5.0-BETA)
I just released a new version on github
Whats new?
Smart refactoring *
works great. Do you plan an upgrade to 2.50 ?
[email protected] said:
works great. Do you plan an upgrade to 2.50 ?
Click to expand...
Click to collapse
As of today I didn't find out any problem with the current version , I decompiled as many obfuscated apks as i can and works for all. Currently I am working to combine features of Apktool+JADX+Smali/Baksmali to deobfuscate the java code.
If you find any bugs or apk which this tool fails to decompile, please share with me.
Thanks
Nice work!
Might sounds weird question, but do you plan to do pull requests on official apktool so iBotPeaches can handle updates with these features? maybe this will be huge benefit for everyone and iBotPeaches will be able to understand deobfuscation and merging apk a lot more, as it seems like he is struggling with it
evildog1 said:
Nice work!
Might sounds weird question, but do you plan to do pull requests on official apktool so iBotPeaches can handle updates with these features? maybe this will be huge benefit for everyone and iBotPeaches will be able to understand deobfuscation and merging apk a lot more, as it seems like he is struggling with it
Click to expand...
Click to collapse
I tried but seems like they are not interested in deobfuscation part (maybe they are working on "obfuscation" too ? ). Every apktool update is going away from handling obfuscated apk. I don't know why but a massive crowd want to silence the techniques of deobfuscation.
kikfox said:
I tried but seems like they are not interested in deobfuscation part (maybe they are working on "obfuscation" too ? ). Every apktool update is going away from handling obfuscated apk. I don't know why but a massive crowd want to silence the techniques of deobfuscation.
Click to expand...
Click to collapse
Oh i see.
Now I remember someone told me iBot work with AndResGuard which is why there is no fix to apktool, but i'm still not sure if he said was true.
I think Apktool is simply the ground work, from there you can take it where you want :')
News
New java based resource builder is coming.
☆ This tool is totally independent of aapt and aapt2.
☆ Can parse standard xml files under "res" directory and convert to binary "ARSC" file
Good job
A new java based ARSCTool is released.
Converts android resources.arsc to xml and build back to .arsc file
https://github.com/kikfox/ARSCTool
NEW version 2.6.2 released
https://github.com/kikfox/kikfox/releases/tag/v2.6.2
kikfox said:
NEW version 2.6.2 released
https://github.com/kikfox/kikfox/releases/tag/v2.6.2
Click to expand...
Click to collapse
kikfox-2.6.2.jar works fine on Macbook, but unable to decompile the r (resguard?) folder on Windows 10 PC.
Code:
I: Decoding resources ...
I: Decoding file-resources packages count=1 ....
I: Decoding file-resources PKG=com.xiaojie.tv
I: 1/548 'app.apk : r/k/da.9.png' -> 'drawable-xhdpi\abc_scrubber_primary_mtrl_alpha'
S: Could not decode file, replacing by FALSE value: r/k/da.9.png
S: Could not decode file, replacing by FALSE value: r/w/at.xml
S: Could not decode file, replacing by FALSE value: r/p/a.xml
S: Could not decode file, replacing by FALSE value: r/h/c7.xml
S: Could not decode file, replacing by FALSE value: r/k/ci.png
I: 548/548 'app.apk : r/p/a.xml' -> 'animator-v21\lb_onboarding_logo_enter'
S: Could not decode file, replacing by FALSE value: r/p/a.xml
I: Decoding values */* XMLs...
I: Decoding [59] value files from: com.xiaojie.tv
I: 1/59 values-v25\styles.xml
I: 59/59 values-v22\styles.xml
I: DONE decoding resources
a452388 said:
kikfox-2.6.2.jar works fine on Macbook, but unable to decompile the r (resguard?) folder on Windows 10 PC.
Code:
I: Decoding resources ...
I: Decoding file-resources packages count=1 ....
I: Decoding file-resources PKG=com.xiaojie.tv
I: 1/548 'app.apk : r/k/da.9.png' -> 'drawable-xhdpi\abc_scrubber_primary_mtrl_alpha'
S: Could not decode file, replacing by FALSE value: r/k/da.9.png
S: Could not decode file, replacing by FALSE value: r/w/at.xml
S: Could not decode file, replacing by FALSE value: r/p/a.xml
S: Could not decode file, replacing by FALSE value: r/h/c7.xml
S: Could not decode file, replacing by FALSE value: r/k/ci.png
I: 548/548 'app.apk : r/p/a.xml' -> 'animator-v21\lb_onboarding_logo_enter'
S: Could not decode file, replacing by FALSE value: r/p/a.xml
I: Decoding values */* XMLs...
I: Decoding [59] value files from: com.xiaojie.tv
I: 1/59 values-v25\styles.xml
I: 59/59 values-v22\styles.xml
I: DONE decoding resources
Click to expand...
Click to collapse
Hello,
I didn't test it on windows pc, if you are sure works on mac the problem could be some where in the code, mis using file separator character. For linux&mac '/' for windows '\'.
I will fix it on the next version
kikfox said:
Hello,
I didn't test it on windows pc, if you are sure works on mac the problem could be some where in the code, mis using file separator character. For linux&mac '/' for windows '\'.
I will fix it on the next version
Click to expand...
Click to collapse
FileDirectory.java, fix file separator and ensure parent dirs. Now it works.
Java:
protected OutputStream getFileOutputLocal(String name) throws DirectoryException {
try {
return new FileOutputStream(fileEnsuredDirs(generatePath(name)));
} catch (FileNotFoundException e) {
throw new DirectoryException(e);
}
}
private File fileEnsuredDirs(String path) {
File file = new File(path);
File parent = file.getParentFile();
if (!parent.exists()) {
parent.mkdirs();
}
return file;
}
private String generatePath(String name) {
return getmDir().getPath() + File.separator + name;
}
a452388 said:
FileDirectory.java, fix file separator and ensure parent dirs. Now it works.
Java:
protected OutputStream getFileOutputLocal(String name) throws DirectoryException {
try {
return new FileOutputStream(fileEnsuredDirs(generatePath(name)));
} catch (FileNotFoundException e) {
throw new DirectoryException(e);
}
}
private File fileEnsuredDirs(String path) {
File file = new File(path);
File parent = file.getParentFile();
if (!parent.exists()) {
parent.mkdirs();
}
return file;
}
private String generatePath(String name) {
return getmDir().getPath() + File.separator + name;
}
Click to expand...
Click to collapse
Exactly,
Glad to hear from someone with good understanding
Maybe you will be much interested in : github.com/REAndroid/ARSCLib
a452388 said:
FileDirectory.java, fix file separator and ensure parent dirs. Now it works.
Java:
protected OutputStream getFileOutputLocal(String name) throws DirectoryException {
try {
return new FileOutputStream(fileEnsuredDirs(generatePath(name)));
} catch (FileNotFoundException e) {
throw new DirectoryException(e);
}
}
private File fileEnsuredDirs(String path) {
File file = new File(path);
File parent = file.getParentFile();
if (!parent.exists()) {
parent.mkdirs();
}
return file;
}
private String generatePath(String name) {
return getmDir().getPath() + File.separator + name;
}
Click to expand...
Click to collapse
kikfox said:
Exactly,
Glad to hear from someone with good understanding
Maybe you will be much interested in : github.com/REAndroid/ARSCLib
Click to expand...
Click to collapse
And there's another bug, kikfox can not handle the '.jar' Android library. And the fix:
Code:
// ApkDecoder.java
// Do not do refactor if no resources
private void refactorResources() throws AndrolibException {
if (!this.mNoRefactor && (this.hasResources() || this.hasManifest())) {
ResTable resTable = this.getResTable();
ResRefactor resRefactor = new ResRefactor(this.mApkFileList, resTable, this.mRefactorFile);
resRefactor.refactorAll();
}
}
// Androlib.java
// resTable can be null
public void decodeUnknownFiles(ApkFile apkFile, File outDir, ResTable resTable) throws AndrolibException {
Set<ResResource> allFiles = resTable != null ? resTable.listSourceFiles(apkFile.getName()) : Collections.emptySet();
LOGGER.info("Copying unknown files '" + apkFile.getName() + "'");
File unknownOut = new File(outDir, "unknown");
...
}
// ApkFileList.java
// add '.jar' as ApkFile
private static boolean isApkFile(File file) {
if (file != null && file.isFile()) {
String name = file.getName();
name = name.toLowerCase();
return name.endsWith(".apk") || name.endsWith(".jar");
} else {
return false;
}
}
a452388 said:
And there's another bug, kikfox can not handle the '.jar' Android library. And the fix:
Code:
// ApkDecoder.java
// Do not do refactor if no resources
private void refactorResources() throws AndrolibException {
if (!this.mNoRefactor && (this.hasResources() || this.hasManifest())) {
ResTable resTable = this.getResTable();
ResRefactor resRefactor = new ResRefactor(this.mApkFileList, resTable, this.mRefactorFile);
resRefactor.refactorAll();
}
}
// Androlib.java
// resTable can be null
public void decodeUnknownFiles(ApkFile apkFile, File outDir, ResTable resTable) throws AndrolibException {
Set<ResResource> allFiles = resTable != null ? resTable.listSourceFiles(apkFile.getName()) : Collections.emptySet();
LOGGER.info("Copying unknown files '" + apkFile.getName() + "'");
File unknownOut = new File(outDir, "unknown");
...
}
// ApkFileList.java
// add '.jar' as ApkFile
private static boolean isApkFile(File file) {
if (file != null && file.isFile()) {
String name = file.getName();
name = name.toLowerCase();
return name.endsWith(".apk") || name.endsWith(".jar");
} else {
return false;
}
}
Click to expand...
Click to collapse
You are so good!
For
Code:
isApkFile
you are right it is a bug.
I am aware it will fail at no resource scenario, because my tool is aimed to handle "RESOURCE" obfuscated apks with some functionality which apktool lacks, NOT to replace apktool.
BTW:
I am going to abandon this tool working on a new tool :
1. Independent of apktool & aapt/aapt2
2. Integrated with smali/baksmali to refactor java classes
3. Proto <-> Binary resources (arsc)
Thank you again
GREAT

Categories

Resources