bandit22

KJH·2022년 12월 1일

bandit

목록 보기
18/29
ssh bandit22@bandit.labs.overthewire.org -p 2220 
#WdDozAdTM2z9DiFEQ2mGlwngMfj4EZff

A program is running automatically at regular intervals from cron, the time-based job scheduler. Look in /etc/cron.d/ for the configuration and see what command is being executed.
NOTE: Looking at shell scripts written by other people is a very useful skill. The script for this level is intentionally made easy to read. If you are having problems understanding what it does, try executing it to see the debug information it prints.

프로그램은 시간 기반 작업 스케줄러인 cron에서 일정한 간격으로 자동으로 실행됩니다. /etc/cron.d/에서 구성을 확인하고 실행 중인 명령을 확인합니다.

풀이

정보

md5sum이란?

  • 입력된 파일을 해시값으로 출력해준다. 파일이 한 글자라도 손상되었다면, 해시값이 달라진다

cut이란?

  • 특정 파일의 열을 출력, 제거하는 명령어

/etc/cron.d/cronjob_bandit22를 확인한다

bandit22@bandit:/etc/cron.d$ cat cronjob_bandit23
@reboot bandit23 /usr/bin/cronjob_bandit23.sh  &> /dev/null
* * * * * bandit23 /usr/bin/cronjob_bandit23.sh  &> /dev/null

/usr/bin/cronjob_bandit23.sh를 읽어본다

bandit22@bandit:/etc/cron.d$ cat /usr/bin/cronjob_bandit23.sh
#!/bin/bash

myname=$(whoami)
mytarget=$(echo I am user $myname | md5sum | cut -d ' ' -f 1)
echo "Copying passwordfile /etc/bandit_pass/$myname to /tmp/$mytarget"
# 대충  i am user 현유저이름  => 이를 해시로, 공백을 기준으로 자르고 첫번째거 반환

# 이대로 해보면
bandit22@bandit:/tmp$ echo I am user bandit23 | md5sum | cut -d ' ' -f 1
8ca319486bfbbc3663ea0fbe81326349

마지막으로, /tmp/8ca319486bfbbc3663ea0fbe81326349를 읽으면 된다

bandit22@bandit:/tmp$ cat /tmp/8ca319486bfbbc3663ea0fbe81326349
QYw0Y2aiA672PsMmh9puTQuhoz8SyR2G

0개의 댓글