Skip to content
This repository has been archived by the owner on Mar 15, 2021. It is now read-only.

Commit

Permalink
small update to demo notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
brifordwylie committed May 7, 2014
1 parent 7dcf1dc commit d146197
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions notebooks/Workbench_Demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,23 @@
" </pre>\n",
" - ### How easy is it for me to put my own code into it?\n",
" - Below is the listing of the code for the 'strings' worker: Each worker needs to provide:\n",
" - plugin_info (name, class of the worker, dependencies, and description)\n",
" - dependencies (which other workers do you want as input)\n",
" - An execute method that takes a python dictionary as input and returns a python dictionary as output.\n",
" - That's it...\n",
"<pre>\n",
" ''' Strings worker '''\n",
" import re\n",
" def plugin_info():\n",
" return {'name':'strings', 'class':'Strings', 'dependencies': ['sample'],\n",
" 'description': 'This worker extracts all the strings from any type of file. Output keys: [string_list]'}\n",
" class Strings():\n",
" def __init__(self):\n",
" self.find_strings = re.compile(r'[^\\x00-\\x1F\\x7F-\\xFF]{4,}', re.MULTILINE)\n",
" def execute(self, input_data):\n",
" raw_bytes = input_data['sample']['raw_bytes']\n",
" strings = self.find_strings.findall(raw_bytes)\n",
" return {'string_list': strings}\n",
" ''' This worker extracts all the strings from any type of file '''\n",
" dependencies = ['sample']\n",
"\n",
" def __init__(self):\n",
" self.find_strings = re.compile(r'[^\\x00-\\x1F\\x7F-\\xFF]{4,}', re.MULTILINE)\n",
"\n",
" def execute(self, input_data):\n",
" raw_bytes = input_data['sample']['raw_bytes']\n",
" strings = self.find_strings.findall(raw_bytes)\n",
" return {'string_list': strings}\n",
"</pre>\n",
" \n",
"# On with the demo, lets start up the workbench server...\n",
Expand Down

0 comments on commit d146197

Please sign in to comment.