Guest User

Untitled

a guest
Mar 4th, 2019
397
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. require 'winrm'
  2.  
  3.  
  4.  
  5. conn = WinRM::Connection.new(
  6. endpoint: 'https://10.10.10.103:5986/wsman',
  7. transport: :ssl,
  8. user: './certnew.cer',
  9. password: 'Ashare1972',
  10. client_cert: './certnew.cer',
  11. client_key: './amanda_priv.key',
  12. key_pass: 'Ashare1972',
  13. :no_ssl_peer_verification => true
  14. )
  15. command=""
  16.  
  17. conn.shell(:powershell) do |shell|
  18. until command == "exit\n" do
  19. output = shell.run("-join($id,'PS ',$(whoami),'@',$env:computername,' ',$((gi $pwd).Name),'> ')")
  20. print(output.output.chomp)
  21. command = gets
  22. output = shell.run(command) do |stdout, stderr|
  23. STDOUT.print stdout
  24. STDERR.print stderr
  25. end
  26. end
  27. puts "Exiting with code #{output.exitcode}"
  28. end
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×