Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------------- download maxmind GeoLite2 Free database into easy to use alias files [<COUNTRY>-<PROTO>] located in /usr/local/share/GeoIP/alias """ from lib.geoip import download_geolite # output files and lines processed print ('%d files written, with a total number of %d lines' % download_geolite())
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------------- download maxmind GeoLite2 Free database into easy to use alias files [<COUNTRY>-<PROTO>] located in /usr/local/share/GeoIP/alias """ from lib.geoip import download_geolite # output files and lines processed data = download_geolite() print ("%(file_count)d files written, with a total number of %(address_count)d lines" % data) print ("locations filename : %(locations_filename)s" % data) print ("IPv4 filename : %(IPv4)s" % data['address_sources']) print ("IPv6 filename : %(IPv6)s" % data['address_sources'])
result = {'status': 'ok'} parser = argparse.ArgumentParser() parser.add_argument('--output', help='output type [json/text]', default='json') parser.add_argument('--source_conf', help='configuration xml', default='/usr/local/etc/filter_tables.conf') inputargs = parser.parse_args() # make sure our target directory exists if not os.path.isdir('/var/db/aliastables'): os.makedirs('/var/db/aliastables') # make sure we download geoip data if not found. Since aliases only will trigger a download when change requires it if not os.path.isfile('/usr/local/share/GeoIP/alias.stats'): geoip.download_geolite() try: source_tree = ET.ElementTree(file=inputargs.source_conf) except ET.ParseError as e: syslog.syslog( syslog.LOG_ERR, 'filter table parse error (%s) %s' % (str(e), inputargs.source_conf)) sys.exit(-1) aliases = AliasParser(source_tree) aliases.read() registered_aliases = set() for alias in aliases: registered_aliases.add(alias.get_name())
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------------- download maxmind GeoLite2 Free database into easy to use alias files [<COUNTRY>-<PROTO>] located in /usr/local/share/GeoIP/alias """ from lib.geoip import download_geolite # output files and lines processed print('%d files written, with a total number of %d lines' % download_geolite())