Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace remaining rfind_pdu calls to find_pdu in src directory #527

Merged
merged 1 commit into from
Mar 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/crypto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -705,8 +705,11 @@ WPA2Decrypter::bssids_map::const_iterator WPA2Decrypter::find_ap(const Dot11Data

bool WPA2Decrypter::decrypt(PDU& pdu) {
if (capturer_.process_packet(pdu)) {
try_add_keys(pdu.rfind_pdu<Dot11Data>(), capturer_.handshakes().front());
capturer_.clear_handshakes();
Dot11Data* data = pdu.find_pdu<Dot11Data>();
if (data) {
try_add_keys(*data, capturer_.handshakes().front());
capturer_.clear_handshakes();
}
}
else if (const Dot11Beacon* beacon = pdu.find_pdu<Dot11Beacon>()) {
if (aps_.count(beacon->addr3()) == 0) {
Expand Down
8 changes: 5 additions & 3 deletions src/tcp_ip/stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ Stream::Stream(PDU& packet, const timestamp_type& ts)
client_hw_addr_ = eth->src_addr();
server_hw_addr_ = eth->dst_addr();
}
const TCP& tcp = packet.rfind_pdu<TCP>();
// If this is not the first packet of a stream (SYN), then it's a partial stream
is_partial_stream_ = !tcp.has_flags(TCP::SYN);
const TCP* tcp = packet.find_pdu<TCP>();
if (tcp) {
// If this is not the first packet of a stream (SYN), then it's a partial stream
is_partial_stream_ = !tcp->has_flags(TCP::SYN);
}
}

void Stream::process_packet(PDU& packet, const timestamp_type& ts) {
Expand Down
Loading