def SvcDoRun(self):
        if os.sys.platform.startswith('win'):
            multiprocessing.freeze_support()

        config = ConfigFactory(config_file_name='py_cclas.ini').getConfig()
        logger = LoggerFactory(config=config).getLogger()
        self.wObserver = WatchDogObServer(config=config, logger=logger)
        self.wObserver.start()

        rc = None
        while rc != win32event.WAIT_OBJECT_0:
            # with open('e:\\TestService.log', 'a') as f:
            #     f.write('test service running...\n')
            rc = win32event.WaitForSingleObject(self.hWaitStop, 5000)
        observer = Observer()
        observer.schedule(path=path,
                          event_handler=event_handler,
                          recursive=recursive)

        observer.start()

        self.logger.debug('WatchDog Observer for CCLAS is startting.....')
        self.logger.debug('patterns=%s' % patterns)
        self.logger.debug('path=%s' % path)
        self.logger.debug('delay=%s' %
                          str(config.getfloat('watchdog', 'delay')))
        self.logger.debug('beep=%s' %
                          str(config.getboolean('watchdog', 'beep')))
        try:
            while observer.is_alive():
                time.sleep(config.getfloat('watchdog', 'delay'))
        except KeyboardInterrupt:
            observer.stop()
            self.logger.debug('WatchDog Observer is stoped.')
        observer.join()


if __name__ == '__main__':
    if os.sys.platform.startswith('win'):
        multiprocessing.freeze_support()
    config = ConfigFactory(config='py_cclas.ini').getConfig()
    logger = LoggerFactory(config=config).getLogger()
    wObserver = WatchDogObServer(config=config, logger=logger)
    wObserver.start()
        dict = {'sheet_name': sheet_name, 'header': None}
        hcs_df = pd.read_excel(filename, **dict)
        # 删除表标题:样品参数、标准值、测试值……
        hcs_df.drop(axis=0, index=[0], inplace=True)
        # 获取列名
        header = hcs_df.iloc[0]
        # 切割有效数据
        hcs_df = hcs_df.loc[1:]
        # 列重新命名
        hcs_df.columns = header
        # 删除表标题:碳、硫……
        hcs_df.drop(axis=0, index=[1], inplace=True)
        # 按照序号列(第0列)排列升序
        hcs_df.sort_index(0, ascending=False, inplace=True)
        hcs_df.fillna('', inplace=True)
        self.logger.debug(hcs_df)
        newfilename = self.getNewFilename(filename=filename, type='hcs')
        encoding = self.config.get('hcs', 'encoding')
        hcs_df.to_csv(newfilename, index=None, encoding=encoding, line_terminator='\r\n')
        return hcs_df


if __name__ == '__main__':
    config = ConfigFactory(config_file_name='py_cclas.ini').getConfig()
    logger = LoggerFactory(config=config).getLogger()
    hcsParser = HCSParser(config=config, logger=logger)
    filename = r'E:\cclasdir\SES2017-HCS01.xls'
    sheet_name = 0
    hcsDf = hcsParser.getHCSDF(filename=filename, sheet_name=sheet_name)
    logger.debug(hcsDf)
Esempio n. 4
0
            jdyDF['TIME'] = jdyDF['TIME'].dt.strftime('%H:%M')
        except ValueError as error:
            self.logger.error(error)

        # 删除空行
        jdyDF.dropna(axis=0, how='all', inplace=True)
        # 过滤nan
        jdyDF.fillna('', inplace=True)
        # 重新建立索引
        jdyDF.reset_index(drop=True, inplace=True)
        return jdyDF


if __name__ == '__main__':
    config = ConfigFactory(config_file_name='py_cclas.ini').getConfig()
    logger = LoggerFactory(config=config).getLogger()
    jdyParser = JDYParser(config=config, logger=logger)

    filename = 'e:/cclasdir/SY/2020生物氧化BIOX Samples.xlsx'
    sheet_name = 'JDY'
    method = 'SY001'

    jdyDF = jdyParser.getJDYDF(filename=filename, sheet_name=sheet_name)
    logger.debug(jdyDF)
    increamentDF = jdyParser.getIncreamentDF(srcDF=jdyDF,
                                             filename=filename,
                                             sheet_name=sheet_name)
    reports = jdyParser.buildReport(dataframe=increamentDF,
                                    sheet_name=sheet_name,
                                    method=method)
    jdyParser.outputReport(reports=reports)
Esempio n. 5
0
        self.secret_key = config.get('3des', 'secret_key').encode(config.get('3des', 'encode'))

    def des_encrpt(self, str):
        key = pyDes.des(self.secret_key, pyDes.triple_des, pad=None, padmode=pyDes.PAD_PKCS5)
        en = key.encrypt(str.encode('utf8'), padmode=pyDes.PAD_PKCS5)
        return binascii.b2a_base64(en)

    def des_descrpt(self, str):
        key = pyDes.des(self.secret_key, pyDes.triple_des, pad=None, padmode=pyDes.PAD_PKCS5)
        de = key.decrypt(binascii.a2b_base64(str))
        return de


if __name__ == '__main__':
    config = ConfigFactory(config='py_grabrobot.ini').getConfig()
    logger = LoggerFactory(config=config).getLogger()
    try:

        if len(sys.argv) >= 2:
            sec_xml = sys.argv[1]
            tdes = TDes(config, logger)

            en = b'mVbUkybTYtPzXEaS0HchD2kLAs3FRz76AUTmbR8Mat6KlYCUebpcY8wV1W50zFfFbWsYHjPAH6O+VJEsM41J5IrQHJqoMhBv8K2L7xzD3ewDHT9VczX6dLVUw9mxS9PlOZXWQEpXze+4m9JIE7KKVT2n58g4ew45PIM8TNEFonmOZwgLUfSJMA7wkPJq+MD5Euxctrqc5/YEGX8y5FkeTZBQKW8mG9lEDlr2Zkp4W+NPn5MpF7Mqn4jhW4DXDBMnes1Wqz3Fu57VXLQibOK5uxlMEerb2/FLqdT50SFnURIiU4cY4opGLh9Nhdu3NSUML/0opOxs3gLgapjAikGzSnsUgw1jttE+A50tiq5ofn6vw7aH5fUqLGI7YIzYdbuWHAhQW++xgTCTOncejlTvHMEulMclHxNteOkvGcuFDc7oe/4UqbLFCh2gy2ybw2nlN7oBCIBcHqPNT6ey2Qo5YREgPMzRD8auJhG581uzxf6cgwq2/poOB25LK/WgE2IMp1DDKO6/pJSEmfJsbwSDGn8lS2pMVfxw+A95nNzVZ7G1x0i53SBwoC8PpJQi4bsq3+VL8DCglwmQ6MH1Y9HXay1uto5I8qB2fv3rMFqoQ5D2sclvGe2AEOujV+B4CrJW4E52hTDpPaJU8e1WV7GqmdzesQhR9OdMexywQkelNQYMk8xGzXUFLh1nxW0eZAlRrmU3GxADYBRFBw7XRIhEBDSDzG2SQuDyZe4gzcC92G/a4XDcehOiz4SGgBaLF4ohGUwR6tvb8Uup1PnRIWdREnVv0nRdTacs9lFykAGTKm8=\n'
            de = tdes.des_descrpt(sec_xml)
            print('de=%s' % de)
        else:
            print('usage:  py_3des.exe <crypt_string>')
    except Exception as e:
        logger.error(e)
Esempio n. 6
0
            SOURCE_IP = each.find_elements_by_tag_name('td')[6].text
            DEST_IP = each.find_elements_by_tag_name('td')[7].text
            # 填充二维数据表
            self.data_list.append([
                DATE, EVENT_NAME, RISK, DATA_SOURCE, SENSOR, OTX, SOURCE_IP,
                DEST_IP
            ])
        # self.chrome_driver.close()
        # self.chrome_driver.quit()

        return self.data_list


if __name__ == '__main__':
    config = ConfigFactory(config_file='py_metasploit.ini').get_config()
    logger = LoggerFactory(config_factory=config).get_logger()
    ossim = OssimWeb(config=config, logger=logger)
    result = ossim.get_data()

    app = QApplication(sys.argv)
    mainWindow = QMainWindow()
    mainWindow.setWindowTitle('软件机器人抓取数据')
    mainWindow.resize(320, 240)

    labal = QLabel(str(result))
    labal.setWordWrap(True)

    scroll_label = QScrollArea()
    scroll_label.setFixedSize(300, 200)

    layout = QVBoxLayout()