Skip to content

Commit

Permalink
Fixed a small bug in SQLite which stopped processing when a table def…
Browse files Browse the repository at this point in the history
…inition could not be parsed - now we just keep going.

Ignore-this: 35cfc6dad4564c102608a00bd5f9c07c

darcs-hash:20090615123133-f1522-df3a9e4b67dd4540900bbb156d71ef3a55d60de8.gz
  • Loading branch information
scudette committed Jun 15, 2009
1 parent f28259d commit 5009a44
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 74 deletions.
2 changes: 1 addition & 1 deletion src/plugins/Core.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ def startup(self):

## Schedule the first periodic task:
task = Periodic()
task.schedule()
task.run()

def exit(self, dbh, case):
IO.IO_Cache.flush()
Expand Down
9 changes: 7 additions & 2 deletions src/plugins/DiskForensics/FileHandlers/SQLite.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,20 @@ def external_process(self, fd):
ldbh2 = db.cursor()
ldbh.execute("select * From sqlite_master")
dbh = DB.DBO(self.case)
dbh.cursor.ignore_warnings = True
for row in ldbh:
if row[0]=='table':
dbh.insert('sqlite',
name = row[1],
inode_id = self.fd.inode_id,
definition = row[4])

case_table = build_case_table("sqlite",
row[4])
try:
case_table = build_case_table("sqlite",
row[4])
except RuntimeError,e:
pyflaglog.log(pyflaglog.WARNING, e)
continue

## Create our copy of this table (if its not
## already there
Expand Down
4 changes: 3 additions & 1 deletion src/plugins/DiskForensics/TypeScan.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def select(self):

## When exporting to html we need to export the thumbnail too:
def render_html(self, inode_id, table_renderer):
ct=''
try:
fd = self.fsfd.open(inode_id = inode_id)
image = Graph.Thumbnailer(fd, 200)
Expand All @@ -101,7 +102,8 @@ def render_html(self, inode_id, table_renderer):

InodeIDType.render_html(self, inode_id, table_renderer)
table_renderer.add_file_to_archive(inode_id)
return "<a href=%r ><img src=%r /></a>" % (inode_filename, filename)
return DB.expand("<a href=%r type=%r ><img src=%r /></a>",
(inode_filename, ct, filename))

def render_thumbnail_hook(self, inode_id, row, result):
try:
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/NetworkForensics/ProtocolHandlers/DNS.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from pyflag.ColumnTypes import StringType, PacketType, IPType
import pyflag.conf
config=pyflag.conf.ConfObject()
from NetworkScanner import StreamScannerFactory
from plugins.NetworkForensics.NetworkScanner import StreamScannerFactory
from pyflag.ColumnTypes import StringType, TimestampType, InodeIDType, IntegerType, PacketType, guess_date, PCAPTime, IPType

class DNSString(STRING):
Expand Down
17 changes: 8 additions & 9 deletions src/plugins/Preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from pyflag.format import Buffer,RAW
import pyflag.FileSystem as FileSystem
import pyflag.Registry as Registry
from pyflag.ColumnTypes import IntegerType,TimestampType,InodeType,FilenameType, StringType, StateType
from pyflag.ColumnTypes import IntegerType,TimestampType,InodeIDType,FilenameType, StringType, StateType
from pyflag.ColumnTypes import DeletedType, BinaryType
import pyflag.DB as DB
import time
Expand Down Expand Up @@ -161,15 +161,14 @@ def pane_cb(path, result):

## Now display the table
result.table(
elements = [ InodeType('Inode','file.inode',case=query['case']),
StringType('Filename','name'),
DeletedType('Del','file.status'),
IntegerType('File Size','size'),
TimestampType('Last Modified','mtime'),
TimestampType('Mode','file.mode')
elements = [ InodeIDType(case=query['case']),
FilenameType(case=query['case']),
DeletedType(),
IntegerType(name='File Size',column='size'),
TimestampType(name = 'Last Modified',column = 'mtime'),
],
table='file, inode',
where="file.inode=inode.inode and path=%r and file.mode!='d/d'" % (path),
table='inode',
where=DB.expand("file.path=%r and file.mode!='d/d'",(path)),
case = query['case'],
pagesize=10,
)
Expand Down
6 changes: 5 additions & 1 deletion src/plugins/TableRenderers/HTMLBundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,11 @@ def make_archive_filename(self, inode_id, directory = 'inodes/'):
type, content_type = m.find_inode_magic(self.case, inode_id)
except:
content_type = "plain/text"


## Remove illegal chars from content_type
m = re.match("([a-zA-Z/-]+)", content_type)
if m:
content_type = m.group(1)

for k,v in {"jpeg": ".jpg",
"gif": ".gif",
Expand Down
4 changes: 3 additions & 1 deletion src/pyflag/DB.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,15 @@ def cb(m):
return result

class PyFlagDirectCursor(MySQLdb.cursors.DictCursor):
ignore_warnings = False

def execute(self, string):
pyflaglog.log(pyflaglog.VERBOSE_DEBUG, string)
return MySQLdb.cursors.DictCursor.execute(self, string)

def _warning_check(self):
last = self._last_executed
if self._warnings:
if self._warnings and not self.ignore_warnings:
self.execute("SHOW WARNINGS")
while 1:
a=self.fetchone()
Expand Down
2 changes: 1 addition & 1 deletion src/pyflag/Farm.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ def worker_run(keepalive=None):
if row['state'] == 'pending':
dbh.execute("update high_priority_jobs set state='processing', pid=%r where id=%r",
my_pid,
row['id'])
row['id'])
else:
dbh.execute("unlock tables")
dbh.execute("lock tables jobs write")
Expand Down
57 changes: 0 additions & 57 deletions utilities/export_index_hits.py

This file was deleted.

0 comments on commit 5009a44

Please sign in to comment.