Guest User

Untitled

a guest
Oct 9th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. # -*- encoding: utf-8 -*-
  2.  
  3. require 'net/telnet'
  4.  
  5. def get_file_list(address, username, password, dir_path)
  6. telnet = Net::Telnet.new("Host" => host_address) {|c| print c}
  7. telnet.login(username, password) {|c| print c}
  8. telnet.cmd('cd ' + dir_path) {|c| print c}
  9. telnet.cmd('ls -elR') {|c| print c }
  10. end
  11.  
  12.  
  13. # Main
  14. address = '1.x.xxx.xxx'
  15. dir_path = '/hoge/piyo/FUGA/'
  16. username = 'USERNAME'
  17. password = 'PASSWORD'
  18.  
  19. get_file_list(address, username, password, dir_path)
Add Comment
Please, Sign In to add comment