mirror of
https://github.com/ivre/masscanned.git
synced 2025-10-02 06:38:21 +00:00
commit
8620c5ff20
1 changed files with 21 additions and 21 deletions
|
@ -57,27 +57,6 @@ impl ProtocolState {
|
|||
}
|
||||
}
|
||||
|
||||
/* Reconstruct client's banner from the parsed information */
|
||||
fn ssh_banner(pstate: &ProtocolState) -> Vec<u8> {
|
||||
let mut banner = b"SSH-".to_vec();
|
||||
for b in &pstate.ssh_version {
|
||||
banner.push(*b);
|
||||
}
|
||||
banner.push(b'-');
|
||||
for b in &pstate.ssh_software {
|
||||
banner.push(*b);
|
||||
}
|
||||
if pstate.ssh_comment.len() > 0 {
|
||||
banner.push(b' ');
|
||||
for b in &pstate.ssh_comment {
|
||||
banner.push(*b);
|
||||
}
|
||||
}
|
||||
banner.push(b'\r');
|
||||
banner.push(b'\n');
|
||||
banner
|
||||
}
|
||||
|
||||
fn ssh_parse(pstate: &mut ProtocolState, data: &[u8]) {
|
||||
/* RFC 4253:
|
||||
*
|
||||
|
@ -205,6 +184,27 @@ pub fn repl<'a>(
|
|||
mod tests {
|
||||
use super::*;
|
||||
|
||||
/* Reconstruct client's banner from the parsed information */
|
||||
fn ssh_banner(pstate: &ProtocolState) -> Vec<u8> {
|
||||
let mut banner = b"SSH-".to_vec();
|
||||
for b in &pstate.ssh_version {
|
||||
banner.push(*b);
|
||||
}
|
||||
banner.push(b'-');
|
||||
for b in &pstate.ssh_software {
|
||||
banner.push(*b);
|
||||
}
|
||||
if pstate.ssh_comment.len() > 0 {
|
||||
banner.push(b' ');
|
||||
for b in &pstate.ssh_comment {
|
||||
banner.push(*b);
|
||||
}
|
||||
}
|
||||
banner.push(b'\r');
|
||||
banner.push(b'\n');
|
||||
banner
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ssh_2_banner_parse() {
|
||||
/* all at once */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue