Hi Guys,<br><br>I stumpled upon a small dns filter program, that I am having trouble running, due to &quot;twisted.internet.app&quot; being deprecated. I get the following output &quot;Failed to load application: cannot import name app&quot;<br>
<br>Im running &quot;twistd (the Twisted daemon) 2.5.0&quot;<br><br>Any advice on how to proceed?<br><br>Kind regards<br><br>Tax<br><br>#!/usr/bin/python<br>#<br># Run this as root with the command<br>#   twistd -y dnsfilter.py<br>
<br>from twisted.internet import app, defer<br>from twisted.protocols import dns<br>from twisted.names import client, server<br><br>roots = [<br>(&#39;198.41.0.4&#39;,53), (&#39;128.9.0.107&#39;,53), (&#39;192.33.4.12&#39;,53), (&#39;128.8.10.90&#39;,53),<br>
(&#39;192.203.230.10&#39;,53), (&#39;192.5.5.241&#39;,53), (&#39;192.112.36.4&#39;,53),<br>(&#39;128.63.2.53&#39;,53), (&#39;192.36.148.17&#39;,53), (&#39;192.58.128.30&#39;,53),<br>(&#39;193.0.14.129&#39;,53), (&#39;198.32.64.12&#39;,53), (&#39;202.12.27.33&#39;,53), ]<br>
<br>#roots = [(&#39;202.129.64.42&#39;,53)]   # just use my ISP&#39;s DNS<br><br>VERISIGN=&#39;@^n\x0b&#39; # 64.94.110.11<br><br>class AntiVerisignResolver(client.Resolver):<br>    def filterAnswers(self, message):<br>        if message.trunc:<br>
            return self.queryTCP(message.queries).addCallback(self.filterAnswers)<br>        else:<br>            for i in range(len(message.answers)):<br>                x = message.answers[i]<br>                if x.type==1 and x.payload and x.payload.address==VERISIGN:<br>
                    message.answers[i] = None<br>            return (filter(lambda x:x,message.answers),<br>                    message.authority,<br>                    message.additional)<br><br>verbosity = 0<br>resolver = AntiVerisignResolver(servers=roots)<br>
f = server.DNSServerFactory(clients=[resolver], verbose=verbosity)<br>p = dns.DNSDatagramProtocol(f)<br>f.noisy = p.noisy = verbosity<br><br>application = app.Application(&#39;Non caching anti-verisign domain name resolver&#39;)<br>
application.listenUDP(53, p)<br>application.listenTCP(53, f)<br><br><br>src:<br><a href="http://osdir.com/ml/python.twisted/2003-09/msg00055.html">http://osdir.com/ml/python.twisted/2003-09/msg00055.html</a><br>