#!/usr/bin/python # .-------------------------------------[ icedragon@quickfox.org ]--. # # | getblock.py | DragonSpeak Block Retriever (c) 2006 by IceDragon | # # |-----------------------------------------------------------------| # # | This small script is particularly useful with decoded DSB files | # # | and can display a DS block from within a file beginning at a | # # | specific line. The line numbers are given in 6/7 instructions | # # | in game. | # # `-----------------------------------------------------------------' # ###--# Imports #--### from sys import argv ###--# Setting Commandline Arguments #--### if len(argv) < 3: print 'Syntax: %s ' % argv[0] raise SystemExit filename = argv[1] block = int( argv[2] ) ###--# Parsing the DS file #--### print '[+] Opening %s...' % filename fd = open( filename, 'r' ) print '[+] Looking for block %d...' % block line = 0 block_print = False while True: buffer = fd.readline() if buffer == '': print '[!] Reached end of file!' break else: buffer = buffer.rstrip() if buffer == '': continue line += 1 if line >= block: if block_print == False: block_print = True else: if buffer[:3] == '(0:': print '[+] End of block - aborting' break if block_print: print ' >', buffer fd.close() ###--# END OF FILE #--###