class Get_lesson(TaskSet): #下面是请求接口所要用到的东西,包括请求参数t,请求头header t = { "lesson_code": "K00101", "timestamp": str(int(time.time())), "token": login_lanting.auto_login_by_UID(), "nonce": Hash.get_digit() } t['sign'] = Hash.get_sign(t) header = { 'User-Agent': 'LanTingDoctor/1.3.1 (iPad; iOS 10.1.1; Scale/2.00)', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'zh-Hans-CN;q=1', 'Content-Type': 'application/json', 'requestApp': '3', 'requestclient': '2', 'versionForApp': '2.0', 'Authorization': 'Basic YXBpTGFudGluZ0BtZWRsYW5kZXIuY29tOkFwaVRobWxkTWxkQDIwMTM=', 'Connection': 'keep-alive' } #task()括号中代表执行压测时的比重 @task(1) def get_lesson(self): url = '/v1/lesson' r = self.client.post('/v1/lesson', headers=self.header, json=self.t) result = r.json() assert r.json()['code'] == 200
def E_Signature(hashedValue, d, n): h = Hash.binaryToDecimal(hashedValue) h = str(h) # encryption with private key for creating e-signature c = encryption(h, d, n) return c
def receive_msg(self, hash): print("Trying to receive") if self.should_stop(): return False # print("Should Receive") try: data, address = self.client_socket.recvfrom(BUFFER_SIZE) msg = EncoderDecoder.decodeMessage(data) if msg is not None: # print("Received!!! type - " + str(msg.type)) if msg.type == 4: # ACK curr_hash_result = msg.origin_start if Hash.valid_ack(hash, curr_hash_result): # HURRAY print("Team " + msg.team_name + " has found the result!") self.hash_result = curr_hash_result self.found_result = True return False else: print("Team " + msg.team_name + " is on team Cap.") elif msg.type == 5: # NAck self.set_future_nack(address[0], address[1], msg) return True else: return True except: return True
def Login(): now2 = datetime.datetime.now() uname = request.form['uname'] passw = request.form['pass'] passw = Hash.hashPassword(passw) passw = passw.decode("utf-8") print(passw) cur.execute('SELECT uname, password FROM users') details = cur.fetchall() details = list(details) if (uname, (passw)) in details: session["il"] = True return render_template('index.html', names=PreKidsVar, Names=["Hallo, " + uname]) else: return render_template('Fail.html')
def create(self): Counter.increment('hostcounter') identifier = Hash.sha256(str(Counter.getValue('hostcounter'))) return response.reply({ 'identifier': identifier, 'socket_token': channel.create(identifier) })
def Pry(): Proyecto=Hash.FileSystem() #Proyecto.addFile("txt1.txt") #Proyecto.addFile("txt2.txt") Proyecto.FileContent() #Proyecto.updateFile("Archivo1") command='' while True: command=input("Enter your Command: ") if command is "show": Proyecto.printFiles() elif (command is "delete"): filetmp=input("Enter the file name:") Proyecto.deleteFile(filetmp) print "The file was deleted succesfully." elif (command is "update"): filetmp=input("Enter the file name:") Proyecto.updateFile(filetmp) print "The file was updated succesfully." elif (command is "add"): filetmp=input("Enter the file name:") Proyecto.addFile(filetmp) print "The file was added succesfully." elif (command is "help"): print "This is a FileSystem simulator 2015. \n" print "The commands avaliable are: \n" print "add, delete, update, show and quit \n" elif (command is "quit"): return "Good Bye" else: print "Invalid command, type help for more information"
def get_tests(): tests = [] import Cipher; tests += Cipher.get_tests() import Hash; tests += Hash.get_tests() import PublicKey; tests += PublicKey.get_tests() # import Random; tests += Random.get_tests() # import Util; tests += Util.get_tests() return tests
def cipher_key(password, key): pass_hash = Hash.blake_hash(password, 64) formatted_hash = Util.encode_int_list([pass_hash]) turn_keys = ThreeFish.keygenturn(formatted_hash) formatted_key = format_key(key) ciph_key = ThreeFish.cbc_threefish_cipher(formatted_key, turn_keys, 512) ciph_key = Util.desorganize_datalistorder(ciph_key) return format_key(ciph_key)
def calc_hash(self): #更新整棵树的hash值 self.node = [] self.cstr = [] tmp2 = [] cnt = len(self.data) n = len(self.data) for i in range(n): tmp = str(self.data[i].h) + str(self.data[i].r) + zsign.to_str( self.data[i]) if self.data[i].sigma != None and not (zsign.verify( tmp, self.data[i].sigma, self.data[i].pk)): print('MSIG!') pass if self.data[i].sigma == None: tmp2.append('0' * 200) self.cstr.append('') elif chrs.HashCheck_CHRS(self.data[i].mpk, self.data[i].spk, self.data[i].h, self.data[i].r, self.data[i].arbitrary): tmp2.append(hex(self.data[i].h)[2::]) self.cstr.append(self.data[i].r) else: print(zsign.to_str(self.data[i])) print('MCHRS!') standard_part = zsign.to_str( self.data[i], ['h', 'r', 'sigma', 'spk', 'pk', 'mpk', 'arbitrary']) if self.data[i].sigma != None: ht, rt = Hash.Hash(RSA.importKey(self.data[i].pk), standard_part) ht = hex(ht)[2::] rt = hex(rt) else: ht = '0' * 200 rt = '' tmp2.append(ht) self.cstr.append(rt) cnt = 2 * n self.node.append(tmp2) #print(len(tmp2),cnt) #print(len(self.data)) while cnt > 1: #其余层 tmp = [] for i in range(0, cnt, 2): tmp1 = self.node[-1][i] if i + 1 < len(self.node[-1]): tmp2 = self.node[-1][i + 1] else: tmp2 = '' tmp.append(zsign.sha256(tmp1 + tmp2)) cnt = cnt // 2 self.node.append(tmp) return self.node[-1][0] #返回树根hash值
class User(TaskSet): #下面是请求头header header = { 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.108 Safari/537.36 2345Explorer/8.0.0.13547', 'Accept-Encoding': 'gzip', 'X-Requested-With': 'XMLHttpRequest', 'Content-Type': 'application/json', 'requestApp': '2', 'requestclient': '2', 'versionForApp': '4.3.1', 'Authorization': 'Basic YXBpTGFudGluZ0BtZWRsYW5kZXIuY29tOkFwaVRobWxkTWxkQDIwMTM=', 'Connection': 'keep-alive' } #发布渟说的入参 t = { "token": login_lanting.auto_login_by_UID(), "text": '嘻嘻嘻嘻嘻嘻', "nonce": Hash.get_digit(), "timestamp": str(int(time.time())) } t['sign'] = Hash.get_sign(t) #加入圈子的入参 d = { "token": login_lanting.auto_login_by_UID(), "group_id": "G00006", "timestamp": str(int(time.time())), "nonce": Hash.get_digit() } d['sign'] = Hash.get_sign(d) #task()括号中代表执行压测时的比重 @task(1) def post_word(self): u'发布文字渟说' r = self.client.post('/v1/feed/add', headers=self.header, json=self.t) result = r.json() #assert r.json()['code'] == 200 @task(1) def post_artical(self): u'发布文章接口' r = self.client.post('/v1/group/add', headers=self.header, json=self.d) result = r.json()
def get_tests(config={}): tests = [] import Cipher; tests += Cipher.get_tests(config=config) import Hash; tests += Hash.get_tests(config=config) import Protocol; tests += Protocol.get_tests(config=config) import PublicKey; tests += PublicKey.get_tests(config=config) import Random; tests += Random.get_tests(config=config) import Util; tests += Util.get_tests(config=config) return tests
def decipher_key(password, ciphered_key): pass_hash = Hash.blake_hash(password, 64) formatted_hash = Util.encode_int_list([pass_hash]) turn_keys = ThreeFish.keygenturn(formatted_hash) ciphered_key = deformat_key(ciphered_key) ciphered_key = Util.organize_data_list(ciphered_key, 8) formatted_key = ThreeFish.cbc_threefish_decipher(ciphered_key, turn_keys, 512) return deformat_key(formatted_key)
def generate_signature(action, parameters): SECRET_STRING = "mTGPli7doNEpGfaVB9fquWfuAis" sorted_parameters = sorted(parameters.iteritems(), key=operator.itemgetter(0)) paramsString = '' for item1, item2 in sorted_parameters: paramsString += str(item1) + str(item2) data = SECRET_STRING + action + paramsString return Hash.SHA1(data)
def BAckend(code, mail): password = request.form["password"] username = request.form["uname"] cur.execute( "UPDATE users(uname,password) VALUES('{}','{}') WHERE uname={}".format( username, Hash.hashPassword(password), username)) mydb.commit()
def confirm_signature(hashedValue, e, n, e_signature): h = Hash.binaryToDecimal(hashedValue) h = str(h) m = decryption(e_signature, e, n) m = ''.join(m) if h == m: print('E-Signature is confirmed!') else: print('The E-Signature is not authentic!')
def read_f_into_Hash_table(file, h_func): insertions = 0 words = Hash.HashTable((400000), alpha_value, 0) forHash = io.open(file, 'r+', encoding="UTF-8") for line in forHash: a = line.split() #Direguards "words" in file that do not begin witch characters from the alphabet if (a[0] >= 'A' and a[0] <= 'Z') or (a[0] >= 'a' and a[0] <= 'z'): insertions += 1 words.insert(a[0], a[1:len(a)], h_func) return words
def cipher_bloc(bloc, key): p, a1, a2, X, Y, W = key[0], key[1], key[2], key[3], key[4], key[5] rand = SystemRandom() b = rand.randint(2, p-1) B1 = pow(a1, b, p) B2 = pow(a2, b, p) c = (pow(W, b, p) * bloc) % p concat = (B1 + B2 + c) % p h = Hash.blake_hash(str(concat), 64) % p v = (pow(X, b, p) * pow(Y, b * h, p)) % p return B1, B2, c, v
def send_to_servers(self, hash, msg_length): hash_range = Hash.divide_range(msg_length, self.available_servers) for i, (server, team_name) in enumerate(self.available_servers): print("Request sent to team " + team_name + ", address: " + str(server)) curr_hash_range = [hash_range[i][0], hash_range[i][1]] self.send_request(hash, msg_length, curr_hash_range[0], curr_hash_range[1], server) current_msg_result = Future() current_msg_result.Init(curr_hash_range, server) self.add_future(current_msg_result) current_msg_result.start_timer() self.filter_servers()
def insert(self, read): # Insert read into the HLL, convert read to base 4 -> base 10 -> base 2 read.upper() # Capitalization ensures proper conversion b_four_read = "" # Base 4 conversion for b in read: if b == 'A': b_four_read += "0" elif b == 'C': b_four_read += "1" elif b == 'G': b_four_read += "2" elif b == 'T': b_four_read += "3" b_ten_read = 0 read_len = len(b_four_read) # Base 10 conversion for c in b_four_read: b_ten_read = b_ten_read + (int(c) * (4**(read_len - 1))) read_len = read_len - 1 # Call to hash function, returns a 64-bit hash value read_hash = Hash.hash64shift(b_ten_read) read_hash = "{0:b}".format(read_hash) # Converts into binary len_read_hash = len(read_hash) # Ensures proper length of the hashed value in case the value is too small for extend to 64 bits if len_read_hash < 64: zeroes = "".join(["0"] * (64 - len_read_hash)) read_hash = zeroes + read_hash a = read_hash[0: self.p] # First p bits of (p + q)-bit hash value of read b = read_hash[ self.p:] # Following q bits of (p + q)-bit hash value of read k = b.find('1') + 1 # be sure to add 1 to match match from Ertl paper if k == -1: k = self.q + 1 i = int(a, 2) # Indexing into HLL # Insert into HLL if k > self.registers[i]: self.registers[i] = k return
def read_f_into_Hash_table(file, h_func): insertions = 0 words = Hash.HashTable((400000), alpha_value) ## why did you choose 400000 instead of any other value? forHash = io.open(file, 'r+', encoding="UTF-8") ## why not just save the file as UTF-8? for line in forHash: a = line.split() #Direguards "words" in file that do not begin witch characters from the alphabet if (a[0] >= 'A' and a[0] <= 'Z') or (a[0] >= 'a' and a[0] <= 'z'): ## you can use a is char instead of the line above insertions += 1 words.insert(a[0], a[1:len(a)], h_func) print("load factor :", len(words.table) * .75) return words
def get_tests(config={}): tests = [] import Cipher tests += Cipher.get_tests(config=config) import Hash tests += Hash.get_tests(config=config) import Protocol tests += Protocol.get_tests(config=config) import PublicKey tests += PublicKey.get_tests(config=config) import Random tests += Random.get_tests(config=config) import Util tests += Util.get_tests(config=config) return tests
def main(): if len(sys.argv) < 6: print "Incorrect parameters! Retry with correct cmd parameters" print "filename n_attr buffers btree/hash blocksize" sys.exit(0) filename = str(sys.argv[1]) n_attr = int(sys.argv[2]) M = int(sys.argv[3]) indexType = str(sys.argv[4]) block_size = int(sys.argv[5]) # if block_size % (INT_SIZE * n_attr) != 0: # print "Block size should be a multiple of " + str(INT_SIZE) + " * n" # sys.exit(0) if not os.path.isfile(filename): print "Enter valid Relation file name" sys.exit(0) if indexType.lower() == "hash": Hash.distinct(filename, n_attr, M, block_size) elif indexType.lower() == "btree": Btree.distinct(filename, n_attr, M, block_size) else: print "Incorrect type of index; should be either btree or hash" sys.exit(0)
def decipher_bloc(bloc, key): p, x1, x2, y1, y2, w = key[0], key[1], key[2], key[3], key[4], key[5] B1, B2, c, v = bloc[0], bloc[1], bloc[2], bloc[3] # 1 : Validate bloc concat = (B1 + B2 + c) % p h = Hash.blake_hash(str(concat), 64) % p # Method 1 bx = (pow(B1, x1, p) * pow(B2, x2, p)) % p by = (pow(B1, y1, p) * pow(B2, y2, p)) % p vv = (bx * pow(by, h, p)) % p # Compute res only if bloc is validated. if vv == v: return (Arithmod.inv(pow(B1, w, p), p) * c) % p
def create(self, Webapp2Instance, name, model, pin): user = self() latlon = LatLon.getCurrentPosition(Webapp2Instance) user.lat = latlon['lat'] user.lon = latlon['lon'] user.name = name user.model = model user.pin = pin Counter.increment('mobilecounter') user.identifier = Hash.sha256(str(Counter.getValue('mobilecounter'))) user.put() return response.reply({'identifier': user.identifier})
def __getitem__(self, key): if type(key) is not str: raise TypeError with open(self._index_path, mode="rb") as self._index: # read header self.word_len = struct.unpack("I", self._index.read(4))[0] self.format_string = str(self.word_len) + "sII" self.chunk_size = struct.calcsize(self.format_string) self._index # Get word list boundaries low, high = Hash.Hash("hash.dat")[key] # Get the offset and length of the index list offset, length = self.binary_search(key, low, high) with open(self._link_path, mode="rb") as f: return Links.Links(f).get(offset, length)
def create(self, Webapp2Instance, name, model, pin): user = self() latlon = LatLon.getCurrentPosition(Webapp2Instance) user.lat = latlon['lat'] user.lon = latlon['lon'] user.name = name user.model = model user.pin = pin Counter.increment('mobilecounter') user.identifier = Hash.sha256(str(Counter.getValue('mobilecounter'))) user.put() return response.reply({ 'identifier': user.identifier })
def build(self, korpus): # Reading all words from our korpus words, word_len = self.parse_korpus(korpus) print("Läst alla ord..") self.word_len = word_len # Build the word Links index file links_words = [] with open(self._link_path, mode="wb") as f: self._links = Links.Links(f) links_words = self._links.build( words) # from Links: (word, offset, size) # Build the main Index file word_indices = self.write(self._index_path, links_words, self.word_len) # Build the Hash index file self._hash = Hash.Hash("hash.dat", word_indices)
def handleUserInsertedNick(self, nick): #Logowanie uzytkownika self.__model.setNick(nick) print ("Core: logowanie z nickiem %s" % nick) self.__model.setMyId(Hash.generateUserId(nick)) try: print "Core: tworze serwer TCP" self.tcpFactory = TCPServer.startTCPServer(self.__reactor) netAddr = self.__model.getPreferredNodesAddr() if netAddr: print "Core: tworze klienta tcp do polaczenia do %s" % netAddr TCPClient.startReversedTCPConnection(self.__reactor, netAddr) else: print "Core: tworze klienta broadcast" self.broadcastSender = BroadcastSender.startSender(self.__reactor) except socket.error as err: print("Core: nie można uruchomić zerwer TCP lub wyslac rozgloszenia") traceback.print_exc() sys.exit()
def Read(continue_reading, MIFAREReader, database): cont = continue_reading print ("Please place the card near the reader\n") while cont: # Scan for cards (status, TagType) = MIFAREReader.MFRC522_Request(MIFAREReader.PICC_REQIDL) # If a card is found if status == MIFAREReader.MI_OK: print ("Card detected\n") # Get the UID of the card (status, uid) = MIFAREReader.MFRC522_Anticoll() # If we have the UID, continue if status == MIFAREReader.MI_OK: cont = False # This is the default key for authentication key = [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF] # Select the scanned tag MIFAREReader.MFRC522_SelectTag(uid) # Authenticate status = MIFAREReader.MFRC522_Auth(MIFAREReader.PICC_AUTHENT1A, 8, key, uid) # Check if authenticated if status == MIFAREReader.MI_OK: cardID = str(MIFAREReader.MFRC522_Read(8)) MIFAREReader.MFRC522_StopCrypto1() else: print ("Authentication error") h_ash = Hash.hashData(cardID) print ((30 * "-", "FINISHED READING", 30 * "-")) return h_ash
""" points = GeoSearch.getPointInfo(pointInfo) kd = GeoSearch.kdTree() for p in points: kd.put(p, p.label) kd.leveltravse() # 18 separateChainHash = """ O 1 J 2 U 1 G 2 F 1 D 2 I 1 K 0 P 2 V 2 A 2 L 1 """ dict, li = Hash.getDict(separateChainHash) chain = Hash.ChainHash(3, dict) for i in li: chain.put(i) chain.search("P")
message = raw_input("Enter Message to be encrypted > ") def encryption(Public_Key, msg): C1 = EccMultiply(GPoint, k) C2 = EccMultiply(Public_Key, k)[0] + int(msg) return (C1, C2) decrypted_string = '' def decryption(C1, C2, private_Key): solution = C2 - EccMultiply(C1, private_Key)[0] return (solution) (C1, C2) = encryption(gen_pubKey(), Hash.encode(message)) decrypted_string = decryption(C1, C2, privKey) s = Hash.decode(str(decrypted_string)) print("Cipher Text : ", C1, C2) print("-----") print(" **Original Message** ") print(s)
# Take in from command line arguments else: input = sys.argv[1] # sys.argv[0] is this file's name (Driver.py) # Does this input exists and is input a file (not a directory). if os.path.exists(input) or os.path.isfile(input): file = open(input, 'r') # open file for reading parser = Parser.Parser(file) # construct new parser object. (count, color, steps, board) = parser.parse() # Parse the file. file.close() if count == "1": print MoveGenerator.MoveGenerator.randSetup(color) else: hash = Hash.Hash() # Construct a new hash hash.calculateHashkey(board) # Calculate the hash key for this given board. nega = Negascout.Negascout(board, color) unfilteredAnswer = nega.negascout(3,(-999999,"",board,hash.get_hashkey()), (999999,"",board,hash.get_hashkey()), board, color, steps, count, hash) unfilteredMoves = unfilteredAnswer[1].split('|') filteredAnswer = (unfilteredAnswer[0], unfilteredMoves[1]) print unfilteredMoves[1].strip() Common.displayBoard(unfilteredAnswer[2]) else: print "File not found"
def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(_translate("MainWindow", "THRAM - The Ultimate Triage Solution", None)) self.ProjectNaam.setPlaceholderText(_translate("MainWindow", "Project naam", None)) self.naamOnderzoeker.setPlaceholderText(_translate("MainWindow", "Naam (hoofd)onderzoeker", None)) self.makeCasus.setPlaceholderText(_translate("MainWindow", "Casus naam", None)) self.makeComputernaam.setPlaceholderText(_translate("MainWindow", "Identificatienummer apparaat", None)) self.getProject.setText(_translate("MainWindow", "Geselecteerd project", None)) self.getCasus.setText(_translate("MainWindow", "Geselecteerde casus", None)) self.getComputernaam.setText(_translate("MainWindow", "Computernaam", None)) self.pushProject.setText(_translate("MainWindow", "Nieuw Project", None)) self.projectOpslaan.setText(_translate("MainWindow", "Opslaan", None)) self.pushCasus.setText(_translate("MainWindow", "Nieuwe Casus", None)) self.casusOpslaan.setText(_translate("MainWindow", "Opslaan", None)) self.tab_Menu.setTabText(self.tab_Menu.indexOf(self.tab_Project), _translate("MainWindow", "Project", None)) self.sysinfo_Button.setText(_translate("MainWindow", "Systeem informatie", None)) self.mac_label.setText(_translate("MainWindow", "MAC-adres", None)) self.compname_label.setText(_translate("MainWindow", "Computernaam ", None)) self.accinf_Button.setText(_translate("MainWindow", "Account informatie", None)) self.localip_label.setText(_translate("MainWindow", "Lokaal IP-adres", None)) self.proces_label.setText(_translate("MainWindow", "Processor", None)) self.os_label.setText(_translate("MainWindow", "Besturingssysteem ", None)) self.acname_label.setText(_translate("MainWindow", "Accountnaam ", None)) self.tab_Menu.setTabText(self.tab_Menu.indexOf(self.tab_System), _translate("MainWindow", "Systeem", None)) self.btn_Processen.setText(_translate("MainWindow", "Processen", None)) self.btn_Services.setText(_translate("MainWindow", "Services", None)) self.btn_Software.setText(_translate("MainWindow", "Software", None)) self.btn_Cloud.setText(_translate("MainWindow", "Cloud", None)) self.treew_Software.headerItem().setText(0, _translate("MainWindow", " ", None)) self.treew_Software.headerItem().setText(1, _translate("MainWindow", " ", None)) self.treew_Software.headerItem().setText(2, _translate("MainWindow", " ", None)) self.treew_Software.headerItem().setText(3, _translate("MainWindow", " ", None)) self.treew_Software.headerItem().setText(4, _translate("MainWindow", " ", None)) self.treew_Software.headerItem().setText(5, _translate("MainWindow", " ", None)) self.treew_Software.headerItem().setText(6, _translate("MainWindow", " ", None)) self.treew_Software.headerItem().setText(7, _translate("MainWindow", " ", None)) self.tab_Menu.setTabText(self.tab_Menu.indexOf(self.tab_Software), _translate("MainWindow", "Software", None)) self.chk_Mozilla_FireFox.setText(_translate("MainWindow", "Mozilla FireFox", None)) self.btn_Load_Internet_History.setText(_translate("MainWindow", "Load data", None)) self.lbl_Search_Internet_History.setText(_translate("MainWindow", "Zoeken", None)) self.chk_Internet_History_Search_Capital_Letter.setText(_translate("MainWindow", "Hoofdletter gevoelig", None)) self.lbl_Internet_History_Amount.setText(_translate("MainWindow", "Aantal:", None)) self.chk_Internet_Explorer.setText(_translate("MainWindow", "Internet Explorer", None)) self.btn_Show_Internet_History.setText(_translate("MainWindow", "Internetgeschiedenis tonen", None)) self.btn_Search_Internet_History.setText(_translate("MainWindow", "Zoeken", None)) self.lbl_Internet_History_Most_Visited.setText(_translate("MainWindow", "Meest bezocht", None)) self.lbl_Browsers.setText(_translate("MainWindow", "Browsers", None)) self.browserTreeWidget.headerItem().setText(0, _translate("MainWindow", "Browser", None)) self.browserTreeWidget.headerItem().setText(1, _translate("MainWindow", "Titel", None)) self.browserTreeWidget.headerItem().setText(2, _translate("MainWindow", "Aantal keer", None)) self.browserTreeWidget.headerItem().setText(3, _translate("MainWindow", "Laatst bezocht", None)) self.browserTreeWidget.headerItem().setText(4, _translate("MainWindow", "URL", None)) self.chk_Google_Chrome.setText(_translate("MainWindow", "Google Chrome", None)) self.tab_Menu.setTabText(self.tab_Menu.indexOf(self.tab_Internet), _translate("MainWindow", "Internet", None)) self.btn_Hash.setText(_translate("MainWindow", "Hash!", None)) self.treew_Bestanden.headerItem().setText(0, _translate("MainWindow", "Bestand", None)) self.treew_Bestanden.headerItem().setText(1, _translate("MainWindow", "Locatie", None)) self.treew_Bestanden.headerItem().setText(2, _translate("MainWindow", "Hashvorm", None)) self.treew_Bestanden.headerItem().setText(3, _translate("MainWindow", "Hashwaarde", None)) self.treew_Bestanden.headerItem().setText(4, _translate("MainWindow", "Bestandsgrootte in kb", None)) self.treew_Bestanden.headerItem().setText(5, _translate("MainWindow", "Aangepast op", None)) self.treew_Bestanden.headerItem().setText(6, _translate("MainWindow", "Laatst geopend op", None)) self.treew_Bestanden.headerItem().setText(7, _translate("MainWindow", "Aangemaakt op", None)) self.btn_Search_From.setText(_translate("MainWindow", "Geef een hoofdmap op:", None)) self.info_Search_From.setText(_translate("MainWindow", "U zoekt vanaf:", None)) self.lbl_Live_Search.setText(_translate("MainWindow", "Zoeken naar:", None)) self.tab_Menu.setTabText(self.tab_Menu.indexOf(self.tab_Files), _translate("MainWindow", "Bestanden", None)) self.menuBestand.setTitle(_translate("MainWindow", "Bestand", None)) self.menuOpties.setTitle(_translate("MainWindow", "Opties", None)) self.menuHelp.setTitle(_translate("MainWindow", "Help", None)) self.actionNieuw.setText(_translate("MainWindow", "Nieuw...", None)) self.actionOpen.setText(_translate("MainWindow", "Open...", None)) self.actionOpslaan.setText(_translate("MainWindow", "Opslaan...", None)) self.actionFuncties.setText(_translate("MainWindow", "Functies", None)) self.actionInfo.setText(_translate("MainWindow", "Gebruikershandleiding", None)) self.actionTechnical_manual.setText(_translate("MainWindow", "Technische handleiding", None)) self.actionOver.setText(_translate("MainWindow", "Over", None)) # Mitchell # The code below is used to connect methods to the buttons off the interface # IPFIT5 Buttons, Methods and other code self.setWindowTitle(_translate("MainWindow", "THRAM" + u'\u2122' + "- The Ultimate Triage Solution", None)) # Tab Project: self.pushProject.clicked.connect(lambda: self.project_location(Create_Case.outputfolder())) self.projectOpslaan.clicked.connect(lambda: self.save_project()) self.pushCasus.clicked.connect(lambda: self.maakCasus()) self.casusOpslaan.clicked.connect(lambda : self.save_casus()) # Tab Systeem: self.tab_System.setEnabled(False) self.accinf_Button.clicked.connect(lambda: self.getaccountinfo()) self.sysinfo_Button.clicked.connect(lambda: self.getsysinfo()) # Tab Software: self.tab_Software.setEnabled(False) self.btn_Processen.clicked.connect(lambda: self.status_bar("Lijst vernieuwen...", 2000)) self.btn_Processen.clicked.connect(lambda: self.fill_software_treewidget(Software.processes())) self.btn_Services.clicked.connect(lambda: self.status_bar("Lijst vernieuwen...", 2000)) self.btn_Services.clicked.connect(lambda: self.fill_software_treewidget(Software.services())) self.btn_Software.clicked.connect(lambda: self.status_bar("Lijst vernieuwen...", 2000)) self.btn_Software.clicked.connect(lambda: self.fill_software_treewidget(Software.software_installed())) self.btn_Cloud.clicked.connect(lambda: self.status_bar("Lijst vernieuwen...", 2000)) self.btn_Cloud.clicked.connect(lambda: self.fill_software_treewidget(Cloud.cloud())) # Tab Internet: self.tab_Internet.setEnabled(False) self.btn_Load_Internet_History.clicked.connect(lambda: self.fillBrowserTreewidget()) self.btn_Show_Internet_History.clicked.connect(lambda: self.zoekBrowser()) self.btn_Search_Internet_History.clicked.connect(lambda: self.zoekWoord()) self.chk_Internet_Explorer.setEnabled(False) # Tab Bestanden: self.tab_Files.setEnabled(False) self.btn_Search_From.clicked.connect(lambda: self.fill_searchbar(Hash.inputfolder())) self.btn_Hash.clicked.connect( lambda: self.fill_hash_treewidget(Hash.calculate_hash_from_multiplee_files(output_list, casuslocatie))) # Menu Opties -> Functies self.actionFuncties.triggered.connect(lambda: Select_functions.start())
import Hash import time start = time.time() for i in xrange(1000): x = Hash.digest(str(i)) if i%100 == 0: print i//10 print time.time()-start
points = GeoSearch.getPointInfo(pointInfo) kd = GeoSearch.kdTree() for p in points: kd.put(p, p.label) kd.leveltravse() # 18 separateChainHash = """ O 1 J 2 U 1 G 2 F 1 D 2 I 1 K 0 P 2 V 2 A 2 L 1 """ dict, li = Hash.getDict(separateChainHash) chain = Hash.ChainHash(3, dict) for i in li: chain.put(i) chain.search("P")
from fileOperation import * from Hash import * f = split_lines(read_file('PB1/alice.txt')) h = Hash(f) print h.list_all_keys() #search for string print h.find("Alice").get_value() #writing to file write_file(h.list_all_keys())
def eas(): if session["il"] == True: name = request.form['name'] lname = request.form['lname'] email = request.form['email'] uname = request.form['uname'] password = request.form['pass'] password = Hash.hashPassword(password) password = password.decode("utf-8") cur.execute('SELECT id FROM users') curid = cur.fetchall() lenid = len(curid) index = lenid + 1 print(index) cur.execute( "INSERT INTO details(id,email,password,name,lname) VALUES('{}','{}','{}','{}','{}')" .format(index, email, password, name, lname)) cur.execute( "INSERT INTO users(id,uname,password) VALUES('{}','{}','{}')". format(index, uname, password)) mydb.commit() import smtplib import ssl from random import random smtp_server = "smtp.gmail.com" port = 587 # For starttls sender_email = "*****@*****.**" password = "******" number = random() Misc, Use = str(number).split("0.") message = """\ Sehr geerter Herr/Frau {} Sie Haben sich Angemeldet! Bitte Keine Antwort Senden Hallo, Sie haben sich hier angemeldet, sie koennen sich mit den angegebenen loggin daten anmelden! Falls es dazu kommt das sie ihr passwort vergessen haben dann koennen sie einfach ihr passwort wiederherstellen(Unfunktionell ist gerade noch am entwikeln) Danke! (Falls sie sich nicht angemeldet haben dann ignorieren sie diese nachricht)""".format( lname) # Create a secure SSL context context = ssl.create_default_context() # Try to log in to server and send email server = smtplib.SMTP(smtp_server, port) server.ehlo() # Can be omitted server.starttls(context=context) # Secure the connection server.ehlo() # Can be omitted server.login(sender_email, password) server.sendmail(sender_email, email, message) server.quit() return render_template('Done2.html') else: return render_template('noLogin.html')