a guest Mar 8th, 2010 744 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import logging
  2. #enables the logging used by yapsy
  3. logging.basicConfig(level=logging.DEBUG)
  4. from yapsy.PluginManager import PluginManager
  5. var = PluginManager()
  6. #location where your plugin resides in
  7. var.setPluginPlaces(['C:/Users/wouter/Documents/workspace/mysite/src/mysite/fingerprinting/plugins/osplugins'])
  8. var.locatePlugins()
  9. var.loadPlugins()
  10. #category is determined by the object your plugins it inherit from
  11. #Default means that everything from yapsy.IPlugin.IPlugin is accepted
  12. #can be changed by adding parameter to the declaration of the pluginmanager
  13. #
  14. #the list contains Plugininfo objects
  15. #
  16. list = var.getPluginsOfCategory("Default")
  17. print list
  19. for item in list:
  20.     print "item:"
  21.     print item
  22.     #the pluginobject itself can be retrieved from PluginInfo
  23.     #with .plugin_object
  24.     pluginobject = item.plugin_object
  25.     #now you can call the methods from your plugin
  26.     pluginobject.test()
  28. #get the plugin by name this returns the plugin (not the info)
  29. #for the PluginInfo object -->getPluginByName("yournamehere")
  30. plugin = var.activatePluginByName("WindowsScanner")
  31. #again methods can be called
  32. plugin.test()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand