Metasploit mailing list archives

Re: Code No-Nos


From: "Joshua J. Drake" <jdrake () metasploit com>
Date: Tue, 6 Jul 2010 13:21:50 -0500

On Tue, Jul 06, 2010 at 08:11:33AM -0500, HD Moore wrote:
On 7/6/2010 7:08 AM, alfonso caponi wrote:
Theoretically should I avoid using functions like printf, sprintf, etc.?
Exist an alternative function for formatting the output in metasploit?

You can still use sprintf as a formatter, just not for display:

print_status(sprintf("Hello 0x%.8x", 0x12345678))

For the record, the python style '%' works too, eg:

print_status("Hello 0x%.8x - %d" % [0xdeadbeef, 31337])

-- 
Joshua J. Drake

Attachment: _bin
Description:

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

Current thread: