最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

Frida API操作之網(wǎng)絡(luò)API

2020-10-08 09:26 作者:無情劍客Burning  | 我要投稿

在聊天系統(tǒng)開發(fā)(1) 的文章中,對TCP/IP相關(guān)的網(wǎng)絡(luò)編程進行了介紹。在Frida API進階-文件 對文件描述符、輸入輸出流進行了介紹。本篇文章集于此介紹Frida中網(wǎng)絡(luò)相關(guān)的API。

Socket

Socket.listen([options]): open a TCP or UNIX listening socket. Returns a Promise that receives a SocketListener. Defaults to listening on both IPv4 and IPv6, if supported, and binding on all interfaces on a randomly selected TCP port.

Socket.connect(options): connect to a TCP or UNIX server. Returns a Promise that receives a SocketConnection.

Socket.type(handle): inspect the OS socket handle and return its type as a string which is either tcp, udp, tcp6, udp6, unix:stream, unix:dgram, or null if invalid or unknown.

Socket.localAddress(handle), Socket.peerAddress(handle): inspect the OS socket handle and return its local or peer address, or null if invalid or unknown. The object returned has the fields:

  • ip: (IP sockets) IP address as a string.

  • port: (IP sockets) IP port as a number.

  • path: (UNIX sockets) UNIX path as a string.

SocketListener

All methods are fully asynchronous and return Promise objects.

  • path: (UNIX family) path being listened on.

  • port: (IP family) IP port being listened on.

  • close(): close the listener, releasing resources related to it. Once the listener is closed, all other operations will fail. Closing a listener multiple times is allowed and will not result in an error.

  • accept(): wait for the next client to connect. The returned Promise receives a SocketConnection.

SocketConnection

Inherits from IOStream. All methods are fully asynchronous and return Promise objects.

  • setNoDelay(noDelay): disable the Nagle algorithm if noDelay is true, otherwise enable it. The Nagle algorithm is enabled by default, so it is only necessary to call this method if you wish to optimize for low delay instead of high throughput.

代碼示例

  1. function frida_Java() {

  2. Java.perform(function () {

  3. ? ? ?var ip_family = new Object();

  4. ? ? ?ip_family.family = "ipv4";

  5. ? ? ?ip_family.host = "47.92.90.25";

  6. ? ? ?ip_family.port = 7000;

  7. ? ? ?var socket = Socket.connect(ip_family);

  8. ? ? ?socket.then(function(successMessage){

  9. ? ? ? ?console.log(successMessage instanceof SocketConnection);

  10. ? ? ? ?successMessage.setNoDelay(true);

  11. ? ? ? ?var promise = successMessage.input.read(1000);

  12. ? ? ? ?promise.then(function(result){

  13. ? ? ? ? ?console.log(' burning'+hexdump(result,{lenght:1000}));

  14. }).catch(function(error){

  15. ? ? ? ? ?console.log(' fail:'+error);

  16. });

  17. });

運行結(jié)果如下,可以看出successMessage的類型是SocketConnection。

Nagle algorithm

在發(fā)出去的數(shù)據(jù)還沒有被確認(rèn)之前,假如又有小數(shù)據(jù)生成,那么就把小數(shù)據(jù)收集起來,湊滿一個MSS或者等收到確認(rèn)后再發(fā)送。

JavaScript判斷數(shù)據(jù)類型

instanceof 是用來判斷 A 是否為 B 的實例,表達式為:A instanceof B,如果 A 是 B 的實例,則返回 true,否則返回 false。 在這里需要特別注意的是:instanceof 檢測的是原型。

由上圖可以看出[]的原型指向Array.prototype,間接指向Object.prototype, 因此 [] instanceof Array 返回true, [] instanceof Object 也返回true。

其他的判斷方式

  1. typeof

  2. toString?Object.prototype.toString.call(window);//[object global] window 是全局對象 global 的引用

  3. constructor

公眾號

更多Frida相關(guān)內(nèi)容,歡迎關(guān)注我的微信公眾號:無情劍客。


Frida API操作之網(wǎng)絡(luò)API的評論 (共 條)

分享到微博請遵守國家法律
泰安市| 武定县| 海口市| 苏州市| 深圳市| 朝阳市| 科技| 黔南| 云和县| 休宁县| 建始县| 罗定市| 通城县| 青岛市| 兰溪市| 鄂尔多斯市| 深水埗区| 盐池县| 米易县| 浠水县| 宜州市| 年辖:市辖区| 偏关县| 乐东| 祁阳县| 邹平县| 成安县| 绵阳市| 通榆县| 鹰潭市| 花莲市| 衡山县| 九寨沟县| 宜兴市| 改则县| 大庆市| 临漳县| 定陶县| 类乌齐县| 扎囊县| 开原市|