[ACTF新生赛2020]usualCrypt

  1. 用IDA打开
    1

2

3

  1. 现将混淆复原

    4

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    #include<stdio.h>
    #include<string.h>
    #include<stdlib.h>
    int main(){
    char byte_40E0AA[] = "KLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
    char byte_40E0A0[] = "ABCDEFGHIJ";
    int result; // eax
    char v1; // cl

    for ( result = 6; result < 15; ++result )
    {
    v1 = byte_40E0AA[result];
    byte_40E0AA[result] = byte_40E0A0[result];
    byte_40E0A0[result] = v1;
    }

    printf("%s\n",byte_40E0A0);
    printf("%s", byte_40E0AA);
    }

    发现一个问题,byte_40E0A0[]只有10到不来15,所以要改进一下

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    #include<stdio.h>
    #include<string.h>
    #include<stdlib.h>
    int main(){
    char byte_40E0AA[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
    int result; // eax
    char v1; // cl

    for ( result = 6; result < 15; ++result )
    {
    v1 = byte_40E0AA[result];
    byte_40E0AA[result] = byte_40E0AA[result+10];
    byte_40E0AA[result+10] = v1;
    }
    printf("%s", byte_40E0AA);
    }
    1
    ABCDEFQRSTUVWXYPGHIJKLMNOZabcdefghijklmnopqrstuvwxyz0123456789+/
  2. 将大小写复原

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    #include<stdio.h>
    #include<string.h>
    #include<stdlib.h>
    int main(){
    char v2[] = "zMXHz3TIgnxLxJhFAdtZn2fFk3lYCrtPC2l9" ;
    int i,j;
    char v1[strlen(v2)];
    for(i = 0;i < strlen(v2); i++){
    if ( (v2[i] < 97 || v2[i] > 122) && (v2[i] < 65 || v2[i] > 90) )
    {

    v1[i] = v2[i];
    }
    else if(v2[i] < 97 || v2[i] > 122){
    v1[i] = v2[i] + 32;
    }
    else
    {
    v1[i] = v2[i] - 32;
    }
    }

    printf("%s",v1);
    }
    1
    ZmxhZ3tiGNXlXjHfaDTzN2FfK3LycRTpc2L9
    1. 最后用在线网站解码

      5

      1
      flag{bAse64_h2s_a_Surprise}