Example #1
0
                info['geo']['country'] = '中国' + info['geo']['country']
            if info['geo']['country'] == '中华民国':
                info['geo']['country'] = '中国台湾'

            info['geo']['location'] = {
                'lat': resp.location.latitude,
                'lon': resp.location.longitude
            }
        except Exception as e:
            self.log(e, LogLevel.ERROR)

        return info


if __name__ == '__main__':
    plugins = Plugin.loadPlugins(os.path.join(os.path.dirname(__file__), ".."),
                                 True)
    msg = {
        "ip": "202.106.0.20",
        "port": 80,
        "pro": "TCP",
        "host": "111.206.63.16:80",
        "data":
        "6765745f696e666f3a20706c7567696e730a5250525420300a617366647361666173667361666173",
        "tag": "sensor-ens160"
    }
    msg_update = {}
    for i in sorted(plugins.keys()):
        (pluginName, plugin) = plugins[i]
        if pluginName == 'geoip':
            ctime = time.time()
            ret = plugin.execute(msg)