mirror of
https://github.com/mfontanini/libtins
synced 2026-01-23 02:35:57 +01:00
Added TCPStreamFollower class. It seems to be working right.
This commit is contained in:
@@ -45,7 +45,7 @@ typedef std::pair<Sniffer*, std::string> sniffer_data;
|
||||
* the scanned port's status.
|
||||
*/
|
||||
bool handler(PDU *pdu) {
|
||||
TCP *tcp = pdu->find_inner_pdu<TCP>();
|
||||
TCP *tcp = pdu->find_pdu<TCP>();
|
||||
if(tcp) {
|
||||
// Ok, it's a TCP PDU. Is RST flag on? Then port is closed.
|
||||
if(tcp->get_flag(TCP::RST)) {
|
||||
|
||||
@@ -93,15 +93,15 @@ private:
|
||||
}
|
||||
|
||||
bool sniff_callback(PDU *pdu) {
|
||||
IP *ip = pdu->find_inner_pdu<IP>();
|
||||
RawPDU *raw = pdu->find_inner_pdu<RawPDU>();
|
||||
IP *ip = pdu->find_pdu<IP>();
|
||||
RawPDU *raw = pdu->find_pdu<RawPDU>();
|
||||
if(ip && raw) {
|
||||
ttl_map::const_iterator iter;
|
||||
IP inner_ip;
|
||||
// This will fail if its a corrupted packet
|
||||
try {
|
||||
// Fetch the IP PDU attached to the ICMP response
|
||||
inner_ip = IP(raw->payload(), raw->header_size());
|
||||
inner_ip = IP(&raw->payload()[0], raw->payload_size());
|
||||
}
|
||||
catch(std::runtime_error &ex) {
|
||||
return running;
|
||||
|
||||
Reference in New Issue
Block a user