In a conclusion to http://www.techshinobi.com/index.php/java-socks-proxy-in-applets-tor/
Here is the same goal achieved using Actionscript and PyCURL this allows us to avoid unnecessary security warnings when displaying images.
package { import flash.display.Sprite; import flash.display.Loader; import flash.net.URLLoader; import flash.net.URLRequest; import flash.net.URLLoaderDataFormat; import flash.geom.Rectangle; import flash.events.Event; import flash.events.ProgressEvent; import flash.events.IOErrorEvent; import flash.utils.ByteArray; import flash.system.Security; public class Main extends Sprite { Security.loadPolicyFile('http://xx.xx.xxx.xxx/cryaboutit/static/crossdomain.xml'); Security.allowDomain('xx.xx.xxx.xxx'); Security.allowDomain('xx.xx.xxx.xxx:8118'); public var loader:URLLoader = new URLLoader(); public var proxy:String = "http://xx.xx.xxx.xxx/cryaboutit/mab_request?url="; public function Main():void { loader.dataFormat = URLLoaderDataFormat.BINARY; loader.load(new URLRequest(proxy + "http://123OnionDomain.onion/mabo/static/bike.png")); loader.addEventListener(IOErrorEvent.IO_ERROR, ioError_handler, false, 0, true); loader.addEventListener(ProgressEvent.PROGRESS, loadProgress); loader.addEventListener(Event.COMPLETE, loadComplete); } public function ioError_handler(e:IOErrorEvent):void { trace(e.toString()); } public function loadProgress(e:ProgressEvent):void { var percentLoaded:Number = Math.round((e.bytesLoaded/e.bytesTotal) * 100); trace("Loading: " + percentLoaded + "%"); } public function loadComplete(e:Event):void { var img_loader:Loader = new Loader(); img_loader.loadBytes(loader.data); addChild(img_loader); } } }
then using PyCURL/CURL as an interface between actionscript and the Privoxy Server
import pycurl import cStringIO def mab_request(): re_url = str(request.get_vars["url"]) buf = cStringIO.StringIO() c = pycurl.Curl() c.setopt(pycurl.URL, str(re_url)) c.setopt(pycurl.PROXY, "xx.xx.xxx.xxx") c.setopt(pycurl.PROXYPORT, 8118) c.setopt(pycurl.PROXYTYPE, pycurl.PROXYTYPE_HTTP) c.setopt(pycurl.HTTPPROXYTUNNEL, 1) c.setopt(pycurl.WRITEFUNCTION, buf.write) c.perform() return buf.getvalue()
The crossdomain.xml policy file
<?xml version="1.0" ?> <cross-domain-policy> <allow-access-from domain="xx.xx.xxx.xxx" /> </cross-domain-policy>
All articles from bottom(start) to top(end)
http://www.techshinobi.com/index.php/actionscript-pycurl-socks-part-3/
http://www.techshinobi.com/index.php/actionscript-pycurl-socks-part-2/
http://www.techshinobi.com/index.php/actionscript-pycurl-and-socks/
http://www.techshinobi.com/index.php/java-socks-proxy-in-applets-tor/