Class: Net::SSH::Locate::Scanner
- Inherits:
-
Object
- Object
- Net::SSH::Locate::Scanner
- Defined in:
- lib/net/ssh/locate.rb
Instance Attribute Summary collapse
-
#agentPID ⇒ Object
readonly
Returns the value of attribute agentPID.
-
#agentSocket ⇒ Object
readonly
Returns the value of attribute agentSocket.
-
#found ⇒ Object
readonly
Returns the value of attribute found.
Instance Method Summary collapse
Instance Attribute Details
#agentPID ⇒ Object (readonly)
Returns the value of attribute agentPID.
47 48 49 |
# File 'lib/net/ssh/locate.rb', line 47 def agentPID @agentPID end |
#agentSocket ⇒ Object (readonly)
Returns the value of attribute agentSocket.
47 48 49 |
# File 'lib/net/ssh/locate.rb', line 47 def agentSocket @agentSocket end |
#found ⇒ Object (readonly)
Returns the value of attribute found.
47 48 49 |
# File 'lib/net/ssh/locate.rb', line 47 def found @found end |
Instance Method Details
#found? ⇒ Boolean
64 65 66 |
# File 'lib/net/ssh/locate.rb', line 64 def found? @found end |
#scan ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/net/ssh/locate.rb', line 49 def scan @found = false procs = Sys::ProcTable.ps.select do |p| (p.cmdline =~ /ssh-agent/) && !(p.cmdline =~ /--session=ubuntu/) && !(p.state=='Z') end return if procs.empty? p=procs.first p.cmdline =~ /ssh-agent\s-a ([-.a-zA-Z0-9_\/]+)/ return if !$~ @found = true @agentSocket = $1 @agentPID = p.pid end |