fargoChen / androguard

Automatically exported from code.google.com/p/androguard
0 stars 0 forks source link

add method to get class source #53

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago

The current implementation provides methods to get source of a class methods 
but not a method to get source of the entire class. This method should be 
useful to get variables assigned during construction.
e.g. 
public class Actor
{
    public static final String AB_ID = "289";
    public static final String AM_ID = "283";
    public static final String AZ_ID = "400";
    public static final String BEELINE_ID = "99";
    public static final String BELLORUS_ID = "257";
    public static final String BWC_ID = "12";
    public static boolean IS_MF;
    public static final String KCEL_ID = "02";
    public static final String KY_ID = "437";
    public static final String KZ_ID = "401";
    public static final String MD_ID = "259";
    public static final String MGF_ID = "02";
    public static final String MTS_BY = "02";
    public static final String MTS_ID = "01";
    public static final String NET_OP = "NET_OP";
    private static final String NEW_INIT = "new";
    public static String NUMBER1;
    public static String NUMBER10;
    public static String NUMBER3;
    public static String NUMBER5;
    public static final String PAYED_KEY = "PAYED_KEY";
    public static final String PAYED_NO = "NO";
    public static final String PAYED_YES = "YES";
    public static String PORT_PREF;
    public static final String PRIVATE = "999";
    public static final String RF_ID = "250";
    public static final String SENDED = "SENDED";
    public static final String SENDED_SMS_COUNTER_KEY = "SENDED_SMS_COUNTER_KEY";
    public static final String SMS_DATA_KEY = "SMS_DATA_KEY";
    public static int STATUS;
    public static final int TIMEOUT_SECONDS = 30;
    public static final String TL2_ID = "20";
    public static final String UK_ID = "255";
    private static final String URL = "URL";
    private static String USED_SCHEME;
    public static final String otherID = "10000";
    private HashMap actSchemes;
    private String app_name;
    private String content;
    private String countryCode;
    private String currentOp;
    private String firstText;
    private int goodSended;
    private Context mContext;
    private String operatorCode;
    private Pair schemes;
    private String secondText;
    private boolean sendImmediately;
    private int sended;
    private SharedPreferences settings;
    private HashMap texts;
    private boolean wasActError;

    static
    {

        USED_SCHEME = "999";
        IS_MF = false;
        NUMBER10 = "3855";
        NUMBER1 = "7151";
        NUMBER3 = "8151";
        NUMBER5 = "2855";
        PORT_PREF = "70688";
    }

Original issue reported on code.google.com by liadalex82@gmail.com on 26 Jun 2012 at 4:21

GoogleCodeExporter commented 8 years ago
Hi,

you can get the source of an entire class:

In [3]: d.CLASS_Ltests_androguard_TestIfs.source()
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   TestIfs.java

package tests.androguard;

import java.io.PrintStream;

public class TestIfs
{

    public TestIfs()
    {
    }

    public static int testIF(int i)
    {
        int j;
        if(i > 0)
            j = i * 2;
        else
            j = i + 2;
        return j;
    }

    public static int testIF2(int i)
    {
        int j;
        if(i > 0)
            j = i * 2;
        else
            j = i + 2;
        return j;
    }
....

Original comment by anthony....@gmail.com on 27 Jun 2012 at 7:14