Metasploit mailing list archives

Re: ruby coding question


From: HD Moore <hdm () metasploit com>
Date: Tue, 08 Dec 2009 16:42:24 -0600

On Tue, 2009-12-08 at 17:28 -0500, Jeffs wrote:
I have a snippet of code in a sploit that looks like this:

out = new BufferedOutputStream(new 
FileOutputStream("c:\\\\#{@payload_name}"));

but I wish the file to go to %TMP% instead.

I've tried:

out = new BufferedOutputStream(new 
FileOutputStream("\%TMP\%\\\\{@payload_name}"));

but this throws out errors.

not being a ruby maven I suspect that TMP needs to be declared somewhere 
first and would appreciate some help, if it's out there.

This isn't really the list for it, but the syntax you want is:

path = File.join(ENV['TEMP'], @payloadname)

-HD

_______________________________________________
https://mail.metasploit.com/mailman/listinfo/framework


Current thread: