wtorek, 19 stycznia 2010

simple Flash socket policy server using python Twisted

Well I was reading the articles about flashplayer socket policy.
http://www.adobe.com/devnet/flashplayer/articles/socket_policy_files.html


http://www.adobe.com/devnet/flashplayer/articles/fplayer9_security.html
I started wondering how many lines of code will it take to run the server with python and twisted and here it is.


from twisted.internet import reactor
from twisted.internet.protocol import Factory, Protocol

class PolicySocketProtocol(Protocol):
def dataReceived(self, data):
self.transport.write("\0")

class PolicyFactory(Factory):
def __init__(self):
self.protocol = PolicySocketProtocol;

if __name__ == '__main__':
reactor.listenTCP(843, PolicyFactory(), interface="127.0.0.1")
reactor.run()


The server is running on localhost to change this simply modify "127.0.0.1" to your host name. It's allowing to access on all ports and all domains what is not recommended for known reasons :)

Brak komentarzy:

Prześlij komentarz