Syntax Cleanup
This commit is contained in:
parent
406b47bf8c
commit
fb075c884b
|
@ -42,7 +42,12 @@ public class APKTool
|
|||
|
||||
File tempAPKPath = new File(TEMP_DIRECTORY + FS + MiscUtils.randomString(12));
|
||||
tempAPKPath.mkdirs();
|
||||
brut.apktool.Main.main(new String[]{"r", "--frame-path", tempAPKPath.getAbsolutePath(), "d", input.getAbsolutePath(), "-o", dir.getAbsolutePath(), "-f"});
|
||||
|
||||
brut.apktool.Main.main(new String[]{"r",
|
||||
"--frame-path", tempAPKPath.getAbsolutePath(),
|
||||
"d", input.getAbsolutePath(),
|
||||
"-o", dir.getAbsolutePath(),
|
||||
"-f"});
|
||||
|
||||
File zip = new File(TEMP_DIRECTORY + FS + MiscUtils.randomString(12) + ".zip");
|
||||
ZipUtils.zipFolderAPKTool(dir.getAbsolutePath(), zip.getAbsolutePath());
|
||||
|
@ -65,7 +70,6 @@ public class APKTool
|
|||
File tempDir = new File(temp + FS + MiscUtils.getRandomizedName() + FS);
|
||||
tempDir.mkdirs();
|
||||
|
||||
|
||||
File tempAPKPath = new File(TEMP_DIRECTORY + FS + MiscUtils.randomString(12));
|
||||
tempAPKPath.mkdirs();
|
||||
|
||||
|
@ -74,10 +78,13 @@ public class APKTool
|
|||
File smaliFolder = new File(container.APKToolContents.getAbsolutePath() + FS + "smali");
|
||||
FileUtils.deleteDirectory(smaliFolder);
|
||||
|
||||
|
||||
//save entire jar as smali files
|
||||
System.out.println("Building!");
|
||||
brut.apktool.Main.main(new String[]{"b", container.APKToolContents.getAbsolutePath(), "--frame-path", tempAPKPath.getAbsolutePath(), "-o", output.getAbsolutePath()});
|
||||
brut.apktool.Main.main(new String[]{"b", container.APKToolContents.getAbsolutePath(),
|
||||
"--frame-path", tempAPKPath.getAbsolutePath(),
|
||||
"-o", output.getAbsolutePath()});
|
||||
|
||||
//cleanup
|
||||
tempAPKPath.delete();
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
|
@ -63,6 +63,7 @@ public class BootCheck implements Runnable
|
|||
{
|
||||
File libsDir = Boot.libsDir();
|
||||
File[] listFiles = libsDir.listFiles();
|
||||
List<String> libsFileList = new ArrayList<>();
|
||||
|
||||
//first boot failed to download libraries
|
||||
if (listFiles == null || listFiles.length <= 0)
|
||||
|
@ -74,7 +75,6 @@ public class BootCheck implements Runnable
|
|||
Boot.setState("Bytecode Viewer Boot Screen (OFFLINE MODE) - Unable to connect to github, force booting...");
|
||||
System.out.println("Unable to connect to github, force booting...");
|
||||
|
||||
List<String> libsFileList = new ArrayList<>();
|
||||
for (File f : listFiles)
|
||||
libsFileList.add(f.getAbsolutePath());
|
||||
|
||||
|
@ -84,6 +84,7 @@ public class BootCheck implements Runnable
|
|||
if (s.endsWith(".jar"))
|
||||
{
|
||||
File f = new File(s);
|
||||
|
||||
if (f.exists())
|
||||
{
|
||||
Boot.setState("Bytecode Viewer Boot Screen (OFFLINE MODE) - Force Loading Library " + f.getName());
|
||||
|
|
|
@ -34,7 +34,8 @@ public class ClassFileUtils
|
|||
*/
|
||||
public static byte[] getClassFileBytes(Class<?> clazz) throws IOException
|
||||
{
|
||||
try (InputStream is = clazz.getResourceAsStream("/" + clazz.getName().replace('.', '/') + ".class"); ByteArrayOutputStream baos = new ByteArrayOutputStream())
|
||||
try (InputStream is = clazz.getResourceAsStream("/" + clazz.getName().replace('.', '/') + ".class");
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream())
|
||||
{
|
||||
int r;
|
||||
byte[] buffer = new byte[8192];
|
||||
|
|
|
@ -48,7 +48,9 @@ public class Dex2Jar
|
|||
{
|
||||
try
|
||||
{
|
||||
Dex2jar d2Jar = Dex2jar.from(input).computeFrames(true).withExceptionHandler(new DexExceptionHandler()
|
||||
Dex2jar d2Jar = Dex2jar.from(input)
|
||||
.computeFrames(true)
|
||||
.withExceptionHandler(new DexExceptionHandler()
|
||||
{
|
||||
public void handleFileException(Exception e)
|
||||
{
|
||||
|
@ -60,6 +62,7 @@ public class Dex2Jar
|
|||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
d2Jar.to(output.toPath());
|
||||
}
|
||||
catch (DexException e)
|
||||
|
@ -87,7 +90,10 @@ public class Dex2Jar
|
|||
{
|
||||
try
|
||||
{
|
||||
Jar2Dex.main(input.getAbsolutePath(), "-f", "-o", output.getAbsolutePath(), "-s", BytecodeViewer.viewer.getMinSdkVersion() + "");
|
||||
Jar2Dex.main(input.getAbsolutePath(), "-f",
|
||||
"-o", output.getAbsolutePath(),
|
||||
"-s", String.valueOf(BytecodeViewer.viewer.getMinSdkVersion()));
|
||||
|
||||
if (delete)
|
||||
input.delete();
|
||||
}
|
||||
|
@ -96,5 +102,4 @@ public class Dex2Jar
|
|||
BytecodeViewer.handleException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -125,7 +125,6 @@ public class DialogUtils
|
|||
int returnVal = fc.showOpenDialog(BytecodeViewer.viewer);
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION)
|
||||
{
|
||||
|
||||
File file = fc.getSelectedFile();
|
||||
onOpen.onOpen(file);
|
||||
return file;
|
||||
|
|
|
@ -45,14 +45,17 @@ public class EncodeUtils
|
|||
{
|
||||
out.append("\\u");
|
||||
String str = Integer.toHexString(bytes[i + 1] & 0xff);
|
||||
|
||||
for (int j = str.length(); j < 2; j++)
|
||||
{
|
||||
out.append("0");
|
||||
}
|
||||
|
||||
String str1 = Integer.toHexString(bytes[i] & 0xff);
|
||||
out.append(str1);
|
||||
out.append(str);
|
||||
}
|
||||
|
||||
return out.toString();
|
||||
}
|
||||
catch (UnsupportedEncodingException e)
|
||||
|
@ -68,6 +71,7 @@ public class EncodeUtils
|
|||
Pattern pattern = Pattern.compile("(\\\\u(\\p{XDigit}{4}))");
|
||||
Matcher matcher = pattern.matcher(str);
|
||||
char ch;
|
||||
|
||||
while (matcher.find())
|
||||
{
|
||||
String group = matcher.group(2);
|
||||
|
@ -75,15 +79,15 @@ public class EncodeUtils
|
|||
String group1 = matcher.group(1);
|
||||
str = str.replace(group1, ch + "");
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
public static String convertStringToUTF8(String s)
|
||||
{
|
||||
if (s == null || StringUtils.EMPTY.equals(s))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
try
|
||||
{
|
||||
|
@ -91,14 +95,13 @@ public class EncodeUtils
|
|||
for (int i = 0; i < s.length(); i++)
|
||||
{
|
||||
c = s.charAt(i);
|
||||
|
||||
if (c <= 255)
|
||||
{
|
||||
sb.append(c);
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] b;
|
||||
b = Character.toString(c).getBytes(StandardCharsets.UTF_8);
|
||||
byte[] b = Character.toString(c).getBytes(StandardCharsets.UTF_8);
|
||||
|
||||
for (int value : b)
|
||||
{
|
||||
int k = value;
|
||||
|
@ -112,19 +115,21 @@ public class EncodeUtils
|
|||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String convertUTF8ToString(String s)
|
||||
{
|
||||
if (s == null || StringUtils.EMPTY.equals(s))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
s = s.toUpperCase();
|
||||
|
||||
int total = s.length() / 2;
|
||||
int pos = 0;
|
||||
byte[] buffer = new byte[total];
|
||||
|
||||
for (int i = 0; i < total; i++)
|
||||
{
|
||||
int start = i * 2;
|
||||
|
|
|
@ -72,9 +72,7 @@ public class JTextAreaUtils
|
|||
}
|
||||
|
||||
if (currentLine == startLine)
|
||||
{
|
||||
canSearch = true;
|
||||
}
|
||||
else if (s.contains(search))
|
||||
{
|
||||
if (canSearch)
|
||||
|
@ -93,13 +91,12 @@ public class JTextAreaUtils
|
|||
}
|
||||
|
||||
if (!found && firstPos != -1)
|
||||
{
|
||||
textArea.setCaretPosition(textArea.getDocument().getDefaultRootElement().getElement(firstPos - 1).getStartOffset());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
canSearch = true;
|
||||
|
||||
for (String s : test)
|
||||
{
|
||||
if (!caseSensitiveSearch)
|
||||
|
@ -123,9 +120,7 @@ public class JTextAreaUtils
|
|||
}
|
||||
|
||||
if (lastGoodLine != -1 && textArea.getDocument().getDefaultRootElement().getElementIndex(textArea.getCaretPosition()) + 1 == startLine)
|
||||
{
|
||||
textArea.setCaretPosition(textArea.getDocument().getDefaultRootElement().getElement(lastGoodLine - 1).getStartOffset());
|
||||
}
|
||||
}
|
||||
|
||||
highlight(textArea, search, caseSensitiveSearch);
|
||||
|
@ -161,8 +156,7 @@ public class JTextAreaUtils
|
|||
// Search for pattern
|
||||
while ((pos = text.indexOf(pattern, pos)) >= 0)
|
||||
{
|
||||
// Create highlighter using private painter and apply around
|
||||
// pattern
|
||||
// Create highlighter using private painter and apply around pattern
|
||||
highlighter.addHighlight(pos, pos + pattern.length(), PAINTER);
|
||||
pos += pattern.length();
|
||||
}
|
||||
|
|
|
@ -51,9 +51,7 @@ public class LazyNameUtil
|
|||
return FilenameUtils.removeExtension(name) + "#" + seqAndCount.getSeq() + "." + FilenameUtils.getExtension(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
NAME_MAP.put(name, SeqAndCount.init());
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user