일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 많다..
- 안전결제
- shell_gpt
- 모의해킹
- 변태는
- 중고나라
- CryptoJS
- open redirect
- ue4dumper
- Frida
- 척추관협착증
- 다우오피스
- 네이버카페
- XSS
- 채팅환전사기
- speed-measure-webpack-plugin
- intelmac
- ssrf
- esbuild
- 허리디스크
- self-signed
- CJ대한통운 #쿠팡 #통관번호오류 #통관고유번호오류 #안주원팀장 #모건인베스트
- 로맨스스캠
- 보이스피싱 #대검찰청 #명의도용 #비밀번호 #계좌번호 #공공기관 #가짜검찰청
- 취약점
- Sequoia
- 거래사기
- Malware Sample
- AWS
- MongoDB #NoSQL #CreateUser #DropUser #mongod #mognod.conf
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
'분석생활' 카테고리의 다른 글
다우오피스 국세청 사칭 이메일 피싱 (1) | 2025.03.06 |
---|---|
네이버 카페 안전결제 사기 관리자 편 (29) | 2024.08.13 |
대기열 bypass (40) | 2024.07.30 |
네이버 카페 안전결제 사기 후속편 (25) | 2024.06.20 |
네이버 카페 안전결제 사기 (43) | 2024.06.17 |
Comments