I'm making a network analysis tool using python 2.5 ( windows) , that captures network traffic using scapy and stores the capture data in *.pcap file . What i'm trying to achieve is to allow users to write their own functions that can analyze the network traffic . So what i did is that i created a interface class that would allow users to write the function.
#analyzer function class
class date_validator:
def __init__(self,dbh):
#any intializations required for the function.
self.dbHandle=dbh
#All interaction with the database can be done by using this handle.
return
def importer(self):
#contains all the modules that have to be imported for
#execution of the analyzer function.
return
def LogAnalyzer(self):
#Main function that contains the analyzer code.
return data
#this function must return 2D data to populate a table View.
# It can accomadate 1D data also .
Now the problem that i face is that after packaging the whole program as an exe , if i load a analyzer function with the above given structure and it has to import a module lets say " import nmap " how will that work and in case that module is installed on the system ?
So my question is that how do i accomplish this task , is there a better way ?
Thanks in advance .