Skip to content
This repository was archived by the owner on Jan 24, 2022. It is now read-only.
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
16 changes: 16 additions & 0 deletions lib/ssh_scan/banner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,30 @@ def ssh_lib_guess()
return SSHScan::SSHLib::OpenSSH.new(@string)
when /LibSSH/i
return SSHScan::SSHLib::LibSSH.new()
when /ipssh/i
return SSHScan::SSHLib::IpSsh.new(@string)
when /Cisco/i
return SSHScan::SSHLib::CiscoSSH.new()
when /ROS/
return SSHScan::SSHLib::ROSSSH.new()
when /DOPRASSH/i
return SSHScan::SSHLib::DOPRASSH.new()
when /cryptlib/i
return SSHScan::SSHLib::Cryptlib.new()
when /NOS-SSH/i
return SSHScan::SSHLib::NosSSH.new(@string)
when /pgp/i
return SSHScan::SSHLib::PGP.new()
when /ServerTech_SSH|Mocana SSH/i
return SSHScan::SSHLib::SentrySSH.new()
when /mpssh/i
return SSHScan::SSHLib::Mpssh.new(@string)
when /dropbear/i
return SSHScan::SSHLib::Dropbear.new(@string)
when /RomSShell/i
return SSHScan::SSHLib::RomSShell.new(@string)
when /Flowssh/i
return SSHScan::SSHLib::FlowSsh.new(@string)
else
return SSHScan::SSHLib::Unknown.new()
end
Expand Down
8 changes: 8 additions & 0 deletions lib/ssh_scan/ssh_lib.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,12 @@
require 'ssh_scan/ssh_lib/rosssh'
require 'ssh_scan/ssh_lib/doprassh'
require 'ssh_scan/ssh_lib/dropbear'
require 'ssh_scan/ssh_lib/romsshell'
require 'ssh_scan/ssh_lib/flowssh'
require 'ssh_scan/ssh_lib/cryptlib'
require 'ssh_scan/ssh_lib/mpssh'
require 'ssh_scan/ssh_lib/sentryssh'
require 'ssh_scan/ssh_lib/ipssh'
require 'ssh_scan/ssh_lib/pgp'
require 'ssh_scan/ssh_lib/nosssh'
require 'ssh_scan/ssh_lib/unknown'
17 changes: 17 additions & 0 deletions lib/ssh_scan/ssh_lib/cryptlib.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module SSHScan
module SSHLib
class Cryptlib
def common
"cryptlib"
end

def cpe
"a:cryptlib:cryptlib"
end

def version
nil
end
end
end
end
34 changes: 34 additions & 0 deletions lib/ssh_scan/ssh_lib/flowssh.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
module SSHScan
module SSHLib
class FlowSsh
class Version
def initialize(version_string)
@version_string = version_string
end

def to_s
@version_string
end
end

def initialize(banner = nil)
@banner = banner
end

def version()
return nil if @banner.nil?
match = @banner.match(/(\d+[\.\d+]+(p)?(\d+)?) FlowSsh/)
return nil if match.nil?
return FlowSsh::Version.new(match[1])
end

def common
"flowssh"
end

def cpe
"a:bitvise:flowssh"
end
end
end
end
34 changes: 34 additions & 0 deletions lib/ssh_scan/ssh_lib/ipssh.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
module SSHScan
module SSHLib
class IpSsh
class Version
def initialize(version_string)
@version_string = version_string
end

def to_s
@version_string
end
end

def initialize(banner = nil)
@banner = banner
end

def version()
return nil if @banner.nil?
match = @banner.match(/IPSSH-(\d+[\.\d+]+(p)?(\d+)?)/)
return nil if match.nil?
return IpSsh::Version.new(match[1])
end

def common
"ipssh"
end

def cpe
"a:ipssh:ipssh"
end
end
end
end
34 changes: 34 additions & 0 deletions lib/ssh_scan/ssh_lib/mpssh.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
module SSHScan
module SSHLib
class Mpssh
class Version
def initialize(version_string)
@version_string = version_string
end

def to_s
@version_string
end
end

def initialize(banner = nil)
@banner = banner
end

def version()
return nil if @banner.nil?
match = @banner.match(/mpSSH_(\d+[\.\d+]+(p)?(\d+)?)/i)
return nil if match.nil?
return Mpssh::Version.new(match[1])
end

def common
"mpssh"
end

def cpe
"a:mpssh:mpssh"
end
end
end
end
34 changes: 34 additions & 0 deletions lib/ssh_scan/ssh_lib/nosssh.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
module SSHScan
module SSHLib
class NosSSH
class Version
def initialize(version_string)
@version_string = version_string
end

def to_s
@version_string
end
end

def initialize(banner = nil)
@banner = banner
end

def version()
return nil if @banner.nil?
match = @banner.match(/NOS-SSH_(\d+[\.\d+]+)/)
return nil if match.nil?
return NosSSH::Version.new(match[1])
end

def common
"nosssh"
end

def cpe
"a:nosssh:nosssh"
end
end
end
end
17 changes: 17 additions & 0 deletions lib/ssh_scan/ssh_lib/pgp.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module SSHScan
module SSHLib
class PGP
def common
"pgp"
end

def cpe
"a:pgp:pgp"
end

def version
nil
end
end
end
end
34 changes: 34 additions & 0 deletions lib/ssh_scan/ssh_lib/romsshell.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
module SSHScan
module SSHLib
class RomSShell
class Version
def initialize(version_string)
@version_string = version_string
end

def to_s
@version_string
end
end

def initialize(banner = nil)
@banner = banner
end

def version()
return nil if @banner.nil?
match = @banner.match(/RomSShell_(\d+[\.\d+]+(p)?(\d+)?)/)
return nil if match.nil?
return RomSShell::Version.new(match[1])
end

def common
"romsshell"
end

def cpe
"a:allegrosoft:romsshell"
end
end
end
end
17 changes: 17 additions & 0 deletions lib/ssh_scan/ssh_lib/sentryssh.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module SSHScan
module SSHLib
class SentrySSH
def common
"sentryssh"
end

def cpe
"a:servertech:sentryssh"
end

def version
nil
end
end
end
end
16 changes: 16 additions & 0 deletions spec/ssh_scan/banner/os/freebsd_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
require 'rspec'
require_relative '../helper'

describe SSHScan::Banner do
context "when freebsd fingerprinting" do
expectations = {
"SSH-2.0-OpenSSH_5.4p1 FreeBSD-20100308" => {
:os_class => SSHScan::OS::FreeBSD,
:os_version => "",
:ssh_lib_class => SSHScan::SSHLib::OpenSSH,
:ssh_lib_version => "5.4p1",
},
}
checkFingerprints(expectations)
end
end
14 changes: 14 additions & 0 deletions spec/ssh_scan/banner/ssh_lib/cryptlib_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'rspec'
require_relative '../helper'

describe SSHScan::Banner do
context "when cryptlib fingerprinting" do
expectations = {
"SSH-2.0-cryptlib" => {
:ssh_lib_class => SSHScan::SSHLib::Cryptlib,
:ssh_lib_version => "",
},
}
checkFingerprints(expectations)
end
end
14 changes: 14 additions & 0 deletions spec/ssh_scan/banner/ssh_lib/flowssh_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'rspec'
require_relative '../helper'

describe SSHScan::Banner do
context "when flowssh fingerprinting" do
expectations = {
"SSH-2.0-5.32 FlowSsh" => {
:ssh_lib_class => SSHScan::SSHLib::FlowSsh,
:ssh_lib_version => "5.32",
},
}
checkFingerprints(expectations)
end
end
14 changes: 14 additions & 0 deletions spec/ssh_scan/banner/ssh_lib/ipssh_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'rspec'
require_relative '../helper'

describe SSHScan::Banner do
context "when ipssh fingerprinting" do
expectations = {
"SSH-2.0-IPSSH-6.6.0" => {
:ssh_lib_class => SSHScan::SSHLib::IpSsh,
:ssh_lib_version => "6.6.0",
},
}
checkFingerprints(expectations)
end
end
14 changes: 14 additions & 0 deletions spec/ssh_scan/banner/ssh_lib/mpssh_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'rspec'
require_relative '../helper'

describe SSHScan::Banner do
context "when mpssh fingerprinting" do
expectations = {
"SSH-2.0-mpSSH_0.2.1" => {
:ssh_lib_class => SSHScan::SSHLib::Mpssh,
:ssh_lib_version => "0.2.1",
},
}
checkFingerprints(expectations)
end
end
14 changes: 14 additions & 0 deletions spec/ssh_scan/banner/ssh_lib/nosssh_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'rspec'
require_relative '../helper'

describe SSHScan::Banner do
context "when nosssh fingerprinting" do
expectations = {
"SSH-2.0-NOS-SSH_2.0" => {
:ssh_lib_class => SSHScan::SSHLib::NosSSH,
:ssh_lib_version => "2.0",
},
}
checkFingerprints(expectations)
end
end
Loading