-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraSSHopper-scp.rb
43 lines (39 loc) · 1.22 KB
/
graSSHopper-scp.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
40
41
42
43
$brain = "empty"
def think()
$brain = File.readlines('/usr/share/grasshopper/servers.cfg').map do |line|
k, *v = line.split(',').map(&:strip)
[k, v]
end.to_h
end
puts `clear`
puts <<-'EOF'
┌─┐┬─┐┌─┐╔═╗╔═╗╦ ╦┌─┐┌─┐┌─┐┌─┐┬─┐
│ ┬├┬┘├─┤╚═╗╚═╗╠═╣│ │├─┘├─┘├┤ ├┬┘
└─┘┴└─┴ ┴╚═╝╚═╝╩ ╩└─┘┴ ┴ └─┘┴└─
|----------------------------------|
** SCP TOOL **
|----------------------------------|
EOF
think()
puts `clear`
puts "Source file or folder:"
print "--------:"
source = gets.chomp
puts "Destination file or folder:"
print "--------:"
dest = gets.chomp
print "Is the remote server the source? "
remotesrc = gets.chomp
puts "Add your options here (-r, etc...):"
print "--------:"
options = gets.chomp
$brain.each do |server, settings|
puts "Nuking #{server}"
user = settings[0]
port = settings[1]
if remotesrc == "y"
system("scp -P #{port} #{options} #{user}@#{server}:#{source} #{dest}")
else
system("scp -P #{port} #{options} #{source} #{user}@#{server}:#{dest}")
end
end