Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use libnet_build_tcp_options to set up options data

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article will explain in detail how to use libnet_build_tcp_options to set up options data. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

When sending TCP SYN data using libnet, the options information is generally not set by default, that is, there is no mss and timestamp.

In some IDC computer rooms, this data is intercepted. The phenomenon is that there is no problem with using telnet access, but there is no response when libnet sends SYN packets. You need to set the options information when sending the package. Libnet provides libnet_builf_tcp_options to set up.

Uint8_t payload [20] = {0x00}; static int set_options_payload (uint8_t * payload,uint32_t timeval,uint16_t mss) {int len = 0; / set mss value payload [len++] = 0x02; payload [len++] = 0x04; payload [len++] = (uint8_t) ((mss > > 8) & 0xFF); payload [len++] = (uint8_t) (mss & 0xFF); / / set SACK payload [len++] = 0x04 Payload [len++] = 0x02; / / set timeval payload [len++] = 0x08; payload [len++] = 0x0a; payload [len++] = (uint8_t) ((timeval > 24) & 0xFF); payload [len++] = (uint8_t) ((timeval > > 16) & 0xFF); payload [len++] = (uint8_t) (timeval > > 8) & 0xFF); payload [len++] = (uint8_t) (timeval & 0xFF); len+=4 / / set NOP payload [len++] = 0x01; / / set Window scale payload [len++] = 0x03; payload [len++] = 0x03; payload [len] = 0x07; return 0;} r = libnet_build_tcp_options (payload, 20, l, 0) This is the end of this article on "how to use libnet_build_tcp_options to set up options data". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report