Skip to content

Commit c5065d9

Browse files
authored
Remove curses prefix on pwntools healthcheck and log output (google#38)
1 parent c1af87d commit c5065d9

File tree

2 files changed

+5
-7
lines changed
  • infrastructure/kctf/base/challenge-skeleton/healthcheck/exploit

2 files changed

+5
-7
lines changed
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33

4-
# without this pwntools throws an error
5-
import curses
6-
curses.setupterm('xterm-256color')
7-
84
from pwn import *
95

106
exit(0)

infrastructure/kctf/base/challenge-skeleton/healthcheck/exploit/run.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ PERIOD=30
77

88
while true; do
99
source /config/env
10-
if timeout "${TIMEOUT}" /exploit/doit.py; then
11-
echo 'ok' > /tmp/healthz
10+
echo -n "[$(date)] "
11+
if timeout "${TIMEOUT}" /exploit/doit.py NOTERM; then
12+
echo 'ok' | tee /tmp/healthz
1213
else
13-
echo 'err' > /tmp/healthz
14+
echo -n "$? "
15+
echo 'err' | tee /tmp/healthz
1416
fi
1517
sleep "${PERIOD}"
1618
done

0 commit comments

Comments
 (0)