import struct

def GetDword(buf, off):
    return struct.unpack('<L', buf[off:off+4])[0]


fp = open('static/00n-S190106-example.hwp', 'rb')
buf = fp.read()
fp.close()

if buf[0:4] == b'\xd0\xcf\x11\xe0':
    print('OLE')
else:
    print('no ole')

# BBD
num_bbd = GetDword(buf, 0x2C)

bbd = ''
for i in range(num_bbd):
    block_no = GetDword(buf, 0x4c + (i*4))
    print(hex(block_no))
    off = (block_no + 1) * 0x200
    # off = (block_no + 1) << 9
    # print(off)
    # bbd += buf[off:off+0x200].decode('utf-8')

# print(bbd)
6223e8a7e5912497c27839f9b07cb976669a1723
<mask token>


def GetDword(buf, off):
    return struct.unpack('<L', buf[off:off + 4])[0]


<mask token>

<mask token>


def GetDword(buf, off):
    return struct.unpack('<L', buf[off:off + 4])[0]


<mask token>
fp.close()
if buf[0:4] == b'\xd0\xcf\x11\xe0':
    print('OLE')
else:
    print('no ole')
<mask token>
for i in range(num_bbd):
    block_no = GetDword(buf, 76 + i * 4)
    print(hex(block_no))
    off = (block_no + 1) * 512

<mask token>


def GetDword(buf, off):
    return struct.unpack('<L', buf[off:off + 4])[0]


fp = open('static/00n-S190106-example.hwp', 'rb')
buf = fp.read()
fp.close()
if buf[0:4] == b'\xd0\xcf\x11\xe0':
    print('OLE')
else:
    print('no ole')
num_bbd = GetDword(buf, 44)
bbd = ''
for i in range(num_bbd):
    block_no = GetDword(buf, 76 + i * 4)
    print(hex(block_no))
    off = (block_no + 1) * 512

import struct


def GetDword(buf, off):
    return struct.unpack('<L', buf[off:off + 4])[0]


fp = open('static/00n-S190106-example.hwp', 'rb')
buf = fp.read()
fp.close()
if buf[0:4] == b'\xd0\xcf\x11\xe0':
    print('OLE')
else:
    print('no ole')
num_bbd = GetDword(buf, 44)
bbd = ''
for i in range(num_bbd):
    block_no = GetDword(buf, 76 + i * 4)
    print(hex(block_no))
    off = (block_no + 1) * 512

import struct

def GetDword(buf, off):
    return struct.unpack('<L', buf[off:off+4])[0]


fp = open('static/00n-S190106-example.hwp', 'rb')
buf = fp.read()
fp.close()

if buf[0:4] == b'\xd0\xcf\x11\xe0':
    print('OLE')
else:
    print('no ole')

# BBD
num_bbd = GetDword(buf, 0x2C)

bbd = ''
for i in range(num_bbd):
    block_no = GetDword(buf, 0x4c + (i*4))
    print(hex(block_no))
    off = (block_no + 1) * 0x200
    # off = (block_no + 1) << 9
    # print(off)
    # bbd += buf[off:off+0x200].decode('utf-8')

# print(bbd)