서과장 유출 파일을 복제한 것을 복구 한 후
autopsy로 파일 열기
osf 유저 액티비티로 설치 파일 스캔하여 설치 파일 시간 분석하기
> 직접 다운 받아서 실행해보기 : 파일과 동일하게 버전 맞춰주기
파일 해제 후 .tc 파일 풀어보기
미션
이미지 : ence.E01
상태 확인 후 상태 이상이 있으면 정상화
2개의 파티션 테이블 비정상
복구 진행
시작 위치 : 63 마지막 위치 :4306175 > 사이즈 : 4306113
4306175 -63+1 = 4306113
시작위치 : 3F 00 00 00 마지막 위치 : 00 41 B4 C1 > C1 B4 41 00
시작 위치 : 4306239 마지막 위치 : 4999679 > 사이즈 : 693441
4306239-4999679+1 = 4999679-4306239+1 = 693441
시작 위치 : 00 41 B5 3F > 3F B5 41 00
마지막 위치 : 00 0A 94 C1 > C1 94 0A 00
Active disk Editor로 복구 작업 진행
1. findx.gif
분석 방법
확장자 분석 > 키워드 분석 > 파일 시그니처 분석 > 카빙
gif 확장자 찾아보면 표면상 안 나옴 : 찾으려면 파일 시그니처가 필요함
> 이미 존재함(숨겨져 있음)
usb를 encase에서 00 섹터로 모두 변경 후 ftk에서 확인하기
> 확인 후 이미지 하나 추가 후 다시 포맷
> 사본이미지 만들기
> 이 후 카빙 기법으로 포맷된 이미지를 찾을 수 있음
Forensic.py 카빙 코드 넣어주기
import os
def carving():
"""
포렌식 카빙 예제 함수 (PNG 파일 카빙)
분석할 바이너리 파일에서 PNG 헤더와 IEND 청크를 찾아 별도의 파일로 저장합니다.
"""
# 분석할 파일 경로 입력 받기
input_file = input("분석할 파일 경로를 입력하세요: ").strip()
if not os.path.isfile(input_file):
print("입력한 파일이 존재하지 않습니다.")
return
# 카빙 결과를 저장할 디렉토리 생성 (없으면 생성)
output_dir = "carved_files"
if not os.path.exists(output_dir):
os.makedirs(output_dir)
# PNG 헤더와 IEND 마커 (바이너리 형태)
header = b'\x89PNG\r\n\x1a\n'
iend_marker = b'\x00\x00\x00\x00IEND' # IEND 청크의 시작 부분 (이후 4바이트 CRC 포함하면 전체 12바이트)
# 파일 전체를 바이너리 모드로 읽기
with open(input_file, "rb") as f:
data = f.read()
carved_count = 0
index = 0
# 전체 데이터에서 반복적으로 PNG 파일 찾기
while True:
# PNG 헤더 검색
start_index = data.find(header, index)
if start_index == -1:
break # 더 이상 헤더가 없으면 종료
# 헤더 이후부터 IEND 마커 검색
iend_index = data.find(iend_marker, start_index + len(header))
if iend_index == -1:
print("헤더는 찾았으나 IEND 청크를 찾지 못했습니다.")
break
# IEND 청크의 전체 길이는 12바이트이므로, iend_index에 12를 더해 추출 범위를 결정
end_index = iend_index + 12
# PNG 파일 데이터 추출 (헤더부터 IEND 청크까지)
carved_data = data[start_index:end_index]
output_file = os.path.join(output_dir, f"carved_{carved_count:03d}.png")
with open(output_file, "wb") as out_f:
out_f.write(carved_data)
print(f"{output_file} 저장 완료. (위치: {start_index} ~ {end_index})")
carved_count += 1
# 다음 검색 위치는 이번 IEND 청크 이후
index = end_index
print(f"총 {carved_count} 개의 PNG 파일을 카빙하였습니다.")
if __name__ == '__main__':
carving()
def carve();
1) 와이핑하기
2) 포맷하기
3) 사진 저장
4) 포맷하기
5) Forensic.py 프로그램으로 카빙하기
2.newmar.jpg를 찾아라
확장자 분석 > 키워드 분석 > 파일 시그니처 분석 > 은닉 파악
> TureCrypt 흔적 찾기
> 확장자 불일치 찾기
> 파이썬에서 zip 파일 푸는 프로그램 만들기
ftk imger에서 파일 형식 확인
pk : zip파일에 해당
Autoexec.bat > Autoexe.zip 파일로 형식 변경
Pretty Lady.txt > 비밀번호 파일
zip 파일 비밀번호 찾는 코드
import pyzipper
def try_password(zip_file, password):
"""
pyzipper로 비밀번호를 확인합니다.
"""
try:
with pyzipper.AESZipFile(zip_file, 'r') as zf:
# 비밀번호로 ZIP 파일을 추출
zf.pwd = password.encode()
zf.testzip() # 파일이 유효한지 테스트
zf.extractall() # 비밀번호가 맞다면 파일을 추출
print(f"비밀번호 찾음! 비밀번호는: {password}")
return password
except RuntimeError:
return None # 비밀번호가 맞지 않으면 None 반환
except pyzipper.BadZipFile:
print("ZIP 파일이 손상되었습니다.")
return None
except Exception as e:
print(f"예상치 못한 오류: {e}")
return None
def try_all_combinations(zip_file, text):
"""
주어진 텍스트에서 비밀번호가 될 수 있는 부분 문자열을 추출하고 ZIP 파일에서 확인합니다.
"""
password_length = 12 # 비밀번호 길이 제한
for length in range(1, password_length + 1):
for start in range(len(text) - length + 1):
possible_password = text[start:start + length].strip()
if not possible_password:
continue
print(f"시도 중: {possible_password}")
found_password = try_password(zip_file, possible_password)
if found_password:
return found_password
print("비밀번호를 찾을 수 없습니다.")
return None
# 사용자가 텍스트 파일 경로를 입력받음
text_file_path = input("비밀번호 후보 텍스트가 들어 있는 텍스트 파일 경로를 입력하세요: ").strip()
# 텍스트 파일을 열고 내용을 읽어옴
try:
with open(text_file_path, 'r', encoding='utf-8') as file:
text = file.read().strip()
print("파일에서 텍스트 읽기 완료!")
except FileNotFoundError:
print("파일을 찾을 수 없습니다. 경로를 다시 확인해주세요.")
exit()
# ZIP 파일 경로 입력
zip_file = input("ZIP 파일 경로를 입력하세요: ").strip()
# 가능한 비밀번호 조합을 시도
try_all_combinations(zip_file, text)
VMWARE설치
우분투 22.04 GUI용 > Virtual Box > Win 7
* 번외 학원 백업 위드프레스 파일과 설치전 워드프레스 파일 해시값 비교 분석
CREATE DATABASE jeonjucom;
CREATE USER 'jeonjucom'@'localhost' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON jeonjucom.* TO 'jeonjucom'@'localhost';
FLUSH PRIVILEGES;
> 데이터 베이스 추가 불가능 함