Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- # -*- coding: utf-8 -*-
- # Filename: decode_0bin.py
- # Author: Jeoi Reqi
- """
- This Python script decodes the contents of '0.bin' file and saves the result as plain text in a txt file.
- Requirements:
- - Python 3
- """
- import os
- def decode_binary_file(input_file, output_file):
- with open(input_file, 'rb') as binary_file:
- # Read binary data
- binary_data = binary_file.read()
- # Decode binary data into ASCII plaintext
- decoded_text = binary_data.decode('utf-8')
- # Write the decoded text to the output file
- with open(output_file, 'w') as plaintext_file:
- plaintext_file.write(decoded_text)
- if __name__ == "__main__":
- # Specify the input and output file names
- input_file_0 = '0.bin'
- output_file_0 = 'decoded_0.txt'
- # Decode 0.bin
- decode_binary_file(input_file_0, output_file_0)
- print(f'{input_file_0} decoded and saved to {output_file_0}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement