Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import os
- def main():
- if len(sys.argv) != 2:
- print 'Usage: python %s <input-file>' % sys.argv[0]
- exit(1)
- input_file = sys.argv[1]
- if not os.path.exists(input_file):
- print 'File "%s" does not exist' % input_file
- exit(1)
- with open(input_file) as f:
- container_with_secret = f.read()
- bits = ''
- space_count = 0
- for c in container_with_secret:
- if c == ' ':
- space_count += 1
- if space_count == 2:
- bits += '1'
- space_count = 0
- continue
- if c != ' ' and space_count == 1:
- bits += '0'
- space_count = 0
- print ''.join([chr(int(bits[i:i+8], 2)) for i in range(0, len(bits), 8)])
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement