예제 #1
0
def get(key):
    try:
        return config.get('GLOBAL', str(key).lower());
    except Exception, ex:

        general_logger.error('No properties key found for : ' + key)
        print "Exception at reading properties file", str(ex)
        return None
예제 #2
0
    def run(self):
        try:
            filter_text = get("RECEIVER_NETWORK_FILTER_" + self.__network)
            while True:
                #sniff(iface = self.__iface, prn = self.callback,
                 #     filter = filter_text, timeout = 10,
                  #    store = 0)

                if self.__stop:
                    raise ThreadExit()
        except ThreadExit:
            general_logger.info("Thread on network " + self.__network + 
                                " stopped")
        except Exception, ex:
            general_logger.error("Exception occured at receiver for network " +\
                                 self.__network + " : " + str(ex))
            general_logger.info("The application will not listen for packets" +\
                                " coming on network : " + self.__network)
            traceback.print_exc(file=sys.stdout)
            general_logger.error("Crash", exc_info = 1)
예제 #3
0
                choice = raw_input("Please enter the script number (1 - 24) or"\
                                   " 25 for Analyzer or 0 to exit : ")
                if choice == "":
                    continue

                choice = int(choice)
                if choice == 0:
                    break
                elif choice == 25:
                    analyzer = Analyzer()
                    analyzer.start()
                    continue
                elif choice > 25 or choice < 0 or choice == 7:
                    general_logger.warning("Invalid option %d" % choice)
                    continue
                script = eval("Script%03d" % choice)(application)
                script.run()
                script.stop()
            except KeyboardInterrupt:
                    if script != None:
                        script.stop()
            except Exception, ex:
                general_logger.error("Could not execute the script. : %s" % \
                                     (str(ex)))
                traceback.print_exc(file=sys.stdout)

    except KeyboardInterrupt:
        pass
    finally:
        application.close()