首页
社区
课程
招聘
1
[原创] 看雪 ctf 攻防战 2018 - 交响曲
发表于: 2018-12-11 09:16 3029

[原创] 看雪 ctf 攻防战 2018 - 交响曲

aqs 活跃值
5
2018-12-11 09:16
3029

android 题目
下了个最新版的 dex2jar 转成 java 在 jd-gui 上看

逻辑还是挺清晰的, 输入一个字符串然后判断正确与否的形式,有回显
总体流程如下

下面一个一个看

c() 函数主要就是获取输入的字符串,并分段进行检验,结合后面的函数可以知道输入大概是
jjjjiihhmmmmmm
具体的校验如下

hh : 两个字符, 转换成 int [1,31]
mmmmmm 需要看后面的函数
上面的 e(), f(),g(),h() 函数分别是对这四个字段的变换
e() ==> jjjj
f() ==> ii
g() ==> hh
h() ==> mmmmmmm
大概都是差不多的形式,定义了一个 表,然会将输入的字段作为index 查表做返回值,比如 e()

(jjjj-1900)%60 作为 index , d[index] 作为返回值
mmmmmm 根据h() 函数可以确定是一个字符串,是一个表里面的值

最后的 checker 检查的是 e()+f()+g()+h() 返回值是否 等于 34

到了这里其实已经可以解了,因为输入的字段的搜索空间都不会很大
2007-1983=24,len(m)=12
24*12*31*12 完全可以写个脚本爆破一下
也可以人力的算一下,之前写的脚本丢了,上班摸鱼就先写到这里吧,后面的大家都懂了:)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
private void a()
{
  try
  {
    c();
    if ((this.j != 0) && (this.i != 0) && (this.h != 0))
    {
      d();
      a(e() + f() + g() + h());
      return;
    }
    this.n.setText(getString(2131427370));
  }
  catch (Exception localException)
  {
    this.n.setText(getString(2131427370));
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
private void c()
{
  try
  {
    String str1 = ((EditText)findViewById(2131165227)).getText().toString();
    this.j = 0;
    this.i = 0;
    this.h = 0;
    // input[0:4]
    if (str1.length() > 4) {
      str2 = str1.substring(0, 4);
    } else {
      str2 = str1;
    }
    this.j = Integer.parseInt(str2);
    if ((this.j > 0) && (this.j < 189)) {
      this.j = 0;
    }
    if ((this.j <= 1983) || (this.j >= 2007)) {
      this.j = 0;
    }
    //input[4:6]
    if (str1.length() > 6) {
      str2 = str1.substring(4, 6);
    } else {
      str2 = str1;
    }
    this.i = Integer.parseInt(str2);
    if ((this.i < 1) || (this.i > 12)) {
      this.i = 0;
    }
    String str2 = str1;
      //input[6:8]
    if (str1.length() > 8) {
      str2 = str1.substring(6, 8);
    }
    this.h = Integer.parseInt(str2);
    if ((this.h < 1) || (this.h > 31)) {
      this.h = 0;
    }
  }
  catch (Exception localException)
  {
    this.n.setText(getString(2131427370));
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
private int e()
{
  try
  {
    int i1 = this.g;
    i1 = this.d[((i1 - 1900) % 60)];
    return i1;
  }
  catch (Exception localException)
  {
    this.n.setText(getString(2131427370));
  }
  return 0;
}

[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课

收藏
免费 1
支持
分享
赞赏记录
参与人
雪币
留言
时间
PLEBFE
为你点赞~
2023-2-1 00:37
最新回复 (0)
游客
登录 | 注册 方可回帖
返回

账号登录
验证码登录

忘记密码?
没有账号?立即免费注册