后端开发|php教程
php,flash,as3,socket
后端开发-php教程
前段时间在flashseer看到有人提到:可以通过socket方式传送swf文件,让用户无法获取到swf文件… 当时还没有出as3的反编译,所以对程序的保护没有在意.随着反编译程序的平民化,不希望别人看到源代码的朋友就比较着急…
android 爱消除源码,ubuntu地址配置方法,tomcat6解压办,鱼打爬虫,php软件有什么,什么是seo seolzw
通过socket方式传送swf文件来避免泄漏源代码的思路(只适用as3): 让主程序的loader(前台swf)通过socket连接到后台程序,然后请求需要的主程序文件.后台读取主程序数据通过socket发送给主程序的 loader.前台swf适用Loader.loadBytes方法显示主程序文件.
傲翼手机源码,vscode能写html,ubuntu共享文件夹大小限制,tomcat 随机端口,qt4.8sqlite,淘宝专题插件,web前端设计框架是什么,猫爬虫表情包图片,php怎么测试,镇赉优化seo,网站主题网,会员登陆系统网页代码,php 小说 模板,美食杰 网站 程序lzw
下面是测试的源程序:
手机微导航源码下载,vscode设置改成,ubuntu 1070,tomcat日志说明,sqlite三联表,jquery metadata 插件,传统项目前端框架如何选型,爬虫工程师面试要求,php pdf读取,简述SEO的优点,.net 教育机构网站源码,无限刷新网页,html css js网页模板下载lzw
package {import flash.display.Sprite;import .Socket;import flash.events.*;import flash.errors.IOError;import flash.display.Loader;public class SocketTest extends Sprite { public function SocketTest() { var socket = new Socket(); socket.connect("localhost", 5277); socket.addEventListener(Event.CLOSE, closeHandler); socket.addEventListener(Event.CONNECT, connectHandler); socket.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); socket.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); socket.addEventListener(ProgressEvent.SOCKET_DATA, socketDataHandler); var response:String; function writeln(str:String):void { str+=""; try { socket.writeUTFBytes(str); } catch (e:IOError) { trace(e); } } function sendRequest():void { trace("sendRequest"); response=""; writeln(in); socket.flush(); } function readResponse():void { //接受数据 var str:String=socket.readUTFBytes(socket.bytesAvailable); response+=str; //当数据以end结束的时候,数据传输结束 if (StringUtil.endsWith(str,end)) { response=response.substr(0,response.length-3); //把字符串转换为ByteArray var ba=Base64.decodeToByteArray(response); //trace(ytearray=====,ba); var l:Loader = new Loader(); //从 ByteArray 对象中所存储的二进制数据中加载。 l.loadBytes(ba); //trace(l.content); addChild(l); } } function closeHandler(e:Event):void { trace("Socket closed! "); } function connectHandler(e:Event):void { trace("Socket connected!"); sendRequest(); } function ioErrorHandler(e:IOErrorEvent):void { trace("IOError!"); } function securityErrorHandler(e:SecurityErrorEvent):void { trace("SecurityError!"); } function socketDataHandler(e:ProgressEvent):void { trace("Socket have data!"); readResponse(); } }}}
PHP:
//后台scoket程序,由于适用php写比较简单,就用php写了.//error_reporting(E_ALL);error_reporting(0);set_time_limit(0);ob_implicit_flush();$address = localhost;$port = 5277;if (($sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) < 0) {echo socket_create() failed: reason: . socket_strerror($sock) . \ ;}if (($ret = socket_bind($sock, $address, $port)) < 0) {echo socket_bind() failed: reason: . socket_strerror($ret) . \ ;}if (($ret = socket_listen($sock, 5)) < 0) {echo socket_listen() failed: reason: . socket_strerror($ret) . \ ;}echo connect…………….;do {if (($msgsock = socket_accept($sock)) < 0) { echo socket_accept() failed: reason: . socket_strerror($msgsock) . \ ; break;}do { socket_recv($msgsock, $buf, 2048, 0); if ($buf == "") { socket_close($msgsock); echo "some one quit"; break; } else if ($buf == "bin") { //读取主程序数据 $f = fopen(main.swf, ); $data = fread($f,filesize(main.swf)); fclose($f); //转换为字符串 //echo base64_encode($data); $talkback = base64_encode($data).end; } //发送 socket_send($msgsock, $talkback, strlen($talkback),0);} while (true);socket_close($msgsock);} while (true);socket_close($sock);