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 REGENTS AND CONTRIBUTORS ``AS IS'' AND #
21 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE #
22 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR #
23 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS #
24 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR #
25 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF #
26 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS #
27 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN #
28 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) #
29 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF #
30 # THE 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: