Hacking/MISC

Foremost tool

mitdog 2024. 7. 17. 19:39

위키문서 : https://en.wikipedia.org/wiki/Foremost_(software)

참고자료 : https://m.blog.naver.com/koromoon/220553895618

 

포렌식 CTF 문제에서 사용할 수 있는 툴입니다.

어떤 파일 안의 다른 파일이 숨겨져 있을 경우, 추출해줍니다.

예를 들면

  • ELF 시그니쳐로 시작하는 파일 속에, PNG 시그니처, JPEG 시그니처 등이 보여서 안에 다른 파일이 숨겨진 듯 할 때
  • 파일 용량이 뭔가 이상하게 클 때(파일의 형식에 비해)

등, 이 툴을 이용해 문제를 해결할 수 있습니다.

 

사용 방법은 foremost -h를 치면 쭈루룩 나오긴 합니다.

$ foremost [-v|-V|-h|-T|-Q|-q|-a|-w-d] [-t <type>] [-s <blocks>] [-k <size>]
        [-b <size>] [-c <file>] [-o <dir>] [-i <file]

-V  - display copyright information and exit
-t  - specify file type.  (-t jpeg,pdf ...)
-d  - turn on indirect block detection (for UNIX file-systems)
-i  - specify input file (default is stdin)
-a  - Write all headers, perform no error detection (corrupted files)
-w  - Only write the audit file, do not write any detected files to the disk
-o  - set output directory (defaults to output)
-c  - set configuration file to use (defaults to foremost.conf)
-q  - enables quick mode. Search are performed on 512 byte boundaries.
-Q  - enables quiet mode. Suppress output messages.
-v  - verbose mode. Logs all messages to screen

 

설치 :

$ sudo apt-get install foremost

 

 

사용 예시)

파일 안에 2개 이상의 파일 시그니처가 있다, 용량도 매우 크고..

foremost -t all -i img1

명령어 사용 - img1 파일에서 모든 파일 추출하기

png 파일이 추출된 모습!