File tree Expand file tree Collapse file tree 6 files changed +70
-0
lines changed
Expand file tree Collapse file tree 6 files changed +70
-0
lines changed Original file line number Diff line number Diff line change 1+ .PHONY : all run run1 run2 clean
2+
3+ all :
4+ gcc -o chal -no-pie chal.c
5+
6+ run : run1 run2
7+
8+ run1 : all
9+ @cat 1.txt | ./chal
10+
11+ run2 : all
12+ @cat 2.txt | ./chal
13+
14+ clean :
15+ rm -f chal
Original file line number Diff line number Diff line change 1+ Enter the secret key: Correct! The flag is: CTF{symbolic_execution_for_the_win}
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+
3+ import angr ,sys
4+
5+ def main ():
6+ secret_key = b""
7+ sys .stdout .buffer .write (secret_key )
8+
9+
10+ if __name__ == '__main__' :
11+ main ()
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Check for unwanted files
4+ for file in * ; do
5+ if [[ $file != " solve.py" && $file != " chal.c" && $file != " Makefile" && $file != " README.md" && $file != " validate.sh" && $file != " ans" ]]; then
6+ echo " [!] Unwanted file detected: $file ."
7+ exit 1
8+ fi
9+ done
10+
11+ test_path=" ${BASH_SOURCE[0]} "
12+ solution_path=" $( realpath .) "
13+ tmp_dir=$( mktemp -d -t lab6-XXXXXXXXXX)
14+ answer=" "
15+
16+ cd $tmp_dir
17+
18+ rm -rf *
19+ cp $solution_path /Makefile .
20+ cp $solution_path /ans .
21+ cp $solution_path /* .c .
22+ cp $solution_path /* .py .
23+
24+ make
25+ make run > out
26+ result=$( diff --strip-trailing-cr ans out)
27+ if [[ -n $result ]]; then
28+ echo " [!] Expected: "
29+ cat ans
30+ echo " "
31+ echo " [!] Actual: "
32+ cat out
33+ echo " "
34+ exit 1
35+ else
36+ echo " [V] Pass"
37+ fi
38+
39+ rm -rf $tmp_dir
40+
41+ exit 0
42+
43+ # vim: set fenc=utf8 ff=unix et sw=2 ts=2 sts=2:
You can’t perform that action at this time.
0 commit comments