def launch(scr): core( arduino_port=ARDUINO_PORT, arduino_speed=ARDUINO_SPEED, arduino_fake=simulate_arduino, SCR=scr, ncurses=run_with_curses ).start()
def api_tests(self): print("Beginning API tests...\n") print("Testing hash data...") self.out_of += 1 self.hash_data = core.core().get_api_data("hash", "7708cd4a983ca4648ffbf2eaf6860a1725b17ae86f3e6490cf85a7d7b40266c1") if ast.literal_eval(self.hash_data) == { "error": "false", "result": { "verified": "true", "address": "XopyTfnfFMLWtjed1JNBn2B72JRrJaqXLD", "username": "******", "title": "Radium SmartChain Phase 2.3 Client", "txid": "7e5ad1fbad158f20050df11fe59f4fbb9cc50c163883174804dfaa8b7e2eb091", "linuxtime": 1454470814, "date": "2016-02-03T03:40:14Z", "block": 357073 } }: self.score += 1 print("passed\n") else: print("failed\n") print("Testing username data...") self.out_of += 1 self.username_data = core.core().get_api_data("username", "JJ12880") if ast.literal_eval(self.username_data) == { "verified": "True", "address": "XopyTfnfFMLWtjed1JNBn2B72JRrJaqXLD", "username": "******", "memo": "xRADON SuperNet Developer" }: self.score += 1 print("passed\n") else: print("failed\n") print("Testing address data...") self.out_of += 1 self.address_data = core.core().get_api_data("address", "XopyTfnfFMLWtjed1JNBn2B72JRrJaqXLD") if ast.literal_eval(self.address_data) == { "error": "false", "verified": "True", "address": "XopyTfnfFMLWtjed1JNBn2B72JRrJaqXLD", "username": "******", "memo": "xRADON SuperNet Developer" }: self.score += 1 print("passed\n") else: print("failed\n") print("API tests finished\n")
def file_header_tests(self): print("Testing a standard http HEAD request...") self.out_of += 1 self.file_header_data = core.core().get_file_headers("http://www.projectradium.org/downloads/Radium%20SmartChain%20Phase%202.3.zip") if self.file_header_data['Content-Length'] == '818884' and self.file_header_data['Accept-Ranges'] == 'bytes' and self.file_header_data['server'] == 'Apache' and self.file_header_data['Last-Modified'] == 'Fri, 01 Apr 2016 04:01:26 GMT' and self.file_header_data['Content-Type'] == 'application/zip': self.score += 1 print("passed\n") else: print("failed\n") print('Testing file size limit filter...') self.out_of += 1 if core.core().is_file_under_limit("http://www.projectradium.org/downloads/Radium%20SmartChain%20Phase%202.3.zip"): self.score += 1 print("passed\n") else: print("failed\n") print("Testing file size limit filter...") self.out_of += 1 if not core.core().is_file_under_limit("http://www.projectradium.org/downloads/RadiumQuickDeploy_3.17.16.exe"): self.score += 1 print("passed\n") else: print("failed\n") print("Testing file size limit filter...") self.out_of += 1 if core.core().is_file_under_limit("https://github.com/ProjectRadium/Radium/releases/download/v1.4.2.1/Radium-qt-1.4.2.1.exe"): self.score += 1 print("passed\n") else: print("failed\n")
def main(mode): input("press ENTER to start:") # startup Picore if mode == "manual": myCore = core(False) else: myCore = core() return
def main(mode, debug): input("press ENTER to start:") # startup Picore if mode == "auto": myCore = core(True, debug) elif mode == "manual": myCore = core(False, debug) else: print("manual or auto?") return
def main(mode): input("press ENTER to start:") if mode == "run": runner = core(1) elif mode == "demo": runner = core(2) else: print("To run or to demonstrate??") runner = core(3) return
def __init__(self, proxies={'http': 'http://127.0.0.1:8080', 'https': 'http://127.0.0.1:8080'}): """ Creates an instance of the ZAP api client. :Parameters: - `proxies`: dictionary of ZAP proxies to use. Note that all of the other classes in this directory are generated new ones will need to be manually added to this file """ self.__proxies = proxies self.acsrf = acsrf(self) self.ajaxSpider = ajaxSpider(self) self.ascan = ascan(self) self.authentication = authentication(self) self.autoupdate = autoupdate(self) self.brk = brk(self) self.context = context(self) self.core = core(self) self.forcedUser = forcedUser(self) self.httpsessions = httpSessions(self) self.importLogFiles = importLogFiles(self) self.params = params(self) self.pnh = pnh(self) self.pscan = pscan(self) self.script = script(self) self.search = search(self) self.selenium = selenium(self) self.sessionManagement = sessionManagement(self) self.spider = spider(self) self.users = users(self)
def upload_page(): if request.method == 'POST': # check if there is a file in the request if 'file' not in request.files: return render_template('upload.html', msg='No file selected') file = request.files['file'] # if no file is selected if file.filename == '': return render_template('upload.html', msg='No file selected') if file and allowed_file(file.filename): # call the OCR function on it file_path = "./" + file.filename extracted_text = core(file_path) # extract the text and display it return render_template('upload.html', msg='Successfully processed image name:' + file.filename, extracted_text=extracted_text, img_src=UPLOAD_FOLDER + file.filename) elif request.method == 'GET': return render_template('upload.html')
def __init__(self, units, precision): self.unitsSI = { 'Y': 1e24, # yotta 'Z': 1e21, # zetta 'E': 1e18, # exa 'P': 1e15, # peta 'T': 1e12, # tera 'G': 1e9, # giga 'M': 1e6, # mega 'K': 1e3, # kilo 'c': 1e-2, # centi 'm': 1e-3, # milli 'u': 1e-6, # micro 'n': 1e-9, # nano 'p': 1e-12, # pico 'f': 1e-15, # femto 'a': 1e-18, # atto 'z': 1e-21, # zepto 'y': 1e-24 # yocto } self.units = units self.precision = precision self.core = core()
def handle_exit(message): if message.chat.type == 'supergroup' or message.chat.type == 'group': return True cor = core(message.from_user.id) cor.db.user_set_mode() bot.send_message(message.chat.id, "Exited") cor.close()
def handle_edit(message): if message.chat.type == 'supergroup' or message.chat.type == 'group': return True cor = core(message.from_user.id) data = cor.test(message.text, message.message_id) cor.close()
def dispatch_to_core(self, arg_dict): messageDict = arg_dict # dispatching logic goes here message = messageDict['text'] chat_id = messageDict['chat_id'] Check = self.verify_remove_user(chat_id, message) # if check is true , the user object was removed on user "Done" if Check == True: response_dict = dict() response_dict['chat_id'] = chat_id response_dict['response_list'] = ["Hi Welcome to MediBot"] response_dict['keyboard'] = create_keyboard(['Begin consultation with Doctor SkyNet']) return response_dict for user in self.object_list: if (user == messageDict['chat_id']): # print "\n\n\n" + str(user) + " found! , reusing object\n" core_obj = self.object_list[user] response_dict = core_obj.run_core(messageDict) return response_dict print bcolors.FAIL + "User with chat id" + str(chat_id) + " not found , creating new object " coreobj = core.core(chat_id, self.db_connection) self.object_list[chat_id] = coreobj # stores created object in class variable for future use. response_dict = coreobj.run_core(messageDict) return response_dict
def __init__(self,framelength=100,label=0,xmlfile='./train/mytrainSet.xml'): self._framelen=framelength self._xmlfile=xmlfile self._label=label self._core=core(faceRecognizeXmlfile=self._xmlfile) self._iosteam=IOSteam() self._window=PreviewWindowManager('TrainWindows') self._window_faceZone=PreviewWindowManager('TrainWindows.FaceZone')
def file_content_tests(self): print("Testing a standard http GET request...") self.out_of += 1 if core.core().get_file_hash("http://www.projectradium.org/downloads/Radium%20SmartChain%20Phase%202.3.zip") == "7708cd4a983ca4648ffbf2eaf6860a1725b17ae86f3e6490cf85a7d7b40266c1": self.score += 1 print("passed\n") else: print("failed\n") print("Testing a standard https GET request...") self.out_of += 1 if core.core().get_file_hash("https://github.com/ProjectRadium/Radium/releases/download/v1.4.2.1/Radium-qt-1.4.2.1.exe") == "8f965a198336d63b2de67ea7160112cc9cce131b9206ce8180ea15a4c05120cd": self.score += 1 print("passed\n") else: print("failed\n")
def post(self): parser = reqparse.RequestParser() parser.add_argument('n', type=int, required=True) args = parser.parse_args() n = args['n'] c = core(n) uid = c.do() return make_response(str(uid))
def workWithWork(self): self.answers = [] self.name_answer_dct = dict() try: self.file_path = self.lineEdit.text() files = os.listdir(self.file_path) except FileNotFoundError: print("Путь не найден") if files != []: for i in files: file = i.split('.') print(file) if file[-1] == 'jpg': self.filePathJpg.append(f"{file[0]}.jpg") #print("jpg") #print(self.filePathJpg) for i in self.filePathJpg: #print(f'{self.lineEdit.text()}/{i}') a = core.core(f"{self.lineEdit.text()}/{i}") #print(a) FIO = f"{a[1]} {a[0]} {a[2]}" #print(FIO) #print(a[3]) keys = {'0': 'A', '1': 'B', '2': 'C', '3': 'D', '4': 'E'} with open(f'{self.lineEdit_3.text()}/answers.csv', encoding="utf8") as csvfile: reader = csv.reader(csvfile, delimiter=';', quotechar='"') for index, row in enumerate(reader): trueAns = row break for i in a[3].items(): if i[1] != '-1' and len(i[1]) == 1: item = keys[i[1]] elif i[1] == '-1': item = 'No answer' else: pass self.answers.append(item) b = trueAns[0].split(",") print(b) true = 0 for j in range(len(self.answers) - 1): if self.answers[j] == b[j]: true += 1 print(self.answers) print(len(self.answers)) self.answers.append(f'{true+1}/{len(self.answers)}') self.name_answer_dct[FIO] = self.answers print(self.name_answer_dct) filepath = os.path.join(f'{self.lineEdit_2.text()}', 'answers.csv') self.csv_dict_writer(filepath, self.name_answer_dct) self.a = Ui_Form() self.a.setupUi() self.a.show() self.a.pushButton.clicked.connect(self.a.close)
def _bind(wxId, stuId, passwd): if sql.isbinded(wxId): return '你好像已经绑定了~请直接发送‘查询’查询成绩~' user = core(stuId, passwd, cookiesfile=False) if user.safeLogin(): userCode = user.getUserCode() return sql.bind(wxId, userCode) else: return '账号密码有误,请确认。'
def utime_tests(self): print("Testing conversion from Unix time to UTC...") self.out_of += 1 if core.core().get_utc_from_unix(1454470814) == "2016-02-03 03:40:14": self.score += 1 print("passed\n") else: print("failed\n")
def cal(self, event): value = self.inputbox.GetValue() output = core.core(value) bug = core.inf(value) self.outputbox.SetValue(output) self.bugbox.AppendText('\n') self.bugbox.AppendText(bug) self.inputbox.Clear() event.Skip()
def on_get(self, req, resp): """ On GET Request """ server_core = core.core() url = req.get_param('url') content = server_core.process_data(url) resp.status = falcon.HTTP_200 resp.body = json.dumps(content)
def hash_data_tests(self): print("Testing username verification for a given hash...") print("NOTE: If this test fails, you may need to change line 70 of core.py from 'True' to 'true'.") self.out_of += 1 if core.core().is_hash_acct_verified("7708cd4a983ca4648ffbf2eaf6860a1725b17ae86f3e6490cf85a7d7b40266c1"): self.score += 1 print("passed\n") else: print("failed\n") print("Testing username verification for a given hash...") print("NOTE: If this test fails, you may need to change line 70 of core.py from 'True' to 'true'.") self.out_of += 1 if core.core().is_hash_acct_verified("8f965a198336d63b2de67ea7160112cc9cce131b9206ce8180ea15a4c05120cd"): self.score += 1 print("passed\n") else: print("failed\n")
def __init__(self): self.log = [[],[],[],[]] self.running = False self.mem = memory.memory(self.update_view) self.dataBus = connexion.bus(self.mem, self.update_view) self.clk = clock.clock(self.update_clock) self.cores_list = [] self.local_total_list=[0,0,0,0] for i in range(4): self.cores_list.append(core.core(i,self.dataBus,self.clk,self.update_core))
def convert_core(): clock = Signal(bool(0)) done = Signal(bool(0)) data = Signal(intbv(0, max=2**((16 - 4) * 32))) reset = ResetSignal(False, True, False) start = Signal(bool(0)) output = Signal(intbv(0, max=2**512)) c = core.core(data, done, output, start, clock, reset) c.convert(hdl='Verilog')
def start(): data = json.loads(request.get_data()) img = base64.b64decode(data["img"]) img_path = "/home/chinasilva/code/deeplearning_homework/project_8/static/images/example.jpg" with open(img_path, 'wb') as file: file.write(img) result_data = core(net, img_path) return json.dumps(result_data)
def start(): data = json.loads(request.get_data()) img = base64.b64decode(data["img"]) img_path = "static/images/example.jpg" with open(img_path, 'wb') as file: file.write(img) result_data = core(net, img_path) return json.dumps(result_data)
def handle_edit(message): if message.chat.type == 'supergroup' or message.chat.type == 'group': return True cor = core(message.from_user.id) cor.db.user_set_mode(mode=1) bot.send_message( message.chat.id, "You're about to edit personal information. Rewrite your name in format:\nPrenom NOM\nIf you want to change nothing send /exit" ) cor.close()
def url_tests(self): print("Testing a standard http url...") self.out_of += 1 if core.core().is_valid_url("http://google.com/"): self.score += 1 print("passed\n") else: print("failed\n") print("Testing a standard https url...") self.out_of += 1 if core.core().is_valid_url("https://google.com/"): self.score += 1 print("passed\n") else: print("failed\n") print("Testing a standard url without a prefix...") self.out_of += 1 if core.core().is_valid_url("google.com/"): self.score += 1 print("passed\n") else: print("failed\n") print("Testing a non-standard TLD...") self.out_of += 1 if core.core().is_valid_url("https://verify.software/"): self.score += 1 print("passed\n") else: print("failed\n") print("Testing a malformed http url...") self.out_of += 1 if not core.core().is_valid_url("http://google"): self.score += 1 print("passed\n") else: print("failed\n") print("Testing a malformed https url...") self.out_of += 1 if not core.core().is_valid_url("https://google"): self.score += 1 print("passed\n") else: print("failed\n") print("Testing a string...") self.out_of += 1 if not core.core().is_valid_url("google"): self.score += 1 print("passed\n") else: print("failed\n")
def __init__(self): #to be reset in the son class self.STATES = States() self.stimuli = {} self.expset = Expset() self.screen = None #other self.__phase_ev = Event() self.__eegsignal = EEG() self.__core = core(self.__phase_ev, self.__eegsignal, self.STATES, self.expset)
def single(self, config_path='configs/config-template.yaml'): """Run the pipeline for a single region Parameters ---------- config_path : str, optional config.yaml path, by default 'configs/config.yaml' """ config = get_config(config_path) config.update(self.args) if self.verbose: print(config) with timed_log(name='Start process', config=config, time_chunk='minutes', force=config['force']): pass with timed_log(name='Full process', config=config, time_chunk='minutes', force=config['force']): core(config)
def single(self, config_path="configs/config-template.yaml"): """Run the pipeline for a single region Parameters ---------- config_path : str, optional config.yaml path, by default 'configs/config.yaml' """ config = get_config(config_path) config.update(self.args) if self.verbose: print(config) with timed_log( name="Start process", config=config, time_chunk="minutes", force=config["force"], ): pass with timed_log( name="Full process", config=config, time_chunk="minutes", force=config["force"], ): if config["slug"] == "prod": try: core(config) except: if config["post_log"]: logger.post(traceback.format_exc()) print(traceback.format_exc()) else: core(config)
def initEnv(): op_mgr.recover_ops("./vgg16-1_1-128-op.pkl") for key in op_mgr.op_dict.keys(): if (op_mgr.op_dict[key].op_type == 'N'): op_mgr.op_dict[key].op_size *= FLOW_MAGNIFY global computing_sum for key in op_mgr.op_dict.keys(): if (op_mgr.op_dict[key].op_type == 'C'): unFinList.append(key) computing_sum += op_mgr.op_dict[key].op_size for i in range(0, NUM_OF_CORES + 1): newCore = core() coreList.append(newCore) #print(coreList) print("Sum load of %d computing is %f" % (len(unFinList), computing_sum))
def core_operations(REFALIGNER, DIGEST, GLPSOL, sub_dir, refaligner_dir, input_fasta_file, optmap_list, optmap_type_list, refaligner_prefix, mtp_fasta_file, mtp_fasta_file_chname, unaligned_fasta_file, lowconf_fasta_file): fasta_file_in_refaligner = refaligner_dir + "/" + refaligner_prefix + ".fasta" if not os.path.isdir(refaligner_dir): os.makedirs(refaligner_dir) copyfile(input_fasta_file, fasta_file_in_refaligner) out_list = [] out2_list = [] for i in range(len(optmap_list)): optmap = optmap_list[i] optmap_type = optmap_type_list[i] silicomap = refaligner_dir + "/" + refaligner_prefix + "_" + optmap_type + ".cmap" out = refaligner_dir + "/" + refaligner_prefix + "_" + optmap_type + "_BNG_VS_seq" out2 = refaligner_dir + "/" + refaligner_prefix + "_" + optmap_type command = "perl " + DIGEST + " -v -i " + fasta_file_in_refaligner + " -e " + optmap_type + " -m 0 -M 0" os.system(command) command = REFALIGNER + " -i " + optmap + " -ref " + silicomap + " -o " + out + " -res 2.9 -FP 1.2 -FN 0.15 -sf 0.10 -sd 0.15 -extend 1 -outlier 1e-4 -endoutlier 1e-2 -deltaX 12 -deltaY 12 -xmapchim 14 -T 1e-8 -hashgen 5 3 2.4 1.5 0.05 5.0 1 1 1 -hash -hashdelta 50 -mres 1e-3 -insertThreads 4 -nosplit 2 -biaswt 0 -indel -rres 1.2 -f -maxmem 256 " os.system(command) flip_xmap(out) out_list.append(out) out2_list.append(out2) core(optmap_list, input_fasta_file, out_list, out2_list, sub_dir, GLPSOL) orders_file = sub_dir + "/orders.txt" gaps_file = sub_dir + "/gaps.txt" ori_file = sub_dir + "/contig_oris.txt" scaffolding(out2_list, input_fasta_file, orders_file, gaps_file, ori_file, sub_dir)
def main(): app = QtWidgets.QApplication(sys.argv) app.setWindowIcon(QtGui.QIcon('img/logo.png')) app.setAttribute(QtCore.Qt.AA_DisableWindowContextHelpButton) print('正在启动...') SailPYE = core.core() if sys.platform.startswith('win'): ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID( "Sail Python Editor") SailPYE.os = 'win32' SailPYE.init_os() # 建立临时文件夹作为工作目录 if not Path(SailPYE.tmp).is_dir(): os.mkdir(SailPYE.tmp) print('正在启动插件...') plugin = setPlugin.plugin(SailPYE, app, verstion) error_info = plugin.install() error_widget = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Critical, '错误', error_info) if error_info != '': SailPYE.close() error_widget.show() sys.exit(app.exec_()) SailPYE.update_tools() if len(sys.argv) > 1: SailPYE.open_file(sys.argv[1]) SailPYE.show() print('启动成功!') def show_init(): for fun in plugin.plugins: fun['obj'].show_init() threading.Thread(target=show_init).start() sys.exit(app.exec_())
async def run_processing(message: types.Message, user_data: dict): if DataKeys.CONTENT_FILE_ID not in user_data: await message.answer("Сначала необходимо выбрать фото для обработки.", reply_markup=init_main_keyboard(user_data)) return if DataKeys.STYLE_FILE_ID not in user_data: await message.answer("Сначала необходимо выбрать стиль.", reply_markup=init_main_keyboard(user_data)) return await BotStates.PROCESSING.set() content_file = await bot.get_file(user_data[DataKeys.CONTENT_FILE_ID]) content_filename = 'tmp/' + user_data[DataKeys.CONTENT_FILE_ID] + '.png' await content_file.download(content_filename) style_filename = None if user_data[DataKeys.STYLE_FILE_ID] in default_styles: style_filename = default_styles[user_data[ DataKeys.STYLE_FILE_ID]]['file'] else: style_file = await bot.get_file(user_data[DataKeys.STYLE_FILE_ID]) style_filename = 'tmp/' + user_data[DataKeys.STYLE_FILE_ID] + '.png' await style_file.download(style_filename) time_str = '' waiting_time = WAITING_TIME * (on_processing[0] + 1) if waiting_time == 0: time_str = 'менее минуты' elif waiting_time % 10 == 1: time_str = 'около ' + str(waiting_time) + ' минуты' else: time_str = 'около ' + str(waiting_time) + ' минут' info = 'Обрабатываю фото, это займёт ' + time_str + '. Пришлю результат как только всё будет готово.' await message.answer(info, reply_markup=init_main_keyboard(user_data)) loop = asyncio.get_running_loop() future = loop.create_future() task = core(content_filename, style_filename, PRETRAINED_FILENAME) task_queue.put((future, task)) result_filename = await future os.remove(content_filename) if user_data[DataKeys.STYLE_FILE_ID] not in default_styles: os.remove(style_filename) await types.ChatActions.upload_photo() user_data[DataKeys.ON_PROCESSING] = False await message.answer_photo( open(result_filename, 'rb'), 'Обработка завершена. Если хотите, то следующим сообщением можете оставить отзыв 🙂', reply_markup=init_main_keyboard(user_data)) await BotStates.WAIT_FEEDBACK.set() os.remove(result_filename)
def dispatch_to_core(self, arg_dict): messageDict = arg_dict # dispatching logic goes here for user in self.object_list: if (user == messageDict['chat_id']): # print "\n\n\n" + str(user) + " found! , reusing object\n" core_obj = self.object_list[user] response_dict = core_obj.run_core(messageDict) return response_dict print bcolors.FAIL + "User with chat id" + str(messageDict['chat_id']) + " not found , creating new object " coreobj = core.core(messageDict['chat_id']) self.object_list[messageDict['chat_id']] = coreobj # stores created object in class variable for future use. response_dict = coreobj.run_core(messageDict) return response_dict
def main(argv): # video_path = "./Videos/Hira Redmi.mp4" ## tilted # video_path = "./Videos/Hira Remi.mp4" video_path = "./Videos/Muneeb iphone 6.mp4" # video_path = "./Videos/Aqasha realme 5.mp4" # video_path = "./Videos/Muneeb iphone 6(1).mp4" tm = False # flag for momentory time of collusion rt = True # real time flag options = "acr" long_options = ["acceleration", "camera", "realtime"] try: arguments, values = getopt.getopt(argv, options, long_options) for currentArgument, currentValue in arguments: if currentArgument in ("-a", "--acceleration"): print( "\n\n\nDiplaying Momentary Time to Contact without Acceleration" ) tm = True elif currentArgument in ("-c", "--camera"): print("\n\n\nUsing camera") video_path = False elif currentArgument in ("-r", "--realtime"): print("\n\n\nNot using real time") rt = False except getopt.error as err: # output error, and return with an error code print(str(err)) c = core() c.system(video_path, "/media/4698AABF98AAAD3D/detection.avi", input_size=320, show=True, iou_threshold=0.1, rectangle_colors=(255, 0, 0), Track_only=['car', 'truck', 'motorbike', 'person'], display_tm=tm, realTime=rt)
def __init__(self,xmlfile='./train/mytrainSet.xml',imgDB='faceDB'): self._xmlfile=xmlfile self._trainedImgPostion=imgDB self._imgMat=[] self._label=[] self._core=core(faceRecognizeXmlfile=self._xmlfile) self._iosteam=IOSteam() self._window=PreviewWindowManager('TrainWindows',self.onKeypress) self._window_faceZone=PreviewWindowManager('TrainWindows.FaceZone') self._trained_file_used=False self._keep_run=True self._apply_recognize=False self.train_setted_img()
def __init__(self, proxies=None, apikey=None): """ Creates an instance of the ZAP api client. :Parameters: - `proxies`: dictionary of ZAP proxies to use. Note that all of the other classes in this directory are generated new ones will need to be manually added to this file """ self.__proxies = proxies or { 'http': 'http://127.0.0.1:8080', 'https': 'http://127.0.0.1:8080' } self.__apikey = apikey self.acsrf = acsrf(self) self.ajaxSpider = ajaxSpider(self) self.ascan = ascan(self) self.authentication = authentication(self) self.authorization = authorization(self) self.autoupdate = autoupdate(self) self.brk = brk(self) self.context = context(self) self.core = core(self) self.forcedUser = forcedUser(self) self.httpsessions = httpSessions(self) self.importLogFiles = importLogFiles(self) self.params = params(self) self.pnh = pnh(self) self.pscan = pscan(self) self.reveal = reveal(self) self.script = script(self) self.search = search(self) self.selenium = selenium(self) self.sessionManagement = sessionManagement(self) self.spider = spider(self) self.stats = stats(self) self.users = users(self) # not very nice, but prevents warnings when accessing the ZAP API via https requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
def handle_start(message): if message.chat.type == 'supergroup' or message.chat.type == 'group': return True mess = "Hi" cor = core(message.from_user.id) if cor.user is None: cor.db.user_add(telid=message.from_user.id, telusername=message.from_user.username, mode=1) bot.send_message(message.chat.id, "Hi! Write your name in format:\nPrenom NOM") else: bot.send_message( message.chat.id, "Hi again. You are already in the system. Use /edit to edit your personal info." ) cor.log_save(mess="New user", typ=0) cor.close()
def handle_edit(message): if message.chat.type == 'supergroup' or message.chat.type == 'group': return True try: cor = core(message.from_user.id) users, data = cor.toall(message.text, message.message_id) for user in users: try: sent_info = send(data=data, to=user) except Exception as e: print("Error: ".format(e)) with open('log.txt', 'a') as f: f.write('---------- {} {} ----------'.format( int(time.time()), datetime.now().strftime("%m/%d/%Y, %H:%M:%S"))) f.write("{}\n".format(cor.logs)) f.write(str(e)) f.write(traceback.format_exc()) bot.reply_to(message, "{}\nto:{}\nmess: {}".format(e, user, data)) if config.metelid != message.from_user.id: bot.send_message(config.metelid, e, disable_notification=False) cor.log_save(typ=4) cor.close(data=data, sent_info=sent_info, mode='toall') except Exception as e: print("Error: ".format(e)) with open('log.txt', 'a') as f: f.write('---------- {} {} ----------'.format( int(time.time()), datetime.now().strftime("%m/%d/%Y, %H:%M:%S"))) f.write("{}\n".format(cor.logs)) f.write(str(e)) f.write(traceback.format_exc()) bot.reply_to(message, e) bot.send_message(config.metelid, e, disable_notification=False) cor.log_save(typ=4)
def repeat_all_messages( message): # Название функции не играет никакой роли, в принципе #if True: try: cor = core(message.from_user.id) data = cor.text(message.text, message.message_id) sent_info = send(data=data, to=message.chat.id) cor.close(data=data, sent_info=sent_info, mode='text') except Exception as e: print("Error: ".format(e)) with open('log.txt', 'a') as f: f.write('---------- {} {} ----------'.format( int(time.time()), datetime.now().strftime("%m/%d/%Y, %H:%M:%S"))) f.write("{}\n".format(cor.logs)) f.write(str(e)) f.write(traceback.format_exc()) bot.reply_to(message, e) bot.send_message(config.metelid, e, disable_notification=False) cor.log_save(typ=3)
def handle_command(message): if message.chat.type == 'supergroup' or message.chat.type == 'group': return True try: #if True: cor = core(message.from_user.id) data = cor.command(message.text, message.message_id) sent_info = send(data=data, to=message.chat.id) cor.close(data=data, sent_info=sent_info, mode='command') except Exception as e: print("Error: ".format(e)) with open('log.txt', 'a') as f: f.write('---------- {} {} ----------'.format( int(time.time()), datetime.now().strftime("%m/%d/%Y, %H:%M:%S"))) f.write("{}\n".format(cor.logs)) f.write(str(e)) f.write(traceback.format_exc()) bot.reply_to(message, e) bot.send_message(config.metelid, e, disable_notification=False) cor.log_save(typ=2)
def __init__(self, proxies={'http': 'http://127.0.0.1:8080', 'https': 'http://127.0.0.1:8080'}): """ Creates an instance of the ZAP api client. :Parameters: - `proxies`: dictionary of ZAP proxies to use. Note that all of the other classes in this directory are generated new ones will need to be manually added to this file """ self.__proxies = proxies self.acsrf = acsrf(self) self.ascan = ascan(self) self.auth = auth(self) self.autoupdate = autoupdate(self) self.context = context(self) self.core = core(self) self.params = params(self) self.pscan = pscan(self) self.search = search(self) self.spider = spider(self)
def __init__(self): self.mkConstants() self.C = core(self.paintALL) self.VH = Tk() self.VH.withdraw() self.mkTopFaces(self.VH) self.mkFunctionButtons() self.mkDataBusButtons() self.mkAddressBusButtons() self.mkLoadButtons() self.mkSelectButtons() self.mkRunButtons() self.paintALL() self.C.setClockCallback(self.paintClock) self.C.runClockThread() self.C.setTextCallback(self.paintText) self.C.ENCODER.setTextCallback(self.paintText) self.VH.mainloop()
inputFile = arg.replace('if=', '') elif arg.startswith('of='): outputFile = arg.replace('of=', '') elif arg.startswith('imageX='): imageX = int(arg.replace('imageX=', '')) elif arg.startswith('imageY='): imageY = int(arg.replace('imageY=', '')) elif arg.startswith('pixelSize='): pixelSize = int(arg.replace('pixelSize=', '')) elif arg.startswith('dpi='): dpi = int(arg.replace('dpi=', '')) elif arg.startswith('mode='): modes.append(arg.replace('mode=', '')) elif arg.startswith('fileType='): fileType = arg.replace('fileType=', '') import core coreWorker = core.core(imageX, imageY, pixelSize, fileType, dpi) coreWorker.fromFile(inputFile) for mode in modes: pass coreWorker.saveImage(outputFile) if 'glitch' in modes: import glitch gl = glitch.glitch() gl.glitchFile(outputFile)
def setUp(self): super(TestCore, self).setUp() self.core_obj = core.core(self.bot)
def __init__(self,url): if self.__issmf(url): genericfinger(url,self.__getjuicyurls(),core()._existpath)
def __issmf(self,url): return True if core()._existpath(url,"ssi_examples.php")[0] or core()._existpath(url,"SSI.php")[0] or core()._existpath(url,"new_readme.html")[0] or core()._isinsource(url,"smf") else False
r.hset('command','message',command) r.hset('command','gateway','slack') r.hset('command','channel',channel) r.hset('command','sender',slackid) r.rpush('inQ','command') return "" @app.route("/oauth2callback") def oauth(): print "GMAIL AUTH" return "" @app.route("/ping", methods=['POST']) def ping(): print "PONG" msguser = request.form.get("text","") print msguser return "" if __name__ == "__main__": r = redis.StrictRedis(host='localhost',port=6379,db=0) coreThread = core.core(r) listenThread = core.listen(r) coreThread.start() listenThread.start() app.run(debug=True, host = '0.0.0.0', port=5555)
def __init__(self,url): if self.__iswordpress(url): genericfinger(url,self.__getjuicytemp(),core()._existpath)
def __concprocess(self): genericfinger(self.url,self.dataStruct,core()._existsubdomain)
yellow = (255, 255, 0) """ @screen_info[0][0]: 屏幕像素宽 @screen_info[0][1]: 屏幕像素高 @screen_info[1][0]: 棋盘起始点x @screen_info[1][1]: 棋盘起始点y @screen_info[2]: 长方框之间的距离 @screen_info[3]: 长方框的高度 @screen_info[4]: 棋子的半径 @screen_info[5]: 棋子列表如[1, 2, 3, 4, 5] @screen_info[6]: 标题 """ screen_info = [(800, 560), (20, 20), 4, 100, 40, [1, 2, 3, 4, 5], "nim"] pygame.init() draw = draw.draw(screen_info) core = core.core() statusbar = [550, 400, 200, 40] menu0 = [600, 80, 160, 40] menu1 = [600, 130, 160, 40] draw.drawtext(menu0, (605, 82), 30, "GAMECUBEN.ttf", green, "i first") draw.drawtext(menu1, (605, 132), 30, "GAMECUBEN.ttf", green, "ai first") def setstatusbar(text): draw.drawtext(statusbar, (555, 402), 30, "GAMECUBEN.ttf", yellow, text) def clearstatusbar(): draw.drawtext(statusbar, (555, 402), 30, "GAMECUBEN.ttf", yellow, "")
#!/usr/bin/env python from core import core import time from functools import wraps from flask import Flask, Response, render_template, send_file, request import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import StringIO import simplejson as json import ConfigParser f=core() f.setpoint=90.0 f.gotopoint=f.setpoint w=Flask(__name__) cfg=ConfigParser.ConfigParser() cfg.read("/root/pifridge/pifridge.conf") def check_auth(username, password): return (username==cfg.get("Authentication", "username") and password==cfg.get("Authentication", "password")) def authenticate(): return Response( "Valid username and password required.", 401, {"WWW-Authenticate": 'Basic realm="Login Required"'}) def requires_auth(f):
def launch(scr): core(SERVER_IP="192.168.1.12", SERVER_PORT=508, SCR=scr, RECEPTION_MODE="ACC").start() # données à recevoir
# # Split the lines into fields we need # tlist = [] tlist = split_lines_hpcc(mlist) # # First Create the list of nodes # There should be no duplicates in this list # nodelist = {} for c in tlist: # use rank as key key = c[0] mcore = core() mcore.lo_rank = int(c[0]) mcore.lo_name = c[1] mcore.hi_rank = int(c[2]) mcore.hi_name = c[3] mcore.commtime = float(c[4]) mcore.stddev = float(c[5]) nodelist[key] = mcore # # The nodelist eliminates distrition from 0 to 0 # This gives us N-1. We increment matrix by 1 to fill this # matsize = len(nodelist) matsize = matsize
def __iswordpress(self,url): return True if core()._existpath(url,"wp-content")[0] or core()._existpath(url,"wp-includes")[0] or core()._existpath(url,"license.txt")[0] or core()._isinsource(url,"wp-") else False