INetworkPacketParser
1.0.0
INetworkPacketParser
is a lightweight object-oriented TCP/IP
protocol stack parsing tool.
INetworkPacketParser
is a lightweight object-oriented TCP/IP
protocol stack parsing tool.
Supports converting binary data transmitted over the network into OC objects`
IP Packet
data packet analysisTCP/UDP/ICMP
data segment analysisDNS
message analysis (including request and response messages) Supports modifying OC object attributes and converting them into binary data that can be directly transmitted over the network
IP Packet
message construction and tamperingTCP/UDP
data segment construction and tamperingresolv.lib
(automatically installed by CocoaPods) Support cocoapods installation
pod 'INetworkPacketParser'
- (void)test {
// 网络二进制报文
NSString *hex = @"4500003c 734f0000 ff114f69 0a0a0a0a 72727272 cd240035 00284c24 63780100 00010000 00000000 03777777 0669636c 6f756403 636f6d00 00010001";
NSData *rawData = [self dataFromHexString:hex];
// IP数据包解析
IPPacket *packet = [[IPPacket alloc] initWithRawData:rawData];
if (packet.header.transportProtocol == UDP) {
// UDP解析
IPUDPSegment *udpSegment = [[IPUDPSegment alloc] initWithRawData:packet.payload];
if (udpSegment.header.destPort == 53) {
// DNS解析
IPDNSMessage *dnsMessage = [[IPDNSMessage alloc] initWithRawData:udpSegment.payload];
dnsMessage.dnsHeader;
dnsMessage.dnsQuery;
dnsMessage.dnsAnswers;
}
}else if (packet.header.transportProtocol == TCP) {
// TCP解析
IPTCPSegment *tcpSegment = [[IPTCPSegment alloc] initWithRawData:packet.payload];
}
}
smallyou, [email protected]
Github: smallyou | Jianshu: January 23