Skip to content

Instantly share code, notes, and snippets.

@seunggabi
Created October 16, 2019 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seunggabi/2b1d934d3bdf2c4eb688b7617527e6bf to your computer and use it in GitHub Desktop.
Save seunggabi/2b1d934d3bdf2c4eb688b7617527e6bf to your computer and use it in GitHub Desktop.
byte2string.py
from pyparsing import unicode
from bs4 import BeautifulSoup
path = ""
binary_filename = "binary.txt"
i = open(binary_filename, "rb")
input = i.read()
input = unicode(input, errors='ignore')
bsObj = BeautifulSoup(path + input, "html.parser")
i.close()
num = 1
for contents in bsObj.findAll("contents"):
t = str(contents)
t = unicode(t).encode('utf-8')
o = open(path + str(num) + ".txt", "wb")
o.write(t)
o.close()
num += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment