def test_plugin_init(self): sys.path.append('../plugins/') plugin = Plugin.Plugin('output_txt') self.assertEqual(plugin.name, 'output_txt') self.assertEqual(plugin.extension, 'txt') self.assertEqual(plugin.language, 'manual') self.assertEqual(plugin.type, plugin.OUTPUT_MODULE)
def load_plugins(self): potential_plugins = os.listdir(PLUGINS_MAIN_FOLDER) potential_plugins.remove(PLUGINS_INIT) self.pluginList = [] for plugin_name in potential_plugins: if not (PLUGINS_INIT in plugin_name) and not ('Plugin.py' in plugin_name): if ('.py' in plugin_name) and ('.pyc' not in plugin_name): plugin_name = plugin_name.replace('.py', '') self.pluginList.append(Plugin(plugin_name))
def __init__(self, host, port=1604): """Initialize a Plugin class. Keyword arguments: host -- server host port -- used port [default: 1604] """ self._host = host self._port = port self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Creates an INET socket STREAM-type self.s.bind((host, port)) # Binds the socket to an host and a port self.plugin = Plugin.Plugin("Plugins")
def __init__(self, videofile='', jsonfile=''): QMainWindow.__init__(self) self.settings = Settings.loadSettings() # play state self.playStat = GuiWindow.V_PAUSE self.videofile = videofile self.jsonfile = jsonfile self.txtfile = '' self.imgSource = ImageSource(self.videofile, self.jsonfile) self.plugin = Plugin(self.imgSource) self.lastPluginFnum = -1 self.frameW = self.settings['frameW'] self.frameH = self.settings[ 'frameH'] # will be updated when open video file self.scale = 1.0 self.offset = [0, 0] self.zoomed = False self.holdShift = False self.holdControl = False self.holdAlt = False self.labelfile = '' # self.rate = 30 self.fnum = 0 self.focusRoiId = -1 self.selRoiId = -1 self.fcnt = self.imgSource.getFrameCount() self.roiLabels = ( # name, editable ("label_name", False), ("label_id", False), ("roi_score", False), ("roi_x", True), ("roi_y", True), ("roi_w", True), ("roi_h", True), ("roi_id", False)) # setup timer tick self.timer = QTimer(self) self.timer.timeout.connect(self.tick) self.timer.start(1000 / self.rate) self.liftPressed = False # init gui self.guiInit() self.updateImage(self.fnum, True)
def analyse(pluginPath): ''' Analyse the bundle an return a description for each plugin. ''' pluginCache = tuttle.core().getPluginCache() pluginCache.addDirectoryToPath(str(pluginPath)) tuttle.core().getFormatter().setLogLevel_int(5) tuttle.core().preload(False) plugins = pluginCache.getPlugins() logging.warning('pluginCache: %s' % pluginCache) logging.warning('Analyse plugins: %s' % pluginPath) logging.warning('Nb plugins: %s' % len(plugins)) pluginsDescription = {'plugins':[], 'total': len(plugins)} for currentPlugin in plugins: logging.warning(currentPlugin.getRawIdentifier()) p = Plugin.Plugin(currentPlugin) pluginsDescription['plugins'].append(p.__dict__) return pluginsDescription
def __init__(self, mode=0): self.mode = mode self.plugin = Plugin.Plugin() if mode == 0: print("initialized in credential mode") elif mode == 1: print("initialized in Authenticator mode") else: print("Invalid mode selection") sys.exit(0) plat = platform.uname() dbname = plat[0] + '_' + plat[1] + ".db" try: self.connection = sqlite3.connect(dbname) except: print("Error in Database connection") return -2 try: self.connection.execute( "CREATE TABLE NFCPRIV(rid TEXT PRIMARY KEY, cipher TEXT NOT NULL)" ) print("Table created") except: print("Table exists, adding or reading records")
@author: Abhay Poddar """ import importlib import NFCPlugin_windows import Plugin import platform from cryptography.fernet import Fernet from Crypto.Cipher import AES #import NFCAuth obj=NFCPlugin_windows.NFCPlugin("try.txt") print(obj) obj.writeToTag("asd") print(obj.readFromTag()) obj2=Plugin.Plugin() obj2.plugin.writeToTag("asdw") print(obj2.plugin.readFromTag()) kwargs=platform.uname() dbname=kwargs[0]+'_'+kwargs[1]+".db" print(dbname) key="aaasvcdahdandfuy" rid='This is an IV456' enc=AES.new(key,AES.MODE_CFB,rid) stri='' stri=kwargs[0]+kwargs[1]+kwargs[2]+kwargs[3]+kwargs[4] print(stri) text=enc.encrypt(stri) print (text) dec=AES.new(key,AES.MODE_CFB,rid)