2 ##############################################################################
3 # pfixtools: a collection of postfix related tools #
5 # ________________________________________________________________________ #
7 # Redistribution and use in source and binary forms, with or without #
8 # modification, are permitted provided that the following conditions #
11 # 1. Redistributions of source code must retain the above copyright #
12 # notice, this list of conditions and the following disclaimer. #
13 # 2. Redistributions in binary form must reproduce the above copyright #
14 # notice, this list of conditions and the following disclaimer in the #
15 # documentation and/or other materials provided with the distribution. #
16 # 3. The names of its contributors may not be used to endorse or promote #
17 # products derived from this software without specific prior written #
20 # THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS #
21 # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED #
22 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE #
23 # DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY #
24 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL #
25 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS #
26 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) #
27 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, #
28 # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN #
29 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE #
30 # POSSIBILITY OF SUCH DAMAGE. #
31 ##############################################################################
33 # Copyright (c) 2008 Florent Bruneau
37 def headers(file, source, type):
38 file.write("# Do not edit, file autogenerated by %s\n" % sys.argv[0])
39 file.write("# This file has been generated from %s blacklist\n" % source)
40 file.write("# it contains %s matching rules for postlicyd\n" % type)
43 source = open(rbl, "r")
44 hosts = open("%s_hosts" % rbl, "w")
45 domains = open("%s_domains" % rbl, "w")
47 headers(hosts, rbl, "hosts")
48 headers(domains, rbl, "domains")
54 domains.write(line[1:]);
56 if __name__ == '__main__':
57 if len(sys.argv) == 1:
58 print "Usage: %s [input] ..." % sys.argv[0]
61 map(convert, sys.argv[1:])
63 # vim:set syntax=python: