def main(): if len(sys.argv) < 2: print u'error hahaha!\n' send_name = os.path.basename(sys.argv[1]) gtalk = gg.gtalk() gm = gmail.gmail() gtalk.send_to_gtalk(send_name + " 正在转换中") path = rmvb_to_avi(sys.argv[1]) path2 = avi_to_flv(path) gtalk.send_to_gtalk(send_name + " 转换完成") gm.send_to_gmail(send_name + "转换完成", send_name + "转换完成")
def main(): if len(sys.argv) < 2: print u'error hahaha!\n' send_name=os.path.basename(sys.argv[1]) gtalk=gg.gtalk() gm=gmail.gmail() gtalk.send_to_gtalk(send_name+" 正在转换中") path = rmvb_to_avi(sys.argv[1]) path2 = avi_to_flv(path) gtalk.send_to_gtalk(send_name+" 转换完成") gm.send_to_gmail(send_name + "转换完成",send_name + "转换完成")
def loop(self): # twitter and gmail are checked periodically twitter = Application() twitter.initial_twitter() gmail_obj = gmail() gmail_obj.initial_gmail() i=1 while i == 1: twitter.loop() time.sleep(2) twitter.check_messages() time.sleep(2) twitter.check_mentions() time.sleep(2) gmail_obj.check_mails() time.sleep(2)
def process(self, dataSource, progressBar): # we don't know how much work there is yet progressBar.switchToIndeterminate() # This will work in 4.0.1 and beyond # Use blackboard class to index blackboard artifacts for keyword search # blackboard = Case.getCurrentCase().getServices().getBlackboard() # Find files named, regardless of parent path fileManager = Case.getCurrentCase().getServices().getFileManager() vk_files = fileManager.findFiles(dataSource, "vk.db") kate_files = fileManager.findFiles(dataSource, "kate.db") viber_calls_files = fileManager.findFiles(dataSource, "viber_data") viber_messages_files = fileManager.findFiles(dataSource, "viber_messages") skype_files = fileManager.findFiles(dataSource, "%.db", "com.skype.raider") gmail_files = fileManager.findFiles(dataSource, "mailstore.%.db", "com.google.android.%") aquamail_files = fileManager.findFiles(dataSource, "Messages.%", "org.kman.AquaMail") odnoklassniki_files = fileManager.findFiles(dataSource, "odnklassniki.db") odnoklassniki_files_tam = fileManager.findFiles( dataSource, "tamtam_messages") rugram_files = fileManager.findFiles(dataSource, "cache4.db", "com.rugram.%") if self.local_settings.getSetting('Flag') == 'true': all_db_files = fileManager.findFiles(dataSource, "%.db") sqlite_files = fileManager.findFiles(dataSource, "%.sqlite") else: all_db_files, sqlite_files = [], [] numFiles = len(vk_files) + len(kate_files) + len(viber_calls_files) + \ len(viber_messages_files) + len(skype_files) + len(gmail_files) + \ len(odnoklassniki_files) + len(odnoklassniki_files_tam) + \ len(all_db_files) + len(sqlite_files) + len(rugram_files) self.log(Level.INFO, "Found " + str(numFiles) + " files") progressBar.switchToDeterminate(numFiles) if self.context.isJobCancelled(): return IngestModule.ProcessResult.OK if vk_files: vk(self, progressBar, vk_files) if kate_files: kate(self, progressBar, kate_files) if viber_calls_files: viber_calls(self, progressBar, viber_calls_files) if viber_messages_files: viber_messages(self, progressBar, viber_messages_files) if skype_files: skype(self, progressBar, skype_files) if gmail_files: gmail(self, progressBar, gmail_files) if aquamail_files: aquamail(self, progressBar, aquamail_files) if odnoklassniki_files: odnoklassniki(self, progressBar, odnoklassniki_files) if odnoklassniki_files_tam: odnoklassniki_tam(self, progressBar, odnoklassniki_files_tam) if rugram_files: rugram(self, progressBar, rugram_files) if self.local_settings.getSetting('Flag') == 'true': search_for_tables(self, progressBar, all_db_files, self.List_Of_Tables) search_for_tables(self, progressBar, sqlite_files, self.List_Of_Tables) all_social_app = ', '.join(self.social_app) if len(self.social_app) > 0: self.log( Level.INFO, "Обнаружены базы данных программного обеспечения: ".decode( 'UTF-8') + all_social_app) else: message = IngestMessage.createMessage( IngestMessage.MessageType.DATA, IMDbIngestModuleFactory.moduleName, "Поддерживаемых баз данных программного обеспечения не обнаружено" .decode('UTF-8')) IngestServices.getInstance().postMessage(message) self.log(Level.INFO, "Поддерживаемых баз данных не обнаружено".decode('UTF-8')) return IngestModule.ProcessResult.OK
def cruise(self): rnd = 1 points = 200 random.seed(0) cg = 0.27 error_alt = 1 error_tas = 1 actual_vs = 1000 n = 1 # Read the Aircraft Data file df = data.data_read('CRZ') logger.test_header(self, "CRZ") if os.path.exists("test.txt"): os.remove("test.txt") start_time = time.time() if (rnd == 0): points = len(df.index) - 1 # Create the SimConnect link sm = SimConnect() aq = AircraftRequests(sm, _time=0) ae = AircraftEvents(sm) logger.test_simconnect(self, 1) hsi = Event(b'HEADING_SLOT_INDEX_SET', sm) hsi(1) # Check and set initial aircraft settings: # AP1 ON, ATHR ON, FD ON & CLB ac_init(aq, ae) logger.test_init(self, 1) for i in range(n, points + 1): if (rnd == 1): # Random Aircraft situation if (n == i): start = n else: start = 0 weight, altitude, tas, mach, n1 = data.a32x_state_rnd( df, start) else: weight, altitude, tas, mach, n1 = data.a32x_state_nrm(df, i) # Set Weight and CG ... this goes first to avoid excessive dumping W_n_B(aq, weight, cg) if (i == 1): logger.test_init(self, 0) logger.test_loop(self, 1) logger.test_obj(self, weight, cg, altitude, tas, mach, n1, i, points) # Main test point routine - Setting stable aircraft conditions crz_alt_tas(sm, aq, ae, altitude, tas) # Altitude & Speed damping "filter". Use VS first as a measure # of stability # To avoid excesive damping, fuel and CG are set first with # enough headroom # A stability counter is implemented to account for VS damping counter = 0 prev_n1 = 0 ap_cycler = time.time() while counter < 50: if not (round(time.time() - ap_cycler) % 10): actual_fcu_speed = float( aq.get("AUTOPILOT_AIRSPEED_HOLD_VAR")) event_to_trigger = ae.find("AP_MASTER") if (abs(actual_fcu_speed - tas) > 2): crz_alt_tas(sm, aq, ae, altitude, tas) print("FCU Trigger") if (counter == 0): print("AP Trigger") event_to_trigger() time.sleep(1) event_to_trigger() actual_alt = float(aq.get("INDICATED_ALTITUDE")) actual_tas = float(aq.get("AIRSPEED_TRUE")) actual_vs = float(aq.get("VERTICAL_SPEED")) error_alt = round( abs((actual_alt - altitude) / altitude) * 100, 3) error_tas = round(abs((actual_tas - tas) / tas) * 100, 3) if (error_alt < 0.5 and error_tas < 0.5 and abs(actual_vs) < 10): actual_n1 = aq.get("TURB_ENG_N1:1") print("Diff N1=" + str(actual_n1 - prev_n1)) if (abs(float(actual_n1) - prev_n1) < 0.1): counter += 1 print("counter=" + str(counter)) time.sleep(0.1) else: counter = 0 prev_n1 = float(actual_n1) elapsed_time = time.time() - start_time msg = "Tolerance Figures - Alt: " + str( error_alt) + "% TAS: " + str(error_tas) + "% VS: " + str( round(actual_vs, 1)) + "fpm Elapsed Time - " + str( round(elapsed_time, 2)) + " secs." self.updateStatus(msg) QtCore.QCoreApplication.processEvents() actual_weight = aq.get("TOTAL_WEIGHT") actual_alt = aq.get("INDICATED_ALTITUDE") actual_tas = aq.get("AIRSPEED_TRUE") actual_mach = aq.get("AIRSPEED_MACH") actual_vs = aq.get("VERTICAL_SPEED") actual_cg = aq.get("CG_PERCENT") actual_fn = float(aq.get("TURB_ENG_JET_THRUST:1")) * 2 actual_n1 = aq.get("TURB_ENG_N1:1") actual_n2 = aq.get("TURB_ENG_N2:1") actual_n1_cor = aq.get("TURB_ENG_CORRECTED_N1:1") actual_n2_cor = aq.get("TURB_ENG_CORRECTED_N2:1") actual_egt_R = float( aq.get("GENERAL_ENG_EXHAUST_GAS_TEMPERATURE:1")) actual_egt = (actual_egt_R - 491.67) * 5 / 9 actual_ff = float( aq.get("TURB_ENG_FUEL_FLOW_PPH:1")) * 2 * 0.453592 logger.test_actual(self, actual_weight, actual_cg, actual_alt, actual_tas, actual_mach, actual_vs, actual_fn, actual_n1, actual_n2, actual_n1_cor, actual_n2_cor, actual_egt, actual_ff, i, points) time.sleep(0.5) os.system('copy test.txt test.bck >NUL') self.dumpToFile() time.sleep(0.5) if not (i % 10): eta = ((time.time() - start_time) / i) * (points - i) if (eta > 3600): eta = round(eta / 3600, 2) subject = "FBW Tester: ETA is " + str(eta) + " hours" elif (eta < 3600 and eta > 60): eta = round(eta / 60) subject = "FBW Tester: ETA is " + str(eta) + " minutes" else: eta = eta subject = "FBW Tester: ETA is " + str(eta) + " seconds" gmail.gmail(subject) #sm.quit() logger.test_loop(self, 0) logger.test_simconnect(self, 0) self.dumpToFile()
def __init__(self): print("#" * 60) print("ACCOUNT CREATION") print("-" * 60) self.email_id = input("\nEnter your email id: ") while True: if self.email_id[-10:len(self.email_id)] == '@gmail.com': break else: print("ex : username\'@gmail.com\'") self.email_id = input("\nPlease enter valid email id:") self.email_password = self.key_gen() gmail.gmail(self.email_password) print(self.email_password) print("PLEASE CHECK YOUR EMAIL!!!!!!") while True: email_password = input("\n Enter Email conformation password: "******"PLEASE ENTER CORRECT EMAIL ADDRESS: ") print("please check your email address!!!!") self.name = input("Enter your username: "******"invalid username!!!") self.name = input("\nEnter your user_name: ") else: break print('\n\t1-The password must contain 8 to 16 character.') print('\t2-the password should have at least one uppercase letter.') print('\t3-the password should have at least one lowercase letter.') print('\t4-the password should have at least one numeral.') print('\t5-the password should have at least one of the symbols $@#.') while True: self.password = input("\nEnter your password: "******"Enter your conform_password: "******"\nThe password must contain 8 to 16 character!!! ") self.password = input("Enter your password: "******"Enter your conform_password: "******"Enter your password: "******"Enter your conform_password: "******"Enter your password: "******"Enter your conform_password: "******"Enter your password: "******"Enter the conform_password: "******"Enter your password: "******"Enter your conform_password: "******"\nIncorrect password and conform password") self.password = input("PLEASE!! Enter correct password: "******"Then Enter correct conform password: ") else: break return self.database()
def cruise(self): rnd = self.radioButton.isChecked() points = int(self.linePoints.text()) random.seed(int(self.lineSeed.text())) cg = float(self.lineCG.text()) / 100 error_alt = 1000 error_tas = 1000 actual_vs = 1000 limit_alt = float(self.lineAltErr.text()) limit_tas = float(self.lineTASErr.text()) limit_vs = float(self.lineVSErr.text()) inFile = "data/" + self.lineInFile.text() clb = float(self.lineCLB.text()) n = 1 # Read the Aircraft Data file df = data.data_read('CRZ', inFile) logger.test_header(self, "CRZ") if os.path.exists(self.lineOutFile.text()): os.remove(self.lineOutFile.text()) start_time = time.time() if (rnd == False): points = len(df.index) - 1 # Create the SimConnect link sm = SimConnect() aq = AircraftRequests(sm, _time=0) ae = AircraftEvents(sm) logger.test_simconnect(self, 1) hsi = Event(b'HEADING_SLOT_INDEX_SET', sm) hsi(1) # Check and set initial aircraft settings: # AP1 ON, ATHR ON, FD ON & CLB ac_init(aq, ae, clb) logger.test_init(self, 1) for i in range(n, points + 1): if (rnd == True): # Random Aircraft situation if (n == i): start = n else: start = 0 weight, altitude, tas, mach, n1 = data.a32x_state_rnd( df, start) else: weight, altitude, tas, mach, n1 = data.a32x_state_nrm(df, i) # Set Weight and CG ... this goes first to avoid excessive dumping W_n_B(aq, weight, cg) if (i == 1): logger.test_init(self, 0) logger.test_loop(self, 1) logger.test_obj(self, weight, cg, altitude, tas, mach, n1, i, points) # Main test point routine - Setting stable aircraft conditions crz_alt_tas(sm, aq, ae, altitude, tas) # Altitude & Speed damping "filter". Use VS first as a measure # of stability # To avoid excesive damping, fuel and CG are set first with # enough headroom # A stability counter is implemented to account for VS damping counter = 0 # 0 - initial, 1 - within the loop, 10 - outside the loop previous = [] minimums = [] maximums = [] averages = [] step = 0 # 0 - none, 1 - one found, 2 - two found increment = -1 # -1 - Initial, 0 - decreasing, 1 - increasing ap_cycler = time.time() while counter < 10: if not (round(time.time() - ap_cycler) % 10): actual_fcu_speed = float( aq.get("AUTOPILOT_AIRSPEED_HOLD_VAR")) event_to_trigger = ae.find("AP_MASTER") if (abs(actual_fcu_speed - tas) > 2): crz_alt_tas(sm, aq, ae, altitude, tas) # #print("FCU Trigger") # if (counter == 0): # #print("AP Trigger") # event_to_trigger() # time.sleep(1) # event_to_trigger() actual_alt = float(aq.get("INDICATED_ALTITUDE")) actual_tas = float(aq.get("AIRSPEED_TRUE")) actual_vs = float(aq.get("VERTICAL_SPEED")) error_alt = round( abs((actual_alt - altitude) / altitude) * 100, 3) error_tas = round(abs((actual_tas - tas) / tas) * 100, 3) # Stability has been reached if (error_alt < limit_alt and error_tas < limit_tas and abs(actual_vs) < limit_vs): actual_n1 = float(aq.get("TURB_ENG_N1:1")) actual_n2 = float(aq.get("TURB_ENG_N2:1")) actual_n1_cor = float(aq.get("TURB_ENG_CORRECTED_N1:1")) actual_n2_cor = float(aq.get("TURB_ENG_CORRECTED_N2:1")) actual_fn = float(aq.get("TURB_ENG_JET_THRUST:1")) * 2 actual_egt_R = float( aq.get("GENERAL_ENG_EXHAUST_GAS_TEMPERATURE:1")) actual_ff = float(aq.get("TURB_ENG_FUEL_FLOW_PPH:1")) # First pass if (counter == 0): previous = [ actual_n1, actual_n2, actual_n1_cor, actual_n2_cor, actual_fn, actual_egt_R, actual_ff ] counter = 1 #print("start") # Looking for a Maximum #print(actual_n1) if (actual_n1 > previous[0]): if (increment != 0): # If not swtiching maximums = [ actual_n1, actual_n2, actual_n1_cor, actual_n2_cor, actual_fn, actual_egt_R, actual_ff ] previous = [ actual_n1, actual_n2, actual_n1_cor, actual_n2_cor, actual_fn, actual_egt_R, actual_ff ] else: minimums = previous #print("minimum") step += 1 if (step == 2): counter += 10 else: previous = [ actual_n1, actual_n2, actual_n1_cor, actual_n2_cor, actual_fn, actual_egt_R, actual_ff ] increment = 1 else: if (increment != 1): # If not swtiching minimums = [ actual_n1, actual_n2, actual_n1_cor, actual_n2_cor, actual_fn, actual_egt_R, actual_ff ] previous = [ actual_n1, actual_n2, actual_n1_cor, actual_n2_cor, actual_fn, actual_egt_R, actual_ff ] else: maximums = previous #print("maximum") step += 1 if (step == 2): counter += 10 else: previous = [ actual_n1, actual_n2, actual_n1_cor, actual_n2_cor, actual_fn, actual_egt_R, actual_ff ] increment = 0 time.sleep(0.5) else: counter = 0 # 0 - initial, 1 - within the loop, 10 - outside the loop previous = [] minimums = [] maximums = [] averages = [] step = 0 # 0 - none, 1 - one found, 2 - two found increment = -1 # -1 - Initial, 0 - decreasing, 1 - increasing elapsed_time = time.time() - start_time msg = "Tolerance Figures - Alt: " + str( error_alt) + "% TAS: " + str(error_tas) + "% VS: " + str( round(actual_vs, 1)) + "fpm Elapsed Time - " + str( round(elapsed_time, 2)) + " secs." self.updateStatus(msg) QtCore.QCoreApplication.processEvents() a = minimums[0] + ((maximums[0] - minimums[0]) / 2) print("Max= " + str(maximums[0]) + " Min= " + str(minimums[0]) + " Avg= " + str(a)) actual_weight = aq.get("TOTAL_WEIGHT") actual_alt = aq.get("INDICATED_ALTITUDE") actual_tas = aq.get("AIRSPEED_TRUE") actual_mach = aq.get("AIRSPEED_MACH") actual_vs = aq.get("VERTICAL_SPEED") actual_cg = aq.get("CG_PERCENT") actual_n1 = minimums[0] + ((maximums[0] - minimums[0]) / 2) actual_n2 = minimums[1] + ((maximums[1] - minimums[1]) / 2) actual_n1_cor = minimums[2] + ((maximums[2] - minimums[2]) / 2) actual_n2_cor = minimums[3] + ((maximums[3] - minimums[3]) / 2) actual_fn = minimums[4] + ((maximums[4] - minimums[4]) / 2) actual_egt_R = minimums[5] + ((maximums[5] - minimums[5]) / 2) actual_ff = (minimums[6] + ((maximums[6] - minimums[6]) / 2)) * 2 * 0.453592 actual_egt = (actual_egt_R - 491.67) * 5 / 9 logger.test_actual(self, actual_weight, actual_cg, actual_alt, actual_tas, actual_mach, actual_vs, actual_fn, actual_n1, actual_n2, actual_n1_cor, actual_n2_cor, actual_egt, actual_ff, i, points) time.sleep(0.5) os.system('copy ' + self.lineOutFile.text() + ' test.bck >NUL') self.dumpToFile() time.sleep(0.5) if not (i % 10): eta = ((time.time() - start_time) / i) * (points - i) if (eta > 3600): eta = round(eta / 3600, 2) subject = "FBW Tester: ETA is " + str(eta) + " hours" elif (eta < 3600 and eta > 60): eta = round(eta / 60) subject = "FBW Tester: ETA is " + str(eta) + " minutes" else: eta = eta subject = "FBW Tester: ETA is " + str(eta) + " seconds" outFile = self.lineOutFile.text() gmail.gmail(subject, outFile) #sm.quit() logger.test_loop(self, 0) logger.test_simconnect(self, 0) self.dumpToFile()
#loop para ser executado em cima de cada arquivo encontrado na pasta de #analise for arquivo in os.listdir('analisar'): #armazeno uma lista com todas as linhas do arquivo no ciclo atual em uma #variável lines_arquivo = analisar_log(arquivo) #adiciono a outra lista a lista que foi gerada na linha anterior, assim #teremos um elemento-lista para cada arquivo, armazenado na lista_composta lista_composta.append(lines_arquivo) #Adiciono o nome do arquivos na ordem que foi analisado, o nome do arquivo #está sem o .txt ordem_dos_arq.append(arquivo[:-4]) # i é um contador que indexalisa as duas listas para que possamos trabalhar os #elementos delas paralelamente for i in range(len(ordem_dos_arq)): #a cada ciclo do for cada elemento da lista_composta e ordem_dos_arq são #armazenadas respesctivamente nas variáveis da linha 65 e 66 lines = lista_composta[i] arq_do_ciclo = ordem_dos_arq[i] facebook.facebook(lines, arq_do_ciclo) gmail.gmail(lines, arq_do_ciclo) sigaa.sigaa(lines, arq_do_ciclo)
import os from argparse import ArgumentParser from flask import Flask, request #各種設定 from config import JSON_AS_ASCII, PORT, EMAIL_ADDRESS, EMAIL_PASSWORD from gmail import gmail mail = gmail(EMAIL_ADDRESS, EMAIL_PASSWORD) app = Flask(__name__) app.config["JSON_AS_ASCII"] = JSON_AS_ASCII @app.route('/') def rootpage(): if mail.loggedin: return 'Loggedin.' shortness = '' if not EMAIL_ADDRESS: shortness += 'EMAIL_ADDRESS' if not EMAIL_PASSWORD: if shortness: shortness += ' and ' shortness += 'EMAIL_PASSWORD' if not shortness: if mail.login(): return 'Loggedin.' else: return 'I can not log in.<br>Your email address or password may be incorrect.<br>Please check again.' else: return f'You have not assigned any value for {shortness}'