Package: osintbuddy
OSINTBuddy plugins and extensionsThe plugins library forjerlendds/osintbuddy.2023-12-02_demo.webmPlease note:OSINTBuddy pluginsare still in early alpha and breaking changes may occasionally occur in the API. That said, if you remain on themainbranch and avoid accessing protected methods we will try our best to avoid introducing breaking changes.NOTICE:There has been a major update to plugins, any created plugins will have to be updated to use the new, and more convenient data access method:Removenamefrom anyob.PluginUpdatenode['data']access to benode.label_defined_in_nodePlease see the introduction to the plugin system belowThe osintbuddy plugin system at its core is very simple. AnOBRegistryclass holds all registeredOBPluginclasses within the application. This registry is loaded into theosintbuddy applicationwhere it is then used to load the available entities for the user when they access a project graph, load transforms when a user opens the context menu of a node, and perform transformations which expect aPlugin.blueprint()to be returned. The returned data of a transform decorated method will be automatically mapped to aJanusGraphdatabase throughgremlinaccording to the labels(as snakecase)you previously set in the classesnodefor whateverPlugin.blueprint()you return.To make this a bit more clear please see the below example...frompydanticimportBaseModelimportosintbuddyimporttransform,Pluginfromosintbuddy.elementsimportTextInput,DropdownInput,Title,CopyTextfromosintbuddy.errorsimportOBPluginErrorclassCSESearchResults(Plugin):label="CSE Result"name="CSE result"show_label=False# do not show this on the entities dialog# the user sees on the left of the project graph screencolor="#058F63"node=[Title(label="Result"),CopyText(label="URL"),CopyText(label="Cache URL"),]classCSESearchPlugin(Plugin):label="CSE Search"name="CSE search"color="#2C7237"node=[[TextInput(label="Query",icon="search"),TextInput(label="Pages",icon="123",default="1"),],DropdownInput(label="CSE Categories",options=cse_link_options)]@transform(label="To cse results",icon="search")asyncdeftransform_to_cse_results(self,node:BaseModel,# dynamically generated pydantic model# that is mapped from the above labels contained within `node`use# a pydantic model allowing you to access a selenium instance# (and eventually a gremlin graph and settings api)):results=[]ifnotnode.query:raiseOBPluginError(('You can send error messages to the user here''if they forget to submit data or if some other error occurs'))# notice how you can access data returned from the context menu# of this node; using the label name in snake caseprint(node.cse_categories,node.query,node.pages)...# (removed code for clarity)ifresp:forresultinresp["results"]:url=result.get("breadcrumbUrl",{})# some elements you can store more than just a string,# (these elements storing dicts are mapped# to janusgraph as properties with the names# result_title, result_subtitle, and result_text)blueprint=CSESearchResults.blueprint(result={"title":result.get("titleNoFormatting"),"subtitle":url.get("host")+url.get("crumbs"),"text":result.get("contentNoFormatting"),},url=result.get("unescapedUrl"),cache_url=result.get("cacheUrl"),)results.append(blueprint)# here we return a list of blueprints (blueprints are dicts)# but you can also return a single blueprint without a listreturnresults