Android Question Development of obfuscator

Discussion in 'Android Questions' started by carlos7000, Nov 16, 2018.

  1. carlos7000

    carlos7000 Active Member Licensed User

    Hi all

    Seeing the obfuscated code of other programs ...

    An example:
    class C0124t {
        /* renamed from: a */
        final /* synthetic */ C0119p f3067a;
        /* renamed from: b */
    private final String f3068b;
        /* renamed from: c */
    private final float f3069c;
        /* renamed from: d */
    private final float f3070d;
        /* renamed from: e */
    private final C0120u f3071e;

    public C0124t(C0119p c0119p, String str, float f, float f2, C0120u c0120u) {
            this.f3067a = c0119p;
            this.f3068b = str;
            this.f3069c = f;
            this.f3070d = f2;
            this.f3071e = c0120u;

        /* renamed from: a */
        public void m2469a() {
            this.f3067a.f3055W.m704a(0.8f, 0.8f, 0.8f, 1.0f);
            this.f3067a.f3055W.m701a(0.9f - (0.15f * MathUtils.m1317b(6.2831855f * ((0.5f * this.f3067a.f3040H) - this.f3070d))));
            this.f3067a.m2441a(this.f3068b, this.f3067a.f3055W, this.f3069c);

        /* renamed from: a */
        public boolean m2470a(Vector2 vector2) {
            if (vector2.f1634g < 90.0f || vector2.f1634g > 150.0f || vector2.f1635h < this.f3069c - 10.0f || vector2.f1635h >= this.f3069c + 20.0f) {
                return false;
            return true;
    ... ask me, how good was the b4a obfuscation?

    Decompile some of the programs that I have done and I am surprised that only the names of the functions and some variables were obfuscated, leaving the rest of the code completely exposed

    An example of this is the following example project.

    This is the sample source code

    #Region  Project Attributes
    #ApplicationLabel: B4A Example
    #VersionCode: 1
    'SupportedOrientations possible values: unspecified, landscape or portrait.
        #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
    #End Region

    #Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
    #End Region

    Sub Process_Globals
    'These global variables will be declared once when the application starts.
        'These variables can be accessed from all modules.

    End Sub

    Sub Globals
    'These global variables will be redeclared each time the activity is created.
        'These variables can only be accessed from this module.

    Private EditText_eMail As EditText
    Private EditText_Password As EditText
    Private ButtonGetApiKeys As Button
    Private LabelApiKey As Label
    Private LabelApiSecret As Label
    Dim x_eMail As String
    Dim x_PassWord As String   
    End Sub

    Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:

    End Sub

    Sub Activity_Resume

    End Sub

    Sub Activity_Pause (UserClosed As Boolean)

    End Sub

    Sub EditText_eMail_TextChanged (Old As String, New As String)
    End Sub

    Sub EditText_Password_TextChanged (Old As String, New As String)
    End Sub

    Sub ButtonGetApiKeys_Click
        LabelApiKey.Text = GetApiKey(EditText_eMail.Text)
        LabelApiSecret.Text = GetApiSecret(EditText_eMail.Text)
    End Sub

    Public Sub GetApiKey(eMail As StringAs String
    Dim ApiKey As String   
        ApiKey = 
    Return ApiKey
    End Sub

    Public Sub GetApiSecret(eMail As StringAs String
    Dim ApiSecret As String   
        ApiSecret = 
    Return ApiSecret
    End Sub

    Public Sub Validate(Value As StringAs Boolean
    Return True
    End Sub
    Attached obfuscated apk file. you will find it below.

    By decompiling the attached file, you can clearly see the following:

    public static String _x_email = "";
    public static String _x_password = "";
    public ButtonWrapper _buttongetapikeys = null'button name is visible
    public EditTextWrapper _edittext_email = null'editText name is visible
    public EditTextWrapper _edittext_password = null'editText name is visible
    public LabelWrapper _labelapikey = null'Label name is visible
    public LabelWrapper _labelapisecret = null'Label name is visible
    The name of the event that requests the keys is clearly legible

    public static String _buttongetapikeys_click() throws Exception {
    return "";
    public static String _edittext_email_textchanged(String str, String str2) throws Exception {
    return "";
    public static String _edittext_password_textchanged(String str, String str2) throws Exception {
    return "";
    The names of the other functions and variables, if they were obfuscated

    I want to know if it is possible for someone to help me with the development of an obfuscator.

    I do not know if it will be very difficult, but I want to develop an obfuscator that can rename all labels, buttons, listViews, functions, panels, etc.

    I would greatly appreciate your help.

    I also attach the source of the project, and the result of the decompilation of the apk.

    Attached Files:

    Last edited: Nov 17, 2018
  2. JohnK

    JohnK Active Member Licensed User

    from what I have seen, the built-in obfuscator also obfuscates variables. Although, you are correct in that there are many things not being obfuscated.

    Although, I think you may be better off to highlight what is not being obfuscated as a bug in the appropriate forum, rather than building one from scratch.
  3. carlos7000

    carlos7000 Active Member Licensed User

    I did not think that not to obfuscate the names of the buttons or labels could be an error. If there is a suitable forum, please provide me with the link.

  4. Peter Simpson

    Peter Simpson Expert Licensed User

  5. JohnK

    JohnK Active Member Licensed User

  6. Cableguy

    Cableguy Expert Licensed User

    I don't think this would be too difficult to pull of.
    I mean, in my head, I see it working like this...
    1. User creates a program, not obfuscated
    2. Obfuscation program search for keywords like "as button" and add it to a map... Then generates as many random strings as needed, and finally replaces the values
    3. User loads and tries out the obfuscated code and if all is ok, compile

    Of course, this is a simplistic view of the process...
  7. Computersmith64

    Computersmith64 Well-Known Member Licensed User

    Erel has written an obfuscation tutorial here that might help you better understand what does / doesn't get obfuscated in B4A.

    - Colin.
    Erel likes this.
  8. carlos7000

    carlos7000 Active Member Licensed User

    I already visited the link, and I read it all, I think I understood almost everything. I still think that it is possible to rename labes, buttons and other things.

  9. carlos7000

    carlos7000 Active Member Licensed User

    Yes, that is more or less the idea that I have.

  10. carlos7000

    carlos7000 Active Member Licensed User

    Peter Simpson likes this.
  11. Erel

    Erel Administrator Staff Member Licensed User

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice