def analyze(self): try: self.__offset = int(self.__options.offset, 16) if self.__options.offset else 0 except ValueError: print "[Error] The offset must be in hexadecimal" return False if self.__options.console: if self.__options.binary: self.__binary = Binary(self.__options) if self.__checksBeforeManipulations() == False: return False self.cmdloop() return True self.__binary = Binary(self.__options) if self.__checksBeforeManipulations() == False: return False if self.__options.string: return self.__lookingForAString(self.__options.string) elif self.__options.opcode: return self.__lookingForOpcodes(self.__options.opcode) elif self.__options.memstr: return self.__lookingForMemStr(self.__options.memstr) else: self.__getAllgadgets() self.__lookingForGadgets() if self.__options.ropchain: ROPMaker(self.__binary, self.__gadgets, self.__offset) return True
def set(self, value): binary = Binary(value) upper, lower = binary.split(self.bits) if upper != 0: self.overflow = True self._value = Binary(lower)._value
def save(self, translate, file=None): ''' Permet d'enregistrer un fichier .thc :param translate: (translate) Class translate du texte à enregistrer. :param file: (facultatif) (string) lien vers l'emplacement du fichier. :return: (boolean) si la sauvegarde s'est bien passée. ''' binary = Binary() if file is None: self.file = "*.thc" self.SaveAsFileDialog() if self.file == "": return False else: self.file = file if not self.file.lower().endswith(".thc"): self.file += ".thc" dic = translate.getDict() bin = translate.getBin() savedic = binary.dictToSave(dic) savebin = binary.to255lst(bin) save = savedic + savebin file = open(self.file, "wb") file.write(bytearray(save)) file.close() return True
def __init__(self, ip, binary, name="noname", port=22): self.name = name self.ip = ip self.port = port listener_port = random.randint(20000, 25000) self.listener = Listener(name, ip, listener_port, self) self.binary = Binary(binary, self)
def __init__(self, binary, verbose=False, cflags=None): self.bin = Binary(binary) self.bin.verbose = verbose self.bin.linker.cflags = cflags self.patches = [] self.patchfiles = [] self.verbose = verbose self.cflags = cflags
def binary(self): """Generates binaries""" for sn in range(1, self.n_source_nodes+1): for tn in range(1, self.n_transit_nodes+1): for dn in range(1, self.n_destination_nodes+1): binary = Binary() binary.create_constraint_flow(sn, tn, dn) self.add_line(binary)
def set_documents(self, bundle, prefix=None): """Generates and appends a SmokingStatus entry to the transaction""" if self.pid in Document.documents and GENERATION_MAP["Documents"]: for d in [doc for doc in Document.documents[self.pid] if doc.type != 'photograph']: data = fetch_document (self.pid, d.file_name) # d.content = data['base64_content'] # d.size = data['size'] # d.hash = data['hash'] # b = d # id = uid("Binary", "%s-document" % d.id, prefix) # d.binary_id = id # template = template_env.get_template('binary.xml') # print >>pfile, template.render(dict(globals(), **locals())) doc = Binary({ "mime_type": d.mime_type, "content" : data['base64_content'], "id" : uid(None, "%s-document" % d.id, prefix) }) # self.appendEntry(bundle, doc) patientFile = open(os.path.join( self.path, "patient-%s-document-%s.fhir-bundle.json" % (self.pid, d.id) ), "w") print >> patientFile, pp_json({ "resourceType": "Bundle", "type": "transaction", "entry": [ doc ] }) binary_id = uid(None, "%s-document-ref" % d.id, prefix) docRef = Document({ 'ID' : binary_id, 'PID' : self.pid, 'DATE' : datetime.now().strftime("%Y-%m-%dT%H:%M:%S+" + "05:00"), #.isoformat(), 'TITLE' : d.file_name, 'MIME_TYPE': d.mime_type, 'FILE_NAME': d.file_name, 'TYPE' : "Document", 'mime_type': d.mime_type }) self.appendEntry(bundle, docRef.toJSON(data, binary_id, prefix)) # id = uid("DocumentReference", "%s-document" % d.id, prefix) # d.system = 'http://smarthealthit.org/terms/codes/DocumentType#' # d.code = d.type # d.display = d.type # template = template_env.get_template('document.xml') # print >>pfile, template.render(dict(globals(), **locals())) # if GENERATION_MAP["Documents"]: # if self.pid in SocialHistory.socialHistories: # self.appendEntry(bundle, # SocialHistory.socialHistories[self.pid].toJSON(prefix) # ) return bundle
def main(): args = get_args() if os.path.isfile(args.stat): return config = Config() config.MODE = config.TRAIN config.BINARY_PATH = args.binary_with_symtab config.BINARY_NAME = args.binary_with_symtab config.BAP_FILE_PATH = args.bap config.DEBUG_INFO_PATH = args.debug_info config.OUTPUT_BINARY_PATH = args.output config.MODIFY_ELF_LIB_PATH = args.elf_modifier config.N2P_SERVER_URL = args.n2p_url config.STAT_PATH = args.stat config.TWO_PASS = args.two_pass config.FP_MODEL_PATH = args.fp_model if config.TWO_PASS: reg_dict = open(os.path.join(config.FP_MODEL_PATH, 'reg.dict'), 'rb') reg_model = open(os.path.join(config.FP_MODEL_PATH, 'reg.model'), 'rb') reg_support = open(os.path.join(config.FP_MODEL_PATH, 'reg.support'), 'rb') config.REG_DICT = pickle.load(reg_dict, encoding='latin1') config.REG_SUPPORT = pickle.load(reg_support, encoding='latin1') config.REG_DICT.restrict(config.REG_SUPPORT.get_support()) config.REG_MODEL = pickle.load(reg_model, encoding='latin1') config.REG_MODEL.n_jobs = 1 off_dict = open(os.path.join(config.FP_MODEL_PATH, 'off.dict'), 'rb') off_model = open(os.path.join(config.FP_MODEL_PATH, 'off.model'), 'rb') off_support = open(os.path.join(config.FP_MODEL_PATH, 'off.support'), 'rb') config.OFF_DICT = pickle.load(off_dict, encoding='latin1') config.OFF_SUPPORT = pickle.load(off_support, encoding='latin1') config.OFF_DICT.restrict(config.OFF_SUPPORT.get_support()) config.OFF_MODEL = pickle.load(off_model, encoding='latin1') config.OFF_MODEL.n_jobs = 1 with open(config.BINARY_PATH, 'rb') as elffile, open(config.DEBUG_INFO_PATH, 'rb') as debug_elffile: b = Binary(config, elffile, debug_elffile) b.set_test_result_from_server(True) b.modify_elf(args.binary_without_symtab) if config.STAT_PATH is not None: b.dump_stat() if config.TWO_PASS: reg_dict.close() reg_support.close() reg_model.close() off_dict.close() off_support.close() off_model.close()
def save_pre(n, pre_prob): if None in (n, pre_prob): raise PreventUpdate if pre_prob == 'trav': configs.params['prob_type'] = Single(configs.params) configs.params['num_objs'] = 1 configs.params['objs'] = [min] configs.params['obj_names'] = ['Distance'] configs.params['enc_name'] = 'Permutation' configs.params['enc_type'] = Perm(configs.params) configs.params['gene_size'] = 29 configs.params['enc_type'].params['min_value'] = 0 configs.params['enc_type'].params['max_value'] = 28 configs.params['eval_type'] = TSP configs.params['cust_vis'] = network elif pre_prob == 'knap': configs.params['prob_type'] = Multi(configs.params) configs.params['num_objs'] = 2 configs.params['objs'] = [max, min] configs.params['obj_names'] = ['Value', 'Weight'] configs.params['enc_name'] = 'Binary String' configs.params['enc_type'] = Binary(configs.params) configs.params['gene_size'] = 64 configs.params['enc_type'].params['min_value'] = 0 configs.params['enc_type'].params['max_value'] = 1 configs.params['eval_type'] = knapsack configs.params['cust_vis'] = selection configs.params['n'] = 8 elif pre_prob == 'queens': configs.params['prob_type'] = Single(configs.params) configs.params['num_objs'] = 1 configs.params['objs'] = [min] configs.params['obj_names'] = ['Threats'] configs.params['enc_name'] = 'Permutation' configs.params['enc_type'] = Perm(configs.params) configs.params['gene_size'] = 64 configs.params['enc_type'].params['min_value'] = 0 configs.params['enc_type'].params['max_value'] = 63 configs.params['eval_type'] = eight_queens configs.params['cust_vis'] = chess_board elif pre_prob == 'sudoku': configs.params['prob_type'] = Single(configs.params) configs.params['num_objs'] = 1 configs.params['objs'] = [min] configs.params['obj_names'] = ['Conflicts'] configs.params['enc_name'] = 'Permutation' configs.params['enc_type'] = Perm(configs.params) configs.params['gene_size'] = 100 configs.params['enc_type'].params['min_value'] = 0 configs.params['enc_type'].params['max_value'] = 99 configs.params['eval_type'] = sudoku configs.params['cust_vis'] = sudoku_board return 'Saved'
def save(n, prob_type, num_objs, obj_1_name, obj_2_name, obj_3_name, obj_1_goal, obj_2_goal, obj_3_goal, enc_type, gene_size, min_value, max_value): if None in (n, prob_type, num_objs, min_value, max_value): raise PreventUpdate elif num_objs == 1 and None in (obj_1_name, obj_1_goal): raise PreventUpdate elif num_objs == 2 and None in (obj_1_name, obj_1_goal, obj_2_name, obj_2_goal): raise PreventUpdate elif num_objs == 3 and None in (obj_1_name, obj_1_goal, obj_2_name, obj_2_goal, obj_3_name, obj_3_goal): raise PreventUpdate elif gene_size is not None and gene_size < 0: raise PreventUpdate elif min_value is not None and min_value >= max_value: raise PreventUpdate elif max_value is not None and max_value <= min_value: raise PreventUpdate if prob_type == 'sing-obj': configs.params['prob_type'] = Single(configs.params) else: configs.params['prob_type'] = Multi(configs.params) configs.params['num_objs'] = num_objs configs.params['objs'], configs.params['obj_names'] = [], [] dirs, names = [obj_1_goal, obj_2_goal, obj_3_goal], [obj_1_name, obj_2_name, obj_3_name] for i in range(configs.params['num_objs']): if dirs[i] == 'min': configs.params['objs'].append(min) else: configs.params['objs'].append(max) configs.params['obj_names'].append(names[i]) if enc_type == 'perm': configs.params['enc_name'] = 'Permutation' configs.params['enc_type'] = Perm(configs.params) elif enc_type == 'binary': configs.params['enc_name'] = 'Binary String' configs.params['enc_type'] = Binary(configs.params) elif enc_type == 'int': configs.params['enc_name'] = 'Integer String' configs.params['enc_type'] = Integer(configs.params) elif enc_type == 'real': configs.params['enc_name'] = 'Real-Valued String' configs.params['enc_type'] = Real(configs.params) configs.params['gene_size'] = gene_size configs.params['enc_type'].params['min_value'] = min_value configs.params['enc_type'].params['max_value'] = max_value return 'Saved'
def set_patient(self, bundle, prefix=None): """Generates and appends the Patient entry to the transaction""" if GENERATION_MAP["patient"]: patient = Patient.mpi[self.pid] if prefix: patient.pid = prefix + "-" + patient.pid # look up patient photos if self.pid in Document.documents: for d in [ doc for doc in Document.documents[self.pid] if doc.type == 'photograph' ]: data = fetch_document(self.pid, d.file_name) binary_id = uid(None, "%s-photo" % d.id, prefix) self.appendEntry( bundle, Binary({ "mime_type": d.mime_type, "content": data['base64_content'], "id": binary_id })) patient.photo_title = d.title patient.photo_code = d.mime_type patient.photo_binary_id = binary_id patient.photo_hash = data["hash"] patient.photo_size = data["size"] patientJSON = patient.toJSON(prefix) bundle = self.set_documents(bundle, prefix) self.appendEntry(bundle, Entry(patientJSON)) if patient.gestage: self.appendEntry( bundle, Entry( Observation( { "id": uid(None, "%s-gestage" % self.pid, prefix), "pid": self.pid, "date": patient.dob, "code": "18185-9", "name": "Gestational age at birth", "scale": "Qn", "value": patient.gestage, "units": "weeks", "unitsCode": "wk", "categoryCode": "exam", "categoryDisplay": "Exam" }, prefix))) return bundle
def _get_binary(data): (length, data) = _get_int(data) subtype = ord(data[0]) data = data[1:] if subtype == 2: (length2, data) = _get_int(data) if length2 != length - 4: raise InvalidBSON("invalid binary (st 2) - lengths don't match!") length = length2 if subtype == 3 and _use_uuid: return (uuid.UUID(bytes=data[:length]), data[length:]) return (Binary(data[:length], subtype), data[length:])
def main(): args = get_args() config = Config() config.MODE = config.TRAIN config.BINARY_PATH = args.binary config.BINARY_NAME = args.binary config.BAP_FILE_PATH = args.bap config.DEBUG_INFO_PATH = args.debug_info config.N2P_SERVER_URL = args.n2p_url config.STAT_PATH = args.stat config.TWO_PASS = args.two_pass config.FP_MODEL_PATH = args.fp_model if config.TWO_PASS: reg_dict = open(os.path.join(config.FP_MODEL_PATH, 'reg.dict'), 'rb') reg_model = open(os.path.join(config.FP_MODEL_PATH, 'reg.model'), 'rb') reg_support = open(os.path.join(config.FP_MODEL_PATH, 'reg.support'), 'rb') config.REG_DICT = pickle.load(reg_dict, encoding='latin1') config.REG_SUPPORT = pickle.load(reg_support, encoding='latin1') config.REG_DICT.restrict(config.REG_SUPPORT.get_support()) config.REG_MODEL = pickle.load(reg_model, encoding='latin1') config.REG_MODEL.n_jobs = 1 off_dict = open(os.path.join(config.FP_MODEL_PATH, 'off.dict'), 'rb') off_model = open(os.path.join(config.FP_MODEL_PATH, 'off.model'), 'rb') off_support = open(os.path.join(config.FP_MODEL_PATH, 'off.support'), 'rb') config.OFF_DICT = pickle.load(off_dict, encoding='latin1') config.OFF_SUPPORT = pickle.load(off_support, encoding='latin1') config.OFF_DICT.restrict(config.OFF_SUPPORT.get_support()) config.OFF_MODEL = pickle.load(off_model, encoding='latin1') config.OFF_MODEL.n_jobs = 1 with open(config.BINARY_PATH, 'rb') as elffile, open(config.DEBUG_INFO_PATH, 'rb') as debug_elffile: TIMER.start_scope('0ALL') b = Binary(config, elffile, debug_elffile) TIMER.start_scope('2CRF') b.set_test_result_from_server(True) TIMER.end_scope() TIMER.end_scope() b.dump_stat() if config.TWO_PASS: reg_dict.close() reg_support.close() reg_model.close() off_dict.close() off_support.close() off_model.close()
def main(): args = get_args() # only analyse the graph if it has not been done before if os.path.isfile(args.graph): return config = Config() config.MODE = config.TRAIN config.BINARY_PATH = args.binary config.BINARY_NAME = args.binary config.DEBUG_INFO_PATH = args.debug_info config.BAP_FILE_PATH = args.bap config.GRAPH_PATH = args.graph config.TWO_PASS = args.two_pass config.FP_MODEL_PATH = args.fp_model if config.TWO_PASS: reg_dict = open(os.path.join(config.FP_MODEL_PATH, 'reg.dict'), 'rb') reg_model = open(os.path.join(config.FP_MODEL_PATH, 'reg.model'), 'rb') reg_support = open(os.path.join(config.FP_MODEL_PATH, 'reg.support'), 'rb') config.REG_DICT = pickle.load(reg_dict, encoding='latin1') config.REG_SUPPORT = pickle.load(reg_support, encoding='latin1') config.REG_DICT.restrict(config.REG_SUPPORT.get_support()) config.REG_MODEL = pickle.load(reg_model, encoding='latin1') config.REG_MODEL.n_jobs = 1 off_dict = open(os.path.join(config.FP_MODEL_PATH, 'off.dict'), 'rb') off_model = open(os.path.join(config.FP_MODEL_PATH, 'off.model'), 'rb') off_support = open(os.path.join(config.FP_MODEL_PATH, 'off.support'), 'rb') config.OFF_DICT = pickle.load(off_dict, encoding='latin1') config.OFF_SUPPORT = pickle.load(off_support, encoding='latin1') config.OFF_DICT.restrict(config.OFF_SUPPORT.get_support()) config.OFF_MODEL = pickle.load(off_model, encoding='latin1') config.OFF_MODEL.n_jobs = 1 with open(config.BINARY_PATH, 'rb') as elffile, open(config.DEBUG_INFO_PATH, 'rb') as debug_elffile: b = Binary(config, elffile, debug_elffile) if config.GRAPH_PATH != '': b.dump_graph() if config.TWO_PASS: reg_dict.close() reg_support.close() reg_model.close() off_dict.close() off_support.close() off_model.close()
def set_clinical_notes(self, bundle, prefix=None): """Generates and appends a ClinicalNote entry to the transaction""" if GENERATION_MAP[ "ClinicalNotes"] and self.pid in ClinicalNote.clinicalNotes: for d in ClinicalNote.clinicalNotes[self.pid]: if d.mime_type == 'text/plain': data = fetch_document(self.pid, d.file_name) # d.content = data['base64_content'] # b = d # id = uid("Binary", "%s-note" % d.id, prefix) # d.binary_id = id binary_id = uid(None, "%s-note" % d.id, prefix) note = Binary({ "mime_type": d.mime_type, "content": data['base64_content'], "id": binary_id }) bundle["entry"].append(note) # if GENERATION_MAP["Documents"]: docRef = Document({ 'ID': uid(None, "%s-note-ref" % d.id, prefix), 'PID': self.pid, 'DATE': datetime.now().strftime("%Y-%m-%dT%H:%M:%S+" + "05:00"), #.isoformat(), 'TITLE': "Note", 'MIME_TYPE': d.mime_type, 'FILE_NAME': d.file_name, 'TYPE': "Note", 'mime_type': d.mime_type }) bundle["entry"].append( docRef.toJSON(data, binary_id, prefix)) # id = uid("DocumentReference", "%s-note" % d.id, prefix) # d.system = "http://loinc.org" # d.code = '34109-9' # d.display = 'Note' # template = template_env.get_template('document.xml') # print >>pfile, template.render(dict(globals(), **locals())) return bundle
def generate_feature(b, bin_dir, debug_dir, bap_dir): try: config = Config() config.BINARY_NAME = b config.BINARY_PATH = os.path.join(bin_dir, b) config.DEBUG_INFO_PATH = os.path.join(debug_dir, b) if bap_dir != '': config.BAP_FILE_PATH = os.path.join(bap_dir, b) with open(config.BINARY_PATH, 'rb') as elffile, open(config.DEBUG_INFO_PATH, 'rb') as debug_elffile: b = Binary(config, elffile, debug_elffile) return b.get_features() except Exception as e: print('Exception in binary anaylsis: ' + e) return [], [], [], []
def main(): args = get_args() config = Config() config.MODE = config.TEST config.BINARY_PATH = args.binary config.BINARY_NAME = args.binary config.OUTPUT_BINARY_PATH = args.output config.BAP_FILE_PATH = args.bap config.MODIFY_ELF_LIB_PATH = args.elf_modifier config.TWO_PASS = args.two_pass config.FP_MODEL_PATH = args.fp_model if config.TWO_PASS: reg_dict = open(os.path.join(config.FP_MODEL_PATH, 'reg.dict'), 'rb') reg_model = open(os.path.join(config.FP_MODEL_PATH, 'reg.model'), 'rb') reg_support = open(os.path.join(config.FP_MODEL_PATH, 'reg.support'), 'rb') config.REG_DICT = pickle.load(reg_dict, encoding='latin1') config.REG_SUPPORT = pickle.load(reg_support, encoding='latin1') config.REG_DICT.restrict(config.REG_SUPPORT.get_support()) config.REG_MODEL = pickle.load(reg_model, encoding='latin1') config.REG_MODEL.n_jobs = 1 off_dict = open(os.path.join(config.FP_MODEL_PATH, 'off.dict'), 'rb') off_model = open(os.path.join(config.FP_MODEL_PATH, 'off.model'), 'rb') off_support = open(os.path.join(config.FP_MODEL_PATH, 'off.support'), 'rb') config.OFF_DICT = pickle.load(off_dict, encoding='latin1') config.OFF_SUPPORT = pickle.load(off_support, encoding='latin1') config.OFF_DICT.restrict(config.OFF_SUPPORT.get_support()) config.OFF_MODEL = pickle.load(off_model, encoding='latin1') config.OFF_MODEL.n_jobs = 1 config.N2P_SERVER_URL = args.n2p_url with open(config.BINARY_PATH, 'rb') as elffile: b = Binary(config, elffile) b.set_test_result_from_server() b.modify_elf() if config.TWO_PASS: reg_dict.close() reg_support.close() reg_model.close() off_dict.close() off_support.close() off_model.close()
def main(): options = Arguments().get_args() binary = Binary(options) exec_sections = binary.get_exec_sections() data_sections = binary.get_data_sections() gadgets = Gadgets(exec_sections, options) gadgets.pretty_print_gadgets() strings = Strings(exec_sections + data_sections) strings.pretty_print_strings() ropchain = Ropchain(gadgets.get_gadgets(), binary.get_data_section_offset()) ropchain.pretty_print_chain()
def open(self): ''' Permet d'ouvrir un fichier .thc ou .txt pour le lire et le modifier :return: (translate) Class translate contenant le texte ''' translate = Translate() self.OpenFileDialog() if self.file.lower().endswith(".txt"): doc = open(self.file, "r", encoding='utf8') text = doc.read() translate.toBin(text) return translate binary = Binary() if self.file == "": return None doc = open(self.file, "rb") data = self.bytes2binstr(doc.read()) doc.close() dic = "" text = "" isDic = True countLenDic = 0 for i in range(len(data) // 7 + ceil((len(data) % 7) / 7)): value = "" for y in range(7): b = "" if isDic: b = "0" if len(data) >= i * 7 + y + 1: b = data[i * 7 + y] value += b if value == cbch["[SUPERSEP¤]"]: isDic = False elif isDic: countLenDic += 7 if isDic: dic += value else: if value != cbch["[SUPERSEP¤]"]: text += value translate.toText(text[(len(text) % 8):], binary.SaveToDict(dic)) return translate
def set_documents(self, bundle, prefix=None): """Generates and appends a SmokingStatus entry to the transaction""" if self.pid in Document.documents and GENERATION_MAP["Documents"]: for d in [ doc for doc in Document.documents[self.pid] if doc.type != 'photograph' ]: data = fetch_document(self.pid, d.file_name) # d.content = data['base64_content'] # d.size = data['size'] # d.hash = data['hash'] # b = d # id = uid("Binary", "%s-document" % d.id, prefix) # d.binary_id = id # template = template_env.get_template('binary.xml') # print >>pfile, template.render(dict(globals(), **locals())) doc = Binary({ "mime_type": d.mime_type, "content": data['base64_content'], "id": uid(None, "%s-document" % d.id, prefix) }) # bundle["entry"].append(doc) patientFile = open( os.path.join( self.path, "patient-%s-document-%s.fhir-bundle.json" % (self.pid, d.id)), "w") print >> patientFile, pp_json({ "resourceType": "Bundle", "type": "transaction", "entry": [doc] }) # id = uid("DocumentReference", "%s-document" % d.id, prefix) # d.system = 'http://smarthealthit.org/terms/codes/DocumentType#' # d.code = d.type # d.display = d.type # template = template_env.get_template('document.xml') # print >>pfile, template.render(dict(globals(), **locals())) # if GENERATION_MAP["Documents"]: # if self.pid in SocialHistory.socialHistories: # bundle["entry"].append( # SocialHistory.socialHistories[self.pid].toJSON(prefix) # ) return bundle
def do_binary(self, s, silent=False): # Do not split the filename with spaces since it might contain # whitespaces if len(s) == 0: if not silent: return self.help_binary() return False binary = s self.__options.binary = binary self.__binary = Binary(self.__options) if self.__checksBeforeManipulations() == False: return False if not silent: print "[+] Binary loaded"
def test_binary_illegal_index(): with pytest.raises(IndexError): Binary('01101010')[7]
def test_binary_negative_index(): assert Binary('0101110001')[-1] == '1' assert Binary('0101110001')[-2] == '0'
def test_binary_get_bit(): binary = Binary('0101110001') assert binary[0] == '1' assert binary[5] == '1'
def test_binary_division_rem_binary(): assert Binary(21) / Binary(5) == Binary(4)
def test_binary_division_binary(): assert Binary(20) / Binary(5) == Binary(4)
def test_binary_division_rem_int(): assert Binary(21) / 4 == Binary(5)
def test_binary_division_int(): assert Binary(20) / 4 == Binary(5)
def test_binary_multiplication_binary(): assert Binary(5) * Binary(6) == Binary(30)
def test_binary_multiplication_int(): assert Binary(5) * 4 == Binary(20)