Skip to content

Instantly share code, notes, and snippets.

@matsueushi
Last active November 23, 2022 13:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matsueushi/b2b606daf24998dac169859743a5463c to your computer and use it in GitHub Desktop.
Save matsueushi/b2b606daf24998dac169859743a5463c to your computer and use it in GitHub Desktop.
sadserver解き方
  1. "Saint John": what is writing to this log file?

ファイルをオープンしているコマンドは lsof コマンドで調べられる。

ubuntu@ip-172-31-32-108:/$ lsof /var/log/bad.log
COMMAND   PID   USER   FD   TYPE DEVICE SIZE/OFF  NODE NAME
badlog.py 637 ubuntu    3w   REG  259,1    25744 67701 /var/log/bad.log

kill でコマンドを止める。

ubuntu@ip-172-31-32-108:/$ kill -s KILL 637
  1. "Santiago": Find the secret combination
admin@ip-172-31-34-124:/$ find /home/admin/*.txt
/home/admin/11-0.txt
/home/admin/1342-0.txt
/home/admin/1661-0.txt
/home/admin/84-0.txt

Aliceの件数を探す

admin@ip-172-31-36-109:/$ find /home/admin/ -type f -name "*.txt" |xargs grep -c 'Alice' 
/home/admin/agent/sadagent.txt:0
/home/admin/84-0.txt:0
/home/admin/11-0.txt:398
/home/admin/1342-0.txt:1
/home/admin/1661-0.txt:12

question 1の答えは0+398+1+12=411.

admin@ip-172-31-36-109:/$ echo -n 411 > /home/admin/solution
admin@ip-172-31-36-109:/$ grep Alice -A 3 /home/admin/1342-0.txt 
                                Alice
                        156 CHARING CROSS ROAD
                                LONDON

question 2の答えは156。

admin@ip-172-31-36-109:/$ echo 156 >> /home/admin/solution
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment