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("<?xml version=\"1.0\"?><!DOCTYPE cross-domain-policy SYSTEM \"/xml/dtds/cross-domain-policy.dtd\"><cross-domain-policy><site-control permitted-cross-domain-policies=\"master-only\"/><allow-access-from domain=\"*\" to-ports=\"*\" /></cross-domain-policy>\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 :)
0 ResponsesLeave a comment ?