mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Correct endianness of IP addresses in SNMP.
Addresses BIT-1644
This commit is contained in:
parent
51b8dee70b
commit
7603567782
5 changed files with 47 additions and 2 deletions
|
@ -39,7 +39,7 @@ AddrVal* network_address_to_val(const ASN1Encoding* na)
|
|||
|
||||
const u_char* data = reinterpret_cast<const u_char*>(bs.data());
|
||||
uint32 network_order = extract_uint32(data);
|
||||
return new AddrVal(network_order);
|
||||
return new AddrVal(ntohl(network_order));
|
||||
}
|
||||
|
||||
Val* asn1_obj_to_val(const ASN1Encoding* obj)
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
138.68.0.1
|
||||
138.68.14.240
|
||||
169.254.169.254
|
||||
10.46.0.5
|
||||
127.0.0.1
|
||||
138.68.10.203
|
||||
255.255.0.0
|
||||
255.0.0.0
|
||||
255.255.240.0
|
||||
0.0.0.0
|
||||
10.46.0.0
|
||||
138.68.0.0
|
||||
138.68.0.1
|
||||
0.0.0.0
|
||||
0.0.0.0
|
||||
0.0.0.0
|
||||
255.255.0.0
|
||||
255.255.240.0
|
||||
138.68.0.1
|
||||
138.68.14.240
|
||||
169.254.169.254
|
||||
0.0.0.0
|
||||
10.46.0.0
|
||||
138.68.0.0
|
||||
0.0.0.0
|
||||
255.255.0.0
|
||||
255.255.240.0
|
||||
138.68.0.1
|
||||
0.0.0.0
|
||||
0.0.0.0
|
|
@ -3,7 +3,7 @@ snmp_trap
|
|||
is_orig: T
|
||||
[community=public]
|
||||
enterprise: 1.3.6.1.4.1.31337.0
|
||||
agent: 1.0.0.127
|
||||
agent: 127.0.0.1
|
||||
generic_trap: 0
|
||||
specific_trap: 0
|
||||
time_stamp: 0
|
||||
|
|
BIN
testing/btest/Traces/snmp/snmpwalk-short.pcap
Normal file
BIN
testing/btest/Traces/snmp/snmpwalk-short.pcap
Normal file
Binary file not shown.
15
testing/btest/scripts/base/protocols/snmp/snmp-addr.bro
Normal file
15
testing/btest/scripts/base/protocols/snmp/snmp-addr.bro
Normal file
|
@ -0,0 +1,15 @@
|
|||
# @TEST-EXEC: bro -C -b -r $TRACES/snmp/snmpwalk-short.pcap %INPUT
|
||||
# @TEST-EXEC: btest-diff .stdout
|
||||
|
||||
@load base/protocols/snmp
|
||||
|
||||
event snmp_response(c: connection, is_orig: bool, header: SNMP::Header, pdu: SNMP::PDU) {
|
||||
|
||||
for (i in pdu$bindings) {
|
||||
local binding = pdu$bindings[i];
|
||||
|
||||
if (binding$value?$address)
|
||||
print binding$value$address;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue