def demo(self, ui): ui.message("===== Demo Mode =====") ui.message("Running a small demo/testing!") text = "bienvenu à tous dans cyprium.upper_lower by the"\ "the hachakemy. merci à chacun d'entre vous." ui.message("--- Hiding ---") data = "THA" ui.message("Text used as source (input file): {}".format(text)) ui.message("Data to hide: {}\n".format(data)) ui.message("Text with hidden data (output file): {}" "".format(upper_lower.hide(text, data))) ui.message("") ui.message("--- Unhiding ---") htext = "aSkdfJaÖSDkfJaSÖDFjaSDKFasjfks" ui.message("Text used as source (input file): {}".format(htext)) ui.message("The hidden data is: {}" "".format(upper_lower.unhide(htext))) ui.message("--- Won't work ---") data = "morderegrippipiotabirofreluchamburelurecoquelurintimpanemens" ui.message("+ The input text must be long enough (have enough letters)" " for the given data to hide:") ui.message("Data to hide: {}".format(data)) try: ui.message("Text with hidden data (output file): {}" "".format(upper_lower.hide(text, data))) except Exception as e: ui.message(str(e), level=ui.ERROR) ui.get_choice("", [("", "Go back to $menu", "")], oneline=True)
def unhide(self, ui): """Interactive version of unhide().""" txt = "" ui.message("===== Unhide Mode =====") while 1: txt = ui.text_input("Please choose some text with hidden data") if txt is not None: try: ui.text_output("Data successfully unhidden", upper_lower.unhide(txt), "The hidden data is") except Exception as e: if utils.DEBUG: import traceback traceback.print_tb(sys.exc_info()[2]) ui.message(str(e), level=ui.ERROR) options = [("redo", "*unhide another data", ""), ("quit", "or go back to *menu", "")] answ = ui.get_choice("Do you want to", options, oneline=True) if answ == "quit": return