objects.logic.entity.networkEntity.networkEntity Class Reference

An entity is a simple object containing various properties of an Endpoint or Peer (both terms) are used throughout the documentation. More...

List of all members.

Public Member Functions

def __init__
def __str__
def __getitem__
def resolveGeoData
 Given a reference the Geo IP Database, this function will resolve the Geographical details of itself.
def computeStatistics
 Computed some basic statistics (last update, total bytes).

Public Attributes

 selfIPAddress
 foreignIPAddress
 foreignPort
 selfPort
 since
 lastUpdateTS
 totalBytes
 procID
 procName
 foreignLongitude
 foreignLatitude
 foreignCity
 foreignStateProv
 foreignCountry
 foreignOrganization
 foreignISP
 Pid
 processName
 exactLocation


Detailed Description

An entity is a simple object containing various properties of an Endpoint or Peer (both terms) are used throughout the documentation.

Definition at line 23 of file networkEntity.py.


Member Function Documentation

def objects.logic.entity.networkEntity.networkEntity.__getitem__ (   self,
  key 
)

Definition at line 69 of file networkEntity.py.

00069                               :
00070         
00071         if hasattr(self, key):
00072             return getattr(self, key)
00073         else:
00074             errString = ":There was an error getting retreiving [%s] key: Attribute does not exist" % (key)
00075             logger.log(__name__ + errString)
00076             return ""        
00077     
    ## Given a reference the Geo IP Database, this function will

def objects.logic.entity.networkEntity.networkEntity.__init__ (   self,
  selfIPAddress,
  decodedPacketDict,
  geoIPDatabase,
  xportTableDict 
)

Definition at line 24 of file networkEntity.py.

00024                                                                                        :
00025         # all sorts of ill shit
00026         self.selfIPAddress = selfIPAddress
00027         
00028         
00029         if decodedPacketDict['sourceIP'] == self.selfIPAddress:
00030             self.foreignIPAddress = decodedPacketDict['destIP']
00031             self.foreignPort      = decodedPacketDict['destPort']
00032             self.selfPort         = decodedPacketDict['sourcePort']            
00033         else:
00034             self.foreignIPAddress = decodedPacketDict['sourceIP']
00035             
00036             self.foreignPort      = decodedPacketDict['sourcePort']
00037             self.selfPort         = decodedPacketDict['destPort']
00038         
00039         self.since                = time.time()
00040         self.lastUpdateTS         = time.time()
00041         self.totalBytes           = 0
00042         self.procID               = ""
00043         self.procName             = ""
00044         
00045         self.foreignLongitude     = 0.0
00046         self.foreignLatitude      = 0.0        
00047         self.foreignCity          = ""
00048         self.foreignStateProv     = ""
00049         self.foreignCountry       = ""
00050         self.foreignOrganization  = ""
00051         self.foreignISP           = ""
00052         
00053         self.Pid                  = "0"        
00054         self.processName          = "Unknown";
00055         
00056         self.resolveGeoData(geoIPDatabase)        
00057         
00058         # now get the PID and Process Name
00059         nodeInfo, processState = xportTableDict.getXportTableInfo(self.selfPort)
00060         
00061         if nodeInfo is not None:
00062             self.processName = nodeInfo["ProcessName"]
00063             self.Pid         = "%d" % nodeInfo["Pid"]
00064             
00065     
    def __str__(self):

def objects.logic.entity.networkEntity.networkEntity.__str__ (   self  ) 

Definition at line 66 of file networkEntity.py.

00066                      :
00067         pass
00068     
    def __getitem__(self, key):

def objects.logic.entity.networkEntity.networkEntity.computeStatistics (   self,
  decodedPacketDict 
)

Computed some basic statistics (last update, total bytes).

Parameters:
decodedPacketDict Decoded Packet Dictionary

Definition at line 109 of file networkEntity.py.

00109                                                   :
00110         self.lastUpdateTS         = time.time()
00111         self.totalBytes          += decodedPacketDict['payloadSize']
00112         
00113         #print self.foreignIPAddress, " ", self.totalBytes
00114     
00115     
    

def objects.logic.entity.networkEntity.networkEntity.resolveGeoData (   self,
  geoIPDatabase 
)

Given a reference the Geo IP Database, this function will resolve the Geographical details of itself.

Parameters:
geoIPDatabase database object created by the entityManager class

Definition at line 81 of file networkEntity.py.

00081                                            :
00082         
00083         geoIPDatabase.find_by_addr(self.foreignIPAddress)
00084         
00085         try:
00086             self.foreignLatitude     = geoIPDatabase.latitude
00087             self.foreignLongitude    = geoIPDatabase.longitude
00088             self.foreignCity         = unicode(geoIPDatabase.city)
00089             self.foreignCountry      = geoIPDatabase.country_name      
00090             self.foreignOrganization  = unicode(geoIPDatabase.organization)
00091             self.foreignISP           = unicode(geoIPDatabase.isp)
00092         except Exception, ex:
00093             logger.log(__name__ + ": There was an exception extracting GEOIP information")
00094             logger.log(ex) 
00095         
00096         if self.foreignCity == "" or self.foreignCity == None:
00097             self.exactLocation = False
00098             self.foreignCity = "Unknown"
00099             
00100         else:
00101             self.exactLocation = True
00102             
00103         if self.foreignCountry == "" or self.foreignCountry == None:
00104             self.foreignCountry = "Unknown"
00105         
00106                         
    ## Computed some basic statistics (last update, total bytes)


Member Data Documentation

Definition at line 97 of file networkEntity.py.

Definition at line 47 of file networkEntity.py.

Definition at line 49 of file networkEntity.py.

Definition at line 30 of file networkEntity.py.

Definition at line 51 of file networkEntity.py.

Definition at line 46 of file networkEntity.py.

Definition at line 45 of file networkEntity.py.

Definition at line 50 of file networkEntity.py.

Definition at line 31 of file networkEntity.py.

Definition at line 48 of file networkEntity.py.

Definition at line 40 of file networkEntity.py.

Definition at line 53 of file networkEntity.py.

Definition at line 54 of file networkEntity.py.

Definition at line 42 of file networkEntity.py.

Definition at line 43 of file networkEntity.py.

Definition at line 26 of file networkEntity.py.

Definition at line 32 of file networkEntity.py.

Definition at line 39 of file networkEntity.py.

Definition at line 41 of file networkEntity.py.


The documentation for this class was generated from the following file:

Generated on Mon Mar 30 00:26:42 2009 for EyeSpy by  doxygen 1.5.8