| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 |
Tags
- self-signed
- 내부확산
- AWS
- aes
- shell_gpt
- Malware Sample
- mitmproxy
- intelmac
- EC2
- 안전결제
- 중고나라
- S3
- Frida
- 취약점
- react2shell
- 많다..
- 변태는
- ssrf
- LFI
- cve-2025-55182
- ue4dumper
- Sequoia
- 채팅환전사기
- 모의해킹
- 허리디스크
- jeb_mcp
- 척추관협착증
- XSS
- 네이버카페
Archives
- Today
- Total
annyoung
엑셀 시트 보호 해제 본문
엑셀에 걸려있는 시트보호 암호를 크랙해준다.
동작 원리는 아마도 암호가 동일한지 확인하는게 아니라 hash가 동일한지 판별하기 때문에 그런것 같다.
참고로 microsoft excel 2007 파일(XLS)만 되는것 같다.
import random
import sys
import itertools
import struct
import string
import olefile
allchars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!\"#$%&'()*+,-./:;<=>?@[\]^_`{|}~ "
def rand_pass():
s = ""
for i in range(random.randint(0,20)):
s += random.choice(allchars)
return s
def excel_hash(password):
result = 0
MAX_UINT16 = 0xFFFF
if len(password) <= MAX_UINT16:
for c in password[::-1]:
result = ((result >> 14) & 0x01) | ((result << 1) & 0x7FFF)
result ^= ord(c)
result = ((result >> 14) & 0x01) | ((result << 1) & 0x7FFF)
result ^= (0x8000 | (ord('N') << 8) | ord('K'))
result ^= len(password)
return result
def crack_password(targetHash):
gotHash = 0x00
while gotHash != targetHash:
attempt = rand_pass()
gotHash = excel_hash(attempt)
print("Cracking: "+hex(targetHash)+": "+hex(gotHash), end="\r")
return attempt
def extract_sheet_hashes(stream):
hashes = []
while True:
pos = stream.tell()
if pos >= stream.size:
break
try:
type = struct.unpack("<H", stream.read(2))[0]
length = struct.unpack("<H", stream.read(2))[0]
data = stream.read(length)
if type == 0x13:
hashes.append(struct.unpack("H", data)[0])
except:
break
return hashes
def read_xls(filename):
ole = olefile.OleFileIO(filename)
for streamname in ole.listdir():
stream = ole.openstream(streamname)
hashes = extract_sheet_hashes(stream)
if len(hashes) >= 1:
for hash in hashes:
if hash == 0:
continue
passwd = crack_password(hash)
print("hash: "+hex(hash)+" : " +passwd)
stream.close()
ole.close()
if __name__ == "__main__":
if len(sys.argv) <= 1:
print("Usage: crackSheetProt.py <XLS-FILE>")
sys.exit()
read_xls(sys.argv[1])
출처: https://github.com/LiEnby/CrackSheetProtection
GitHub - LiEnby/CrackSheetProtection: Recover Sheet Protection Password for Old Microsoft Excel 2007 Files (.XLS)
Recover Sheet Protection Password for Old Microsoft Excel 2007 Files (.XLS) - LiEnby/CrackSheetProtection
github.com
'분석생활' 카테고리의 다른 글
| I'm not a robot 피싱 (0) | 2026.04.10 |
|---|---|
| jeb mcp (0) | 2025.11.20 |
| 다우오피스 국세청 사칭 이메일 피싱 (1) | 2025.03.06 |
| 네이버 카페 안전결제 사기 관리자 편 (29) | 2024.08.13 |
| 대기열 bypass (40) | 2024.07.30 |
Comments