Skip to content

Commit

Permalink
g3-dpi: exclude nnsp along with nntp
Browse files Browse the repository at this point in the history
  • Loading branch information
zh-jq-b committed May 15, 2024
1 parent 2a64efc commit a0c4c11
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/g3-dpi/src/protocol/ftp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ impl ProtocolInspectState {
self.exclude_other(MaybeProtocol::Smtp);
self.exclude_other(MaybeProtocol::Odmr);
self.exclude_other(MaybeProtocol::Nntp);
self.exclude_other(MaybeProtocol::Nnsp);

if &data[0..3] == b"120" {
return self.check_ftp_after_code(data, size_limit);
Expand All @@ -54,6 +55,7 @@ impl ProtocolInspectState {
return Ok(None);
}
self.exclude_other(MaybeProtocol::Nntp);
self.exclude_other(MaybeProtocol::Nnsp);

if data[2] == b'0' {
// may be SMTP
Expand All @@ -66,6 +68,7 @@ impl ProtocolInspectState {
self.exclude_other(MaybeProtocol::Smtp);
self.exclude_other(MaybeProtocol::Odmr);
self.exclude_other(MaybeProtocol::Nntp);
self.exclude_other(MaybeProtocol::Nnsp);

if &data[0..3] == b"421" {
return self.check_ftp_after_code(data, size_limit);
Expand Down
1 change: 1 addition & 0 deletions lib/g3-dpi/src/protocol/imap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ impl ProtocolInspectState {
self.exclude_other(MaybeProtocol::Odmr);
self.exclude_other(MaybeProtocol::Pop3);
self.exclude_other(MaybeProtocol::Nntp);
self.exclude_other(MaybeProtocol::Nnsp);
self.exclude_other(MaybeProtocol::Nats);
self.exclude_other(MaybeProtocol::BitTorrent);

Expand Down
1 change: 1 addition & 0 deletions lib/g3-dpi/src/protocol/nats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ impl ProtocolInspectState {
self.exclude_other(MaybeProtocol::Odmr);
self.exclude_other(MaybeProtocol::Pop3);
self.exclude_other(MaybeProtocol::Nntp);
self.exclude_other(MaybeProtocol::Nnsp);
self.exclude_other(MaybeProtocol::Imap);
self.exclude_other(MaybeProtocol::BitTorrent);

Expand Down
1 change: 1 addition & 0 deletions lib/g3-dpi/src/protocol/nntp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ impl ProtocolInspectState {
// exclude impossible protocols
self.exclude_other(MaybeProtocol::Ssh);
self.exclude_other(MaybeProtocol::Nntp);
self.exclude_other(MaybeProtocol::Nnsp);
self.exclude_other(MaybeProtocol::Imap);
self.exclude_other(MaybeProtocol::Nats);
self.exclude_other(MaybeProtocol::BitTorrent);
Expand Down
1 change: 1 addition & 0 deletions lib/g3-dpi/src/protocol/pop3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ impl ProtocolInspectState {
self.exclude_other(MaybeProtocol::Smtp);
self.exclude_other(MaybeProtocol::Odmr);
self.exclude_other(MaybeProtocol::Nntp);
self.exclude_other(MaybeProtocol::Nnsp);
self.exclude_other(MaybeProtocol::Imap);
self.exclude_other(MaybeProtocol::Nats);
self.exclude_other(MaybeProtocol::BitTorrent);
Expand Down
2 changes: 2 additions & 0 deletions lib/g3-dpi/src/protocol/smtp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ impl ProtocolInspectState {
return Ok(None);
}
self.exclude_other(MaybeProtocol::Nntp);
self.exclude_other(MaybeProtocol::Nnsp);

if data[2] == b'0' {
// may be FTP
Expand All @@ -56,6 +57,7 @@ impl ProtocolInspectState {
self.smtp_exclude_by_byte0();
self.exclude_other(MaybeProtocol::Ftp);
self.exclude_other(MaybeProtocol::Nntp);
self.exclude_other(MaybeProtocol::Nnsp);

if &data[0..3] == b"554" {
return self.check_smtp_after_code(data);
Expand Down
1 change: 1 addition & 0 deletions lib/g3-dpi/src/protocol/ssh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ impl ProtocolInspectState {
self.exclude_other(MaybeProtocol::Odmr);
self.exclude_other(MaybeProtocol::Pop3);
self.exclude_other(MaybeProtocol::Nntp);
self.exclude_other(MaybeProtocol::Nnsp);
self.exclude_other(MaybeProtocol::Imap);
self.exclude_other(MaybeProtocol::Nats);
self.exclude_other(MaybeProtocol::BitTorrent);
Expand Down

0 comments on commit a0c4c11

Please sign in to comment.