🔍 '' 검색 결과
👤 기본 접속 정보
서버 IP : 192.168.0.17
사용자 : 박종완
⚙️ Gunicorn 에러 처리
📌 명령어
gunicorn --bind unix:/tmp/mysite.sock "monitor:create_app()"
📌 에러 잡는 명령어 (에러 발생 시 확인)
#Gunicorn #Python #에러처리
💾 MBR (Master Boot Record)
📌 MBR : 디스크의 첫 번째 섹터 (512바이트)
📌 VBR : 파티션1,2...를 관리함 (Volume Boot Record)
📌 구조 : VBR 위치를 관리하는 것이 MBR
📌 용량 : 512바이트
📌 MBR 구조
┌─────────────────────────────────────────────────────────────┐ │ MBR 구조 (512 Bytes) │ └─────────────────────────────────────────────────────────────┘ [Offset 0x000 ~ 0x1B7] (440 Bytes) Bootstrap Code - 부트스트랩 코드 (부팅 프로그램) [Offset 0x1B8 ~ 0x1BB] (4 Bytes) Disk Serial Number - 디스크 일련번호 [Offset 0x1BC ~ 0x1BD] (2 Bytes) Reserved - 예약 영역 [Offset 0x1BE ~ 0x1FD] (64 Bytes) Partition Table - 파티션 테이블 (4개 × 16바이트) ├── P1 (파티션 1) ├── P2 (파티션 2) ├── P3 (파티션 3) └── P4 (파티션 4) [Offset 0x1FE ~ 0x1FF] (2 Bytes) Signature - 0x55AA (MBR 유효성 확인)
#MBR #VBR #파티션 #부트섹터
🔍 디지털 포렌식 실습
📌 도구 : active@disk editor
📌 다운로드 : ntfs.com
📌 4G USB 열어서 상세 분석 진행
📌 미션 4가지
1️⃣ USB 읽고 해시값 구하기 → FTK Imager와 해시값 비교
2️⃣ USB의 MBR 읽기 → 파티션 테이블 4개 값 출력
3️⃣ MBR 손상 시키기
4️⃣ 손상된 파티션 테이블 복구하기
#포렌식 #active@disk #FTKImager #해시 #MBR복구
🐍 Python MBR 분석 코드
📌 목적 : active@disk editor처럼 디스크 0섹터 읽기
📌 실행 : VS Code 관리자 권한으로 실행
import ctypes import os import struct import subprocess import json def is_admin(): """관리자 권한 실행 여부 확인""" try: return ctypes.windll.shell32.IsUserAnAdmin() != 0 except Exception: return False def get_physical_disks(): """PowerShell Get-Disk 명령으로 물리 디스크 정보 조회""" ps_cmd = "Get-Disk | Select-Object Number, FriendlyName, Size, PartitionStyle, OperationalStatus | ConvertTo-Json" try: result = subprocess.run(["powershell", "-Command", ps_cmd], capture_output=True, text=True, check=True) data = json.loads(result.stdout) if isinstance(data, dict): data = [data] return data except Exception as e: print(f"[!] 디스크 목록 조회 실패: {e}") return [] def format_hex_ascii(data, base_offset=0): lines = [] for i in range(0, len(data), 16): chunk = data[i:i+16] hex_str = " ".join(f"{b:02X}" for b in chunk) ascii_str = "".join(chr(b) if 32 <= b <= 126 else "." for b in chunk) current_offset = base_offset + i lines.append(f"0x{current_offset:03X} ({current_offset:03d}) | {hex_str:<47} | {ascii_str}") return "\n".join(lines) def parse_partition_entry(entry_bytes, entry_num): if len(entry_bytes) != 16: return None status, sys_id, lba_start, sector_count = struct.unpack("> 파티션 엔트리 세부 분석:") for p in partitions: print(f" - 파티션 {p['num']}:") if p['sector_count'] == 0 and p['lba_start'] == 0: print(" [미사용 항목]") else: print(f" * 상태 (Status) : {p['status']}") print(f" * 파일시스템 ID : {p['sys_id']}") print(f" * 시작 LBA 섹터 : {p['lba_start']:,}") print(f" * 총 섹터 수 : {p['sector_count']:,}") print(f" * 파티션 용량 : {p['size_gb']:.2f} GB ({p['size_mb']:.1f} MB)") print(f" * Raw Hex (16B) : {p['raw_hex']}") print("\n" + "-" * 80) print("[4] Boot Signature (오프셋 0x1FE ~ 0x1FF)") print("-" * 80) print(f" Raw Hex : 0x{signature_hex}") if signature_bytes == b'\x55\xaa': print(" 검증 : [성공] 0x55AA (유효한 MBR)") else: print(" 검증 : [실패] 0x55AA 아님") print("=" * 80) def main(): if not is_admin(): print("[!] 관리자 권한 필요") return disks = get_physical_disks() if not disks: print("[!] 연결된 물리 디스크 없음") return print("=== 물리 디스크 목록 ===") disk_map = {} for idx, d in enumerate(disks, start=1): num = d.get('Number') name = d.get('FriendlyName', 'Unknown') size_gb = d.get('Size', 0) / (1024**3) style = {0:"RAW",1:"MBR",2:"GPT"}.get(d.get('PartitionStyle'), str(d.get('PartitionStyle'))) print(f"[{idx}] Disk {num} | {name} | {size_gb:.2f} GB | {style}") disk_map[idx] = (num, name) selection = int(input("\n분석할 디스크 번호: ")) if selection in disk_map: disk_num, disk_name = disk_map[selection] device_path = f"\\\\.\\PhysicalDrive{disk_num}" with open(device_path, "rb") as disk: mbr_data = disk.read(512) analyze_mbr(mbr_data, f"PhysicalDrive{disk_num} - {disk_name}") if __name__ == "__main__": main()
#Python #MBR분석 #포렌식 #디스크분석
📀 E01 이미징 및 복구 실습
📌 13th.E01 사이즈 구하는 프로그램 작성
📌 E01 → RAW(dd 변환) → RAW 이미지 수정 (가장 일반적)
📌 p1 : 80 00 00 00 00 90 00 00
📌 p2 : 80 90 00 00
📌 E01은 MBR이 아니고 EVF로 나옴
📌 첫번째 섹터 : 63
📌 두번째 섹터 : 4306239
📌 경로
/forensic/mbr /forensic/vbr
복구 완료 : 손상되었던 디스크1이 정상적으로 인식됨
📌 확인 : AutoSy로 열어보니 사진도 정상 출력
#E01 #RAW #EVF #이미징 #복구
📖 추가 학습 내용
📌 랜섬웨어 : 파일을 암호화시키는 악성코드
📌 Windows Server : 중앙통제, 도메인으로 묶어서 통제
📌 Samba : 워크그룹 → 도메인 그룹으로 묶을 수 있음
📌 목적 : 악성코드 못 깔게 하려는 것
📌 Linux GUI : 서버용이 아닌 데스크탑용 리눅스 실습 예정
#랜섬웨어 #WindowsServer #Samba #도메인 #LinuxGUI
📌 Day 29 요약 / 결론

📌 MBR 구조 : Bootstrap Code + Disk Serial + Partition Table + Signature (0x55AA)

📌 Python으로 MBR 분석 프로그램 작성 (관리자 권한 필요)

📌 디지털 포렌식 미션 : 해시값 구하기, MBR 읽기, MBR 손상, MBR 복구

📌 E01 이미징 : E01 → RAW 변환 → active@disk editor로 복구

📌 파티션 정보 : 첫번째 섹터 63, 두번째 섹터 4306239

📌 앞으로 학습 : Windows Server 중앙통제, Linux GUI 실습 예정

🎯 결론 : MBR 구조 완벽 이해 및 파티션 테이블 복구 실습 완료
#MBR #VBR #디지털포렌식 #E01 #파티션복구 #Python #active@disk
29/31