Skip to content

Commit

Permalink
Fixed a bug in reassembler due to uninitialised struct on 64bit syste…
Browse files Browse the repository at this point in the history
…ms. Updated tcptrace.

darcs-hash:20090317045738-20ca2-3d72d2a86c60b39add011fe6c060bdd4bb87612f.gz
  • Loading branch information
scudette committed Mar 17, 2009
1 parent 3cd56aa commit 91424c3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/include/packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ struct struct_property_t {
/** This represents the number of bytes from the begining of the
struct where this item may be found
*/
int item;
uint64_t item;

int size;

Expand Down Expand Up @@ -190,7 +190,7 @@ END_CLASS
struct struct_property_t *p=talloc(NULL, struct struct_property_t); \
p->name=#ref_name; \
p->field_type = type; \
p->item = (int)(&((typeof(this->struct_member_name) *)0)->member); \
p->item = (typeof(p->item))(&((typeof(this->struct_member_name) *)0)->member); \
p->size = sizeof(this->struct_member_name.member);

#define __NAME_ACCESS_end(struct_member_name, member, name, type) \
Expand Down
2 changes: 1 addition & 1 deletion src/network/tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct tuple4
uint16_t dest;
uint32_t saddr;
uint32_t daddr;
uint32_t pad; //This pad is needed to align this struct on 64 bit
int pad; //This pad is needed to align this struct on 64 bit
//machines for speed.
} __attribute__((packed));

Expand Down
1 change: 1 addition & 0 deletions src/plugins/NetworkForensics/Reassembler.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def __init__(self, case, fd, inode):
row = dbh.fetch()

## This updates our properties from the db
if not row: return
self.__dict__.update(row)

## We allow the user to ask for a number of streams which will
Expand Down
14 changes: 2 additions & 12 deletions utilities/tcptrace.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
config=pyflag.conf.ConfObject()
from pyflag.CacheManager import CachedWriter
import pyflag.FlagFramework as FlagFramework
import cStringIO

parser = OptionParser(usage = """%prog [options] pcap_file ... pcap_file
Expand Down Expand Up @@ -65,15 +64,6 @@

CONS = 0

class MyCachedWriter(CachedWriter):
def __init__(self, filename):
self.filename = filename
self.fd = cStringIO.StringIO()
self.offset = 0

def close(self):
self.write_to_file()

def Callback(mode, packet, connection, options = None):
global CONS
import socket, struct, time
Expand All @@ -86,8 +76,8 @@ def Callback(mode, packet, connection, options = None):
connection['reverse']['con_id'] = CONS
CONS +=1

connection['data'] = MyCachedWriter("%s/S%s" % (options.prefix, connection['con_id']))
connection['reverse']['data'] = MyCachedWriter("%s/S%s" % (options.prefix, connection['reverse']['con_id']))
connection['data'] = CachedWriter("%s/S%s" % (options.prefix, connection['con_id']))
connection['reverse']['data'] = CachedWriter("%s/S%s" % (options.prefix, connection['reverse']['con_id']))

ip = packet.find_type("IP")
connection['src_ip'] = ip.src
Expand Down

0 comments on commit 91424c3

Please sign in to comment.