-
Notifications
You must be signed in to change notification settings - Fork 1
/
scp_instance.rb
executable file
·39 lines (28 loc) · 1.06 KB
/
scp_instance.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
class ScpInstance < SshInstance
attr_accessor :local_path, :remote_path
def get_cmd
return get_scp_cmd if bypass_gateway
return get_cmd_with_gateway
end
def put_cmd
return put_scp_cmd if bypass_gateway
return put_cmd_with_gateway
end
def get_scp_cmd
"scp -o StrictHostKeyChecking=no -i #{self.key_path} -r #{self.user_at_url}:#{self.remote_path} #{self.local_path}"
end
def put_scp_cmd
"scp -o StrictHostKeyChecking=no -i #{self.key_path} -r #{self.local_path} #{self.user_at_url}:#{self.remote_path}"
end
def get_cmd_with_gateway
"scp -o StrictHostKeyChecking=no -i #{self.key_path} #{gateway_code} -r #{self.user_at_url}:#{self.remote_path} #{self.local_path}"
end
def put_cmd_with_gateway
"scp -o StrictHostKeyChecking=no -i #{self.key_path} #{gateway_code} -r #{self.user_at_url} #{self.user_at_url}:#{self.remote_path}"
end
def gateway_code
###### NOT WORKING SOMETHING SOMETHING NETCAT/SOCAT ##########
"-Cp -o \"ProxyCommand ssh -i #{self.gateway.key_path} #{self.gateway.user_at_url} nc #{self.url} 22\""
end
private
end