Sha256: 430ff40f85d066fcffe9824ba70d51b5293a9aba1932880b8ed47f2e1a309836

Contents?: true

Size: 1.06 KB

Versions: 5

Compression:

Stored size: 1.06 KB

Contents

require 'base64'

$options = Marshal.load( Base64.strict_decode64( ARGV.pop ) )

if !$options[:without_arachni]
    require 'arachni'

    include Arachni

    Options.update Marshal.load( Base64.strict_decode64( ENV['arachni_options'] ) )
else
    if Gem.win_platform?
        require 'Win32API'
        require 'win32ole'
    end
end

def ppid
    $options[:ppid]
end

def parent_alive?
    # Windows is not big on POSIX so try it its own way if possible.
    if Gem.win_platform?
        begin
            alive = false
            wmi = WIN32OLE.connect( 'winmgmts://' )
            processes = wmi.ExecQuery( "select ProcessId from win32_process where ProcessID='#{ppid}'")
            processes.each do |proc|
                proc.ole_free
                alive = true
            end
            processes.ole_free
            wmi.ole_free

            return alive
        rescue WIN32OLERuntimeError
        end
    end

    !!(Process.kill( 0, ppid ) rescue false)
end

def puts_stderr( str )
    return if $stderr.closed?

    $stderr.puts str
rescue
end

load ARGV.pop

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
arachni-1.6.1.3 lib/arachni/processes/executables/base.rb
arachni-1.6.1.2 lib/arachni/processes/executables/base.rb
arachni-1.6.1.1 lib/arachni/processes/executables/base.rb
arachni-1.6.1 lib/arachni/processes/executables/base.rb
arachni-1.6.0 lib/arachni/processes/executables/base.rb