首页
社区
课程
招聘
[原创]看雪CTF.TSRC 2018 团队赛 第五题 交响曲 wp
2018-12-9 15:40 2146

[原创]看雪CTF.TSRC 2018 团队赛 第五题 交响曲 wp

2018-12-9 15:40
2146
JEB 撸出源码:
public class CrackMe extends AppCompatActivity {
    int[] a;
    int[] b;
    int[] c;
    int[] d;
    int e_day;
    int f_month;
    int g_year;
    int h;
    int i;
    int j;
    int k;
    String[] l;
    String[] m;
    TextView n;

    public CrackMe() {
        super();
        this.a = new int[]{16, 6, 7, 10, 9, 16, 10, 8, 8, 9, 6, 6};
        this.b = new int[]{5, 10, 8, 15, 16, 15, 8, 16, 8, 16, 9, 17, 8, 17, 10, 8, 9, 18, 5, 15, 10, 9, 8, 9, 15, 18, 7, 8, 16, 6};
        this.c = new int[]{6, 7, 18, 9, 5, 16, 9, 15, 18, 8, 9, 5};
        this.d = new int[]{7, 7, 9, 12, 8, 7, 13, 5, 14, 5, 9, 17, 5, 7, 12, 8, 8, 6, 19, 6, 8, 16, 10, 6, 12, 9, 6, 7, 12, 5, 9, 8, 7, 8, 15, 9, 16, 8, 8, 19, 12, 6, 8, 7, 5, 15, 6, 16, 15, 7, 9, 12, 10, 7, 15, 6, 5, 14, 14, 9};
        this.l = new String[73];
        this.m = new String[]{"23to01", "01to03", "03to05", "05to07", "07to09", "09to11", "11to13", "13to15", "15to17", "17to19", "19to21", "21to23"};
    }

    private void a() {
        int v0 = 2131427370;
        try {
            this.c();
            if(this.j != 0 && this.i != 0 && this.h != 0) {
                this.d();
                this.a(this.e() + this.f() + this.g() + this.h());
                return;
            }

            this.n.setText(this.getString(v0));
        }
        catch(Exception ) {
            this.n.setText(this.getString(v0));
        }
    }

    private void a(int arg8) {
        int v0 = 2131427370;
        int v1 = 34;
        if(arg8 <= v1) {
            if(arg8 < v1) {
            }
            else {
                try {
                    this.n.setText(String.format("%s%s", this.getString(2131427369), this.l[arg8]));
                    this.findViewById(2131165273).setEnabled(false);
                    return;
                label_23:
                    this.n.setText(this.getString(v0));
                }
                catch(Exception ) {
                    this.n.setText(this.getString(v0));
                }

                return;
            }
        }

        goto label_23;
    }

    static void a(CrackMe arg0) {
        arg0.a();
    }

    private void b() {
        int v0;
        for(v0 = 0; v0 <= 72; ++v0) {
            this.l[v0] = v0 != 34 ? this.getResources().getString(2131427374) : this.getResources().getString(2131427375);
        }
    }

    private void c() {
        int v0 = 2131165227;
        try {
            String v0_1 = this.findViewById(v0).getText().toString();
            this.j = 0;
            this.i = 0;
            this.h = 0;
            int v3 = 4;
            String v2 = v0_1.length() > v3 ? v0_1.substring(0, v3) : v0_1;
            this.j = Integer.parseInt(v2);
            if(this.j > 0 && this.j < 189) {
                this.j = 0;
            }

            if(this.j <= 1983 || this.j >= 2007) {
                this.j = 0;
            }

            int v4 = 6;
            v2 = v0_1.length() > v4 ? v0_1.substring(v3, v4) : v0_1;
            this.i = Integer.parseInt(v2);
            if(this.i < 1 || this.i > 12) {
                this.i = 0;
            }

            int v5 = 8;
            if(v0_1.length() > v5) {
                v0_1 = v0_1.substring(v4, v5);
            }

            this.h = Integer.parseInt(v0_1);
            if(this.h >= 1 && this.h <= 31) {
                return;
            }

            this.h = 0;
        }
        catch(Exception ) {
            this.n.setText(this.getString(2131427370));
        }
    }

    private void d() {
        try {
            if(this.j == 1989 || this.j == 2004) {
                this.h = 31;
            }

            if(this.i == 1 || this.i == 4 || this.i == 5 || this.i == 7 || this.i == 10 || this.i == 11 || this.i == 12) {
                this.j = 1999;
            }

            int v2 = 8;
            int v3 = 6;
            int v4 = 2;
            if(this.j <= 1994 && (this.i == v4 || this.i == v3 || this.i == v2)) {
                this.i = 3;
            }

            if(this.j >= 1996 && (this.i == v4 || this.i == v3 || this.i == v2)) {
                this.i = 9;
            }

            if(this.j == 1995 && (this.h > this.i + v4 || this.i == this.h)) {
                this.i = v3;
            }

            this.g_year = this.j;
            this.f_month = this.i;
            this.e_day = this.h;
        }
        catch(Exception ) {
            this.n.setText(this.getString(2131427370));
        }
    }

    private int e() {
        try {
            return this.d[(this.g_year - 1900) % 60];
        }
        catch(Exception ) {
            this.n.setText(this.getString(2131427370));
            return 0;
        }
    }

    private int f() {
        try {
            return this.c[this.f_month - 1];
        }
        catch(Exception ) {
            this.n.setText(this.getString(2131427370));
            return 0;
        }
    }

    private int g() {
        try {
            return this.b[this.e_day - 1];
        }
        catch(Exception ) {
            this.n.setText(this.getString(2131427370));
            return 0;
        }
    }

    private int h() {
        int v0 = 2131165227;
        int v1 = 2131427370;
        try {
            String v0_1 = this.findViewById(v0).getText().toString();
            v0_1 = v0_1.substring(8, v0_1.length());
            int v3 = this.f_month;
            int v4 = 0;
            while(true) {
                if(v4 >= this.m.length) {
                    break;
                }
                else if(v0_1.equals(this.m[v4])) {
                    if(v3 == 2 && (v0_1.equals(this.m[6]))) {
                        return 63;
                    }

                    this.k = this.a[v4];
                    v0 = 1;
                }
                else {
                    ++v4;
                    continue;
                }

                goto label_35;
            }

            v0 = 0;
        label_35:
            if(v0 == 0) {
                this.n.setText(this.getString(v1));
            }

            return this.k;
        }
        catch(Exception ) {
            this.n.setText(this.getString(v1));
            return 0;
        }
    }

    protected void onCreate(Bundle arg2) {
        super.onCreate(arg2);
        this.setContentView(2131296284);
        this.b();
        this.n = this.findViewById(2131165242);
        this.findViewById(2131165273).setOnClickListener(new View$OnClickListener() {
            public void onClick(View arg3) {
                try {
                    CrackMe.a(this.a);
                }
                catch(Exception ) {
                    this.a.n.setText(this.a.getString(2131427370));
                }
            }
        });
    }
}


c函数检测判断前四位的年份是否在1984-2007之间,月份是否是01-12  日期是否在01-31 之间
d函数根据输入的年月日生成新的年月日
e函数根据新的年获取一个数 this.d[(this.g_year - 1900) % 60];
f函数返回月份对应的值
g函数返回日期对应的值
h函数判断月份 后8位之后的字符串,返回一个值
这几个值相加等于34就ok了

python爆破脚本:
b_ary_day = [5, 10, 8, 15, 16, 15, 8, 16, 8, 16, 9, 17, 8, 17, 10, 8, 9, 18, 5, 15, 10, 9, 8, 9, 15, 18, 7, 8, 16, 6];
c_ary_month = [6, 7, 18, 9, 5, 16, 9, 15, 18, 8, 9, 5]
d_ary_year = [7, 7, 9, 12, 8, 7, 13, 5, 14, 5, 9, 17, 5, 7, 12, 8, 8, 6, 19, 6, 8, 16, 10, 6, 12, 9, 6, 7, 12, 5, 9, 8, 7, 8, 15, 9, 16, 8, 8, 19, 12, 6, 8, 7, 5, 15, 6, 16, 15, 7, 9, 12, 10, 7, 15, 6, 5, 14, 14, 9]

m_strList=["23to01", "01to03", "03to05", "05to07", "07to09", "09to11", "11to13", "13to15", "15to17", "17to19", "19to21", "21to23"]
a_ary = [16, 6, 7, 10, 9, 16, 10, 8, 8, 9, 6, 6]


#c 函数
def checkData(year,month,day):
    if year<0 and year<189:
        return False
    if year<=1983 or year>2007:
        return False
    if month<1 or month>12:
        return False
    if day>=1 and day<=31:
        return True
    return False

#d 函数
def d_dayCheck(year,month,day):
    ret_year=0
    ret_month=0
    ret_day=0
    if year==1989 or year==2004:
        day=31
    if month==1 or month==4 or month==5 or month==7 or month==10 or month==11 or month==12:
        year=1999
    if year<=1994 and (month==2 or month==6 or month==8):
        month=3
    if year>=1996 and (month==2 or month==6 or month==8):
        month=9
    if year==1995 and (day>(2+month) or month==day):
        month=6
    ret_year=year
    ret_month=month
    ret_day=day
    #print "xx"
    return ret_year,ret_month,ret_day

#h函数
def check4(month,strxx):
    #print month,strxx
    v4=0
    v0=0
    k=0
    for i,x in enumerate(m_strList):
        if strxx==x:
            if month==2 and strxx==m_strList[6]:
                k=63
            else:
                k=a_ary[i]
    return k                

            
           
for y in xrange(1984,2008):
    for m in xrange(1,13):
        for d in xrange(1,32):
            for x in m_strList:
                #print y,m,d,checkData(y,m,d)
                if checkData(y,m,d):
                    n_y,n_m,n_d=d_dayCheck(y,m,d)
                    num1=d_ary_year[(n_y-1900)%60]
                    num2=c_ary_month[n_m-1]
                    if n_d>=30:
                        continue
                    num3=b_ary_day[n_d-1]
                    num4=check4(m,x)                    
                    if num1+num2+num3+num4==34:
                        if y==n_y and n_m==m and n_d==d:
                            print n_y,n_m,n_d,num1,num2,num3,num4
                            print y,m,d,x
                            print "key:%04d%02d%02d%s"%(y,m,d,x)
                    
            




输出:1995020305to07

[培训]《安卓高级研修班(网课)》月薪三万计划,掌握调试、分析还原ollvm、vmp的方法,定制art虚拟机自动化脱壳的方法

收藏
点赞1
打赏
分享
最新回复 (0)
游客
登录 | 注册 方可回帖
返回