moectf2020 write up for 赤道企鹅,永远滴神

感觉这一题其实比上一题简单,但是分倒是比上一题多XD

直接逐个字符匹配一遍就行,时间复杂度O(N)

以及文件读写还是Java写的方便(咱不会python…qwq

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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import java.util.*;
import java.lang.*;
import java.io.*;

public class Test
{

public static int searchString(String path)
{
File file = new File(path);
int num = 0;

if(file.isDirectory())//if the variable "file" is a directory, files in it will be searched in recursion
{
boolean exist = false;
File[] files = file.listFiles();

for(File f:files)
{
num += searchString(path+"\\"+f.getName());
}
return num;
}
else
{
try (FileInputStream fileInputStream = new FileInputStream(file))
{
int c, index = 0;
boolean pd = false;
char[] eqqie = {'E','q','q','i','e','N','B','!'};
while(true)//EOF
{
c = fileInputStream.read();
if(index<8)
{
if(c == eqqie[index])
{
index++;
continue;
}
else
return 0;
}
if((c>='A'&&c<='Z')||(c>='a'&&c<='z')||(c>='0'&&c<='9'))
{
pd = true;
}
else
{
if(pd)
num++;
pd = false;
if(c == -1)
return num;
}
}
}
catch (Exception e)
{
System.out.print("\n"+file.getAbsolutePath());
e.printStackTrace();
}
return num;
}
}

public static void main(String[] args)
{
System.out.println(searchString(args[0]));
}
}

base64编码即得flag

1
moectf{MTgyNDI2}
Posted on

2020-11-13

Updated on

2020-11-18

Licensed under

Comments

:D 一言句子获取中...

Loading...Wait a Minute!