
最近在分析一个直播网站,初步分析后发现是在 swf 中用 socket 通讯返回的 flv 地址。
其中 Actionscript socket 通讯的关键代码如下:
this._socket = new Socket(); this._socket.addEventListener(Event.CONNECT,this.onConnect); this._socket.addEventListener(ProgressEvent.SOCKET_DATA,this.onSocketData); this._socket.addEventListener(Event.CLOSE,this.handleClose); this._socket.connect(this._ip,uint(this._port)); private function onConnect(param1:Event) : void { var _loc1_:ByteArray = new ByteArray(); _loc1_.endian = Endian.LITTLE_ENDIAN; _loc1_.writeUnsignedInt(uint(this._sid)); _loc1_.writeUnsignedInt(uint(this._uid)); _loc1_.writeByte(this._needRotation == 0?0:1); _loc1_.position = 0; this._socket.writeBytes(_loc1_); this._socket.flush(); } private function onSocketData(param1:ProgressEvent) : void { if(this._socket.bytesAvailable > 0) { _loc5_ = new ByteArray(); this._socket.readBytes(_loc5_); _loc5_.position = 0; this._render.put(_loc5_); } } 其中几个变量都是在 html 中由 FlashVars,向 swf 传递。
<param name="FlashVars" value="uid=3452777999&sid=2124798641&srv=45.255.132.43&port=7207&needRotation=0" /> 我尝试用 java 写了一下,但是始终得不到返回值。
Socket socket = new Socket("45.255.132.43", 7207); OutputStream outputStream = socket.getOutputStream(); ByteBuffer bb = ByteBuffer.allocate(16); bb.order(ByteOrder.LITTLE_ENDIAN); bb.putLong(2124798641L); bb.putLong(3452777999L); bb.put((byte)0); bb.position(0); outputStream.write(bb.array()); outputStream.flush(); socket.shutdownOutput(); InputStream is = socket.getInputStream(); System.out.println(is.available()); System.out.println(is.read()); 特上 v2 向大佬求救。。。
1 Aidenboss Apr 15, 2019 可以先用 nc 45.255.132.43 7207 或者 telnet 测试下, 感觉有问题呀 |
2 抓包看看差异。感觉 putLong 有点问题吧。 |