RPC service.report and Factory[:report] seem to return different types

Mike's Avatar

Mike

10 Mar, 2015 07:37 PM

I have written an Arachni client in Ruby and use the following snippet to retrieve a report from a remote Arachni server using the RPC Pure

def foo 
    report = @instance.call('service.report')
    moo(report)
end

def moo(report)
    report['issues'].each do |issue|
        # Do things
    end
end

I've also recently started writing some spec tests for my client as occasionally things in Arachni change that blow up my client (most recently severity "High" becoming "high" :P). When I wrote my spec test to get a report using Factory[:report], the above snippet does not work but this does...

# In my spec file
let( :arachni_client ) { Factory[:arachni_client] } # This is my class
let( :report ) { Factory[:report] }
...
it 'passes' do
    expect(arachni_client.moo(report)).to be_truthy
end
# In my client
def moo(report)
    report.issues.each do |issue|
        # Do things
    end
end

I hope this made sense but basically, when I create a report using Factory[:report] I need to use 'report.issues' in my client and when I retrieve a report through the RPC client I need to use 'report["issues"]'... Any idea?

Using stable build 1.0.6 on Debian 7 system.

Thanks,

  1. Support Staff 1 Posted by Tasos Laskos on 10 Mar, 2015 07:46 PM

    Tasos Laskos's Avatar

    One of the changes for the v1.0 overhaul was that complex custom types can no longer be transported over RPC, so you now get a Hash instead of a native Report.
    This makes things cleaner for people looking to integrate with it, which is what the RPC API is for.

    However, if you have access to the Framework, you can use its own RPC client which can handle some custom types and retrieve the native Report via service.native_report.

    Cheers

  2. 2 Posted by Mike on 11 Mar, 2015 01:09 PM

    Mike's Avatar

    Thanks -- Makes sense

  3. Mike closed this discussion on 11 Mar, 2015 01:09 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac