daily pastebin goal
24%
SHARE
TWEET

yapsy

a guest Mar 8th, 2010 737 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. #http://yapsy.sourceforge.net/yapsy.PluginManager.PluginManager-class.html#__init__
  14. #the list contains Plugininfo objects
  15. #http://yapsy.sourceforge.net/yapsy.PluginManager.PluginInfo-class.html
  16. list = var.getPluginsOfCategory("Default")
  17. print list
  18.  
  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()
  27.  
  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
 
Top