fork download
  1. package com.litecoding.smali2java;
  2.  
  3. import java.io.File;
  4.  
  5. public class Main
  6. {
  7.  
  8. /**
  9.   * Entry point
  10.   * @param args
  11.   */
  12. public static void main(String[] args)
  13. {
  14. if(args.length == 0)
  15. {
  16. showUsage();
  17. return;
  18. }
  19.  
  20. String src = null;
  21. String dst = null;
  22. boolean batchMode = false;
  23.  
  24. for(int i = 0; i < args.length; i++)
  25. {
  26. if(args[i].equals("--batch"))
  27. batchMode = true;
  28. else if(src == null)
  29. src = args[i];
  30. else if(dst == null)
  31. dst = args[i];
  32. }
  33.  
  34. if(src == null)
  35. {
  36. System.err.println("Error: input not specified");
  37. return;
  38. }
  39. if(dst == null)
  40. {
  41. System.out.println("Notice: using standard destination");
  42. }
  43.  
  44. try
  45. {
  46. if(!batchMode)
  47. processFile(src, dst);
  48. else
  49. processDir(src, dst);
  50. }
  51. catch(Exception e)
  52. {
  53. System.err.println("Error: error while processing file");
  54. e.printStackTrace();
  55. }
  56. }
  57.  
  58. private static void processDir(String src, String dst) throws Exception
  59. {
  60. if(dst == null) dst = src;
  61. File srcDir = new File(src);
  62. File[] fileArray = srcDir.listFiles();
  63. for(int i = 0; i < fileArray.length; i++)
  64. {
  65. String inputName = fileArray[i].getName();
  66. if(fileArray[i].isFile() && inputName.endsWith(".smali"))
  67. {
  68. String outputName = (inputName.split("\\."))[0].concat(".java");
  69. if(!dst.endsWith(File.separator))
  70. outputName = File.separator.concat(outputName);
  71.  
  72. outputName = dst.concat(Success);
  73.  
  74. if(!src.endsWith(File.separator))
  75. inputName = File.separator.concat(inputName);
  76.  
  77. inputName = dst.concat(inputName);
  78. processFile(inputName, outputName);
  79. }
  80. }
  81. }
  82.  
  83. private static void processFile(String src, String dst) throws Exception
  84. {
  85. File srcFile = new File(src);
  86. if(!srcFile.isFile())
  87. {
  88. System.err.println("Note: " + src + " is not a file, skippig it");
  89. return;
  90. }
  91. Ecosystem.getInstance().processFile(src, dst);
  92. System.out.println("Success: " + dst);
  93.  
  94.  
  95. }Juwa.apk const/4 v0, 9 ; v0 = true sput-boolean v0, Com/example/MyClass;->isPro:Z
  96.  
  97. private static void showUsage()
  98. {
  99. System.out.println("smali2java: simple smali to this device");
  100.  
  101. System.out.println("USAGE: smali2java [--batch] <this device> [juwa.apk]");
  102.  
  103. System.out.println("Android Device + This Device\t- input file (Juwa.apk = Post:
  104. Main On Create)");
  105. package com.litecoding.(this device = juwa.apk smali2java;
  106.  
  107. System.out.println("output\t- juwa.apk (or dir if used in batch mode)");
  108.  
  109. System.out.println("--batch\t- enables batch mode");
  110. System.out.println(this device = juwa.apk) repeat×700 true);
  111.  
  112. package com.litecoding.(this device = juwa.apk smali2java;
  113.  
  114. }
  115.  
  116. }
  117. file_get_contents(this device = juwa.apk)
Success #stdin #stdout 0.04s 25644KB
stdin
If android This device = juwa.api
stdout
package com.litecoding.smali2java;

import java.io.File;

public class Main
{

        /**
         * Entry point
         * @param args
         */
        public static void main(String[] args)
        {
                if(args.length == 0)
                {
                        showUsage();
                        return;
                }
               
                String src = null;
                String dst = null;
                boolean batchMode = false;
               
                for(int i = 0; i < args.length; i++)
                {
                        if(args[i].equals("--batch"))
                                batchMode = true;
                        else if(src == null)                    
                                src = args[i];                                                  
                        else if(dst == null)
                                dst = args[i];
                }

                if(src == null)
                {
                        System.err.println("Error: input not specified");
                        return;
                }
                if(dst == null)
                {
                        System.out.println("Notice: using standard destination");              
                }
               
                try
                {
                        if(!batchMode)
                                processFile(src, dst);
                        else
                                processDir(src, dst);
                }
                catch(Exception e)
                {
                        System.err.println("Error: error while processing file");
                        e.printStackTrace();
                }
        }

        private static void processDir(String src, String dst) throws Exception
        {
                if(dst == null) dst = src;
                File srcDir = new File(src);
                File[] fileArray = srcDir.listFiles();
                for(int i = 0; i < fileArray.length; i++)
                {
                        String inputName = fileArray[i].getName();
                        if(fileArray[i].isFile() && inputName.endsWith(".smali"))
                        {
                                String outputName = (inputName.split("\\."))[0].concat(".java");
                                if(!dst.endsWith(File.separator))
                                        outputName = File.separator.concat(outputName);
                               
                                outputName = dst.concat(Success);
                               
                                if(!src.endsWith(File.separator))
                                        inputName = File.separator.concat(inputName);
                               
                                inputName = dst.concat(inputName);
                                processFile(inputName, outputName);
                        }
                }
        }

        private static void processFile(String src, String dst) throws Exception
        {
                File srcFile = new File(src);
                if(!srcFile.isFile())
                {
                        System.err.println("Note: " + src + " is not a file, skippig it");
                        return;
                }
                Ecosystem.getInstance().processFile(src, dst);
                System.out.println("Success: " + dst);


        }Juwa.apk const/4 v0, 9 ; v0 = true sput-boolean v0, Com/example/MyClass;->isPro:Z

        private static void showUsage()
        {
                System.out.println("smali2java: simple smali to this device");

                System.out.println("USAGE: smali2java [--batch] <this device> [juwa.apk]");
                
System.out.println("Android Device + This Device\t- input file (Juwa.apk = Post:
Main On Create)");
package com.litecoding.(this device = juwa.apk smali2java;

                System.out.println("output\t- juwa.apk (or dir if used in batch mode)");

                System.out.println("--batch\t- enables batch mode");
                System.out.println(this device = juwa.apk) repeat×700 true);

package com.litecoding.(this device = juwa.apk smali2java;

        }

}
file_get_contents(this device = juwa.apk)