[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

How to provide variable to irb session

Bryan Richardson

9/19/2008 4:14:00 PM

Hello all,

Can anyone tell me how I would go about providing a variable to an irb
session? For example, see the following screenshot from the Metasploit
Meterpreter in irb mode.

http://www.metasploit.com/images/gallery/msf3-mete...

Does anyone know how they are actually providing the 'client' variable
to the irb session?

--
Thanks!
Bryan
--
Posted via http://www.ruby-....

4 Answers

TPReal

9/19/2008 5:21:00 PM

0

Bryan Richardson wrote:
> Hello all,
>
> Can anyone tell me how I would go about providing a variable to an irb
> session? For example, see the following screenshot from the Metasploit
> Meterpreter in irb mode.
>
> http://www.metasploit.com/images/gallery/msf3-mete...
>
> Does anyone know how they are actually providing the 'client' variable
> to the irb session?
>
> --
> Thanks!
> Bryan

You can run your script at Ruby startup by specifying env variables
(http://al2o3-cr.blogspot.com/2008/09/class-..., scroll to Add to
load path), or you can specify env variable IRBRC pointing to a Ruby
file that will be executed at the start of irb only.

TPR.
--
Posted via http://www.ruby-....

Tod Beardsley

9/19/2008 6:15:00 PM

0

A cheaty way:

http://snippets.dzone.com/posts...


On Fri, Sep 19, 2008 at 12:21 PM, Thomas B. <tpreal@gmail.com> wrote:
> Bryan Richardson wrote:
>> Hello all,
>>
>> Can anyone tell me how I would go about providing a variable to an irb
>> session? For example, see the following screenshot from the Metasploit
>> Meterpreter in irb mode.
>>
>> http://www.metasploit.com/images/gallery/msf3-mete...
>>
>> Does anyone know how they are actually providing the 'client' variable
>> to the irb session?
>>
>> --
>> Thanks!
>> Bryan
>
> You can run your script at Ruby startup by specifying env variables
> (http://al2o3-cr.blogspot.com/2008/09/class-..., scroll to Add to
> load path), or you can specify env variable IRBRC pointing to a Ruby
> file that will be executed at the start of irb only.
>
> TPR.
> --
> Posted via http://www.ruby-....
>
>



--
todb@planb-security.net | ICQ: 335082155 | Note: Due to Google's
privacy policy <http://tinyurl.com... and the United States'
policy on electronic surveillance <http://tinyurl.com...,
please do not IM/e-mail me anything you wish to remain secret.

Bryan Richardson

9/19/2008 7:35:00 PM

0

Sweet... thanks!

On Fri, Sep 19, 2008 at 12:15 PM, Tod Beardsley <todb@planb-security.net> wrote:
> A cheaty way:
>
> http://snippets.dzone.com/posts...
>
>
> On Fri, Sep 19, 2008 at 12:21 PM, Thomas B. <tpreal@gmail.com> wrote:
>> Bryan Richardson wrote:
>>> Hello all,
>>>
>>> Can anyone tell me how I would go about providing a variable to an irb
>>> session? For example, see the following screenshot from the Metasploit
>>> Meterpreter in irb mode.
>>>
>>> http://www.metasploit.com/images/gallery/msf3-mete...
>>>
>>> Does anyone know how they are actually providing the 'client' variable
>>> to the irb session?
>>>
>>> --
>>> Thanks!
>>> Bryan
>>
>> You can run your script at Ruby startup by specifying env variables
>> (http://al2o3-cr.blogspot.com/2008/09/class-..., scroll to Add to
>> load path), or you can specify env variable IRBRC pointing to a Ruby
>> file that will be executed at the start of irb only.
>>
>> TPR.
>> --
>> Posted via http://www.ruby-....
>>
>>
>
>
>
> --
> todb@planb-security.net | ICQ: 335082155 | Note: Due to Google's
> privacy policy <http://tinyurl.com... and the United States'
> policy on electronic surveillance <http://tinyurl.com...,
> please do not IM/e-mail me anything you wish to remain secret.
>
>

Brian Candler

9/19/2008 7:48:00 PM

0

Bryan Richardson wrote:
> Hello all,
>
> Can anyone tell me how I would go about providing a variable to an irb
> session? For example, see the following screenshot from the Metasploit
> Meterpreter in irb mode.
>
> http://www.metasploit.com/images/gallery/msf3-mete...
>
> Does anyone know how they are actually providing the 'client' variable
> to the irb session?

Is it definitely a variable, not a method?

This post shows how to start an IRb session within the context of an
arbitary object:
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-t...

So you can create your own object class with a "client" method, create
an instance of this object, and start IRb such that "self" is this
object.
--
Posted via http://www.ruby-....