Class: Snackhack2::SSHForwardRemote

Inherits:
Object
  • Object
show all
Defined in:
lib/snackhack2/forward_remote.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSSHForwardRemote

Returns a new instance of SSHForwardRemote.



8
9
10
11
12
13
14
15
16
# File 'lib/snackhack2/forward_remote.rb', line 8

def initialize
  @site = site
  @user = user
  @pass = pass
  @key  = key
  @lport = lport
  @lsite = lsite
  @rport = rport
end

Instance Attribute Details

#keyObject

Returns the value of attribute key.



6
7
8
# File 'lib/snackhack2/forward_remote.rb', line 6

def key
  @key
end

#lportObject

Returns the value of attribute lport.



6
7
8
# File 'lib/snackhack2/forward_remote.rb', line 6

def lport
  @lport
end

#lsiteObject

Returns the value of attribute lsite.



6
7
8
# File 'lib/snackhack2/forward_remote.rb', line 6

def lsite
  @lsite
end

#passObject

Returns the value of attribute pass.



6
7
8
# File 'lib/snackhack2/forward_remote.rb', line 6

def pass
  @pass
end

#rportObject

Returns the value of attribute rport.



6
7
8
# File 'lib/snackhack2/forward_remote.rb', line 6

def rport
  @rport
end

#siteObject

Returns the value of attribute site.



6
7
8
# File 'lib/snackhack2/forward_remote.rb', line 6

def site
  @site
end

#userObject

Returns the value of attribute user.



6
7
8
# File 'lib/snackhack2/forward_remote.rb', line 6

def user
  @user
end

Instance Method Details

#runObject



18
19
20
21
22
23
24
# File 'lib/snackhack2/forward_remote.rb', line 18

def run
  Net::SSH.start(@site, @user, password: @pass, keys: @key) do |ssh|
    ssh.forward.remote(@lport, @lsite, @rport)
    puts '[+] Starting SSH remote forward tunnel'
    ssh.loop { true }
  end
end