2 firefox_session_textareas.py - Recover text area content from Firefox session files
4 Print out text area content cached by Firefox in the saved session file.
8 python firefox_session_textareas.py "~/.firefox/Profiles/*/sessionstore.js"
9 -- Print out all text area content found (including the corresponding page URL)
11 python firefox_session_textareas.py "~/.firefox/Profiles/*/sessionstore.js" spam
12 -- Print out all only text areas found to contain the string "spam"
13 (or whose corresponding page URL contains that string)
20 TEXTAREA_PAT = re.compile('{url:"([^"]*)"[^}]*}[^}]*text:"#editor-textarea=([^"]*)"')
21 HEADING_TPL = '------------ firefox_session_textareas.py - %s ------------'
23 def textarea_content(s):
24 return urllib.unquote(s)
26 #FIXME: Use optparse, etc to clean up command line handling
27 sessioninfo = open(sys.argv[1]).read()
34 for match in TEXTAREA_PAT.finditer(sessioninfo):
35 if search is None or search in match.group(0):
36 print HEADING_TPL%match.group(1)
38 print textarea_content(match.group(2))