Ad

Used string encoded in binary

Code
Diff
  • import ctypes
    
    def decode(bin_string):
        """Print an encoded message using printf from C"""
        text_ = ''.join(chr(int(x, 2)) for x in bin_string.split()).encode("utf8")
        ctypes.CDLL("libc.so.6").printf(text_)
        
    
    decode('0b1101000 0b1100101 0b1101100 0b1101100 0b1101111 0b1010 0b110111')
    
    • import ctypes
    • ctypes.CDLL("libc.so.6").printf("hello\n7".encode("utf8"))
    • def decode(bin_string):
    • """Print an encoded message using printf from C"""
    • text_ = ''.join(chr(int(x, 2)) for x in bin_string.split()).encode("utf8")
    • ctypes.CDLL("libc.so.6").printf(text_)
    • decode('0b1101000 0b1100101 0b1101100 0b1101100 0b1101111 0b1010 0b110111')