コード例 #1
0
ファイル: base_chunk.py プロジェクト: mKomorek/PNG_handler
 def display_basic_info(self):
     print(
         "---> CHUNK LENGHT: ",
         TextColors.setValueColor(
             str(int.from_bytes(self.length, byteorder="big"))))
     print("---> CHUNK TYPE: ",
           TextColors.setValueColor(self.type.decode()))
     print("---> CHUNK CRC: ", TextColors.setValueColor(str(self.crc)))
コード例 #2
0
ファイル: pngfile.py プロジェクト: mKomorek/PNG_handler
 def file_info(self):
     print(TextColors.BOLD + TextColors.HEADER + " FILE INFO ".center(50, "-") + TextColors.ENDC)
     print("---> PATH: ", TextColors.setValueColor(self.path))
     print("---> EXTENSION: ", TextColors.setValueColor("PNG"))
     print("---> MAGIC NUMBER: ", TextColors.setValueColor("89 50 4E 47 0D 0A 1A 0A"))
     print("---> SIZE:", TextColors.setValueColor(str(self.size)), TextColors.setValueColor("bytes"))
     print(TextColors.BOLD + TextColors.HEADER + "".center(50, "-") + TextColors.ENDC)
     print("")
     
コード例 #3
0
 def display_info(self):
     print()
     self.display_basic_info()
     print("---> CHUNK DATA: ")
     print("     > GAMMA VALUE: ",
           TextColors.setValueColor(str(self.gamma_value)))
     print()
コード例 #4
0
ファイル: plte_chunk.py プロジェクト: mKomorek/PNG_handler
 def display_info(self):
     print()
     self.display_basic_info()
     print("---> CHUNK DATA: ")
     for palete in self.paletes:
         print("     > PALLETE ENTRY: ",
               TextColors.setValueColor(str(palete)))
     print()
コード例 #5
0
 def display_info(self):
     print()
     self.display_basic_info()
     print("---> CHUNK DATA: ")
     print("     > WHITE POINT X: ",
           TextColors.setValueColor(str(self.white_point_x)))
     print("     > WHITE POINT Y: ",
           TextColors.setValueColor(str(self.white_point_y)))
     print("     > RED X: ", TextColors.setValueColor(str(self.red_x)))
     print("     > RED Y: ", TextColors.setValueColor(str(self.red_y)))
     print("     > GREEN X: ", TextColors.setValueColor(str(self.green_x)))
     print("     > GREEN Y: ", TextColors.setValueColor(str(self.green_y)))
     print("     > BLUE X: ", TextColors.setValueColor(str(self.blue_x)))
     print("     > BLUE Y: ", TextColors.setValueColor(str(self.blue_y)))
     print()
コード例 #6
0
 def display_info(self):
     print()
     self.display_basic_info()
     print("---> CHUNK DATA: ")
     print("     > YEAR: ", TextColors.setValueColor(str(self.year)))
     print("     > MONTH: ", TextColors.setValueColor(str(self.month)))
     print("     > DAY: ", TextColors.setValueColor(str(self.day)))
     print("     > HOUR: ", TextColors.setValueColor(str(self.hour)))
     print("     > MINUTE: ", TextColors.setValueColor(str(self.minute)))
     print("     > SECOND: ", TextColors.setValueColor(str(self.second)))
     print()
コード例 #7
0
ファイル: ihdr_chunk.py プロジェクト: mKomorek/PNG_handler
 def display_info(self):
     print()
     self.display_basic_info()
     print("---> CHUNK DATA: ")
     print("     > WIDTH: ", TextColors.setValueColor(str(self.width)))
     print("     > HEIGHT: ", TextColors.setValueColor(str(self.height)))
     print("     > BIT DEPTH: ",
           TextColors.setValueColor(str(self.bit_depth)))
     print("     > COLOR TYPE: ",
           TextColors.setValueColor(color_type_switch(self.color_type)))
     print("     > COMPRESSION METHOD: ",
           TextColors.setValueColor(str(self.compression_method)))
     print("     > FILTER METHOD: ",
           TextColors.setValueColor(self.filter_method))
     print("     > INTERLACE METHODE: ",
           TextColors.setValueColor(self.interlace_methode))
     print()
コード例 #8
0
ファイル: main.py プロジェクト: mKomorek/PNG_handler
def menu():
    os.system('clear')
    print(TextColors.BOLD + TextColors.HEADER + "MAIN MENU".center(50, "-") + TextColors.ENDC)

    choice = input("""
    P: Path to input file    
    Q: Quit \n \n""" 
    + TextColors.setValueColor("""    > Your choice: """))

    if choice == "P" or choice =="p":
        os.system('clear')
        file_path = input("Path: ")
        png_handler = PNG_handler(file_path)
        submenu(png_handler)
    elif choice == "Q" or choice =="q":
        return 1
    else:
        print("You must only select either P,Q.")
        print("Please try again")
    menu()
コード例 #9
0
ファイル: main.py プロジェクト: mKomorek/PNG_handler
def submenu(png_handler):

    choice = input("""
    F: Display file information
    D: Display chunk types 
    C: Display chunk informations 

    K: Display file
    R: Display file from reconstructed IDAT chunks

    T: Perform DFT and display output
    E: Encrypt the file (ECB)
    B: Encrypt the file (CBC)
    L: Encrypt the file (library)
    
    S: Clear file and save   
    N: Back to menu \n \n"""
    + TextColors.setValueColor("""    > Your choice: """))

     
    if choice == "F" or choice =="f":
        os.system('clear') 
        png_handler.display_file_info()

    elif choice == "D" or choice =="d":
        os.system('clear')
        png_handler.display_chunks_type()

    elif choice=="C" or choice=="c":
        os.system('clear')
        png_handler.display_chunks_info()
    
    elif choice=="K" or choice=="k":
        os.system('clear')
        png_handler.display_file()

    elif choice=="R" or choice=="r":
        os.system('clear')
        png_handler.display_from_reconstructed_idats()
    
    elif choice=="T" or choice=="t":
        os.system('clear')
        png_handler.display_fourier_transform()
    
    elif choice=="S" or choice=="s":
        os.system('clear')
        png_handler.create_clean_file()

    elif choice=="E" or choice=="e":
        os.system('clear')
        png_handler.make_encryption_ecb()

    elif choice=="B" or choice=="b":
        os.system('clear')
        png_handler.make_encryption_cbc()

    elif choice=="L" or choice=="l":
        os.system('clear')
        png_handler.make_encryption_library()

    elif choice=="N" or choice=="n":
        os.system('clear')
        return 1 
    else:
        os.system('clear')
        print("You must only select either F,D,C,K,T,N.")
        print("Please try again")
    submenu(png_handler)
コード例 #10
0
 def display_chunks_type(self):
     print(TextColors.BOLD + TextColors.HEADER + " CHUNKS OF FILE ".center(50,'-') + TextColors.ENDC)
     for chunk_type in self.chunks_type:
         print("---> CHUNK TYPE: ", TextColors.setValueColor(chunk_type.decode()))
     print(TextColors.BOLD + TextColors.HEADER + "".center(50, "-") + TextColors.ENDC)
     print("")