--enable-developer

Arran Cudbard-Bell a.cudbardb at freeradius.org
Tue Nov 6 13:37:03 CET 2012


On 6 Nov 2012, at 11:46, Brian Candler <B.Candler at pobox.com> wrote:

> On Mon, Nov 05, 2012 at 03:06:26PM +0000, Arran Cudbard-Bell wrote:
>>> In Ruby:
>>> 
>>> echo "foo\200bar" |
>>> ruby -e 'puts eval("\""+$stdin.read+"\"").unpack("H*").first'
>>> 
>>> Or without eval:
>>> 
>>> echo "foo\200bar" |
>>> ruby -e 'puts $stdin.read.gsub(/\\(\d\d\d)/) { $1.to_i(8).chr }.unpack("H*").first'
>> 
>> I guess that works if you have arbitrary amounts of memory :)
> 
> How big are your DHCP attributes then? :)

Arbitrarily big :)

> 
> OK:
> 
> echo "foo\200bar" |
> ruby -e 'while d=$stdin.read(32); puts d.gsub(/\\(\d\d\d)/) { $1.to_i(8).chr }.unpack("H*").first; end'
> 
> Still a one-liner, as long as your console is at least 104 characters wide...


Fine, fine, you win :p

-Arran


More information about the Freeradius-Devel mailing list