forked from Arachni/arachni
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharachni.rb
97 lines (78 loc) · 2.49 KB
/
arachni.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
=begin
Copyright 2010-2017 Sarosys LLC <http://www.sarosys.com>
This file is part of the Arachni Framework project and is subject to
redistribution and commercial restrictions. Please see the Arachni Framework
web site for more information on licensing and terms of use.
=end
require 'rubygems'
require 'bundler/setup'
require 'concurrent'
require 'pp'
require 'ap'
def ap( obj )
super obj, raw: true
end
module Arachni
class <<self
# Runs a minor GC to collect young, short-lived objects.
#
# Generally called after analysis operations that generate a lot of
# new temporary objects.
def collect_young_objects
GC.start( full_mark: false )
end
def null_device
Gem.win_platform? ? 'NUL' : '/dev/null'
end
# @return [Bool]
def jruby?
RUBY_PLATFORM == 'java'
end
# @return [Bool]
def windows?
Gem.win_platform?
end
# @return [Bool]
# `true` if the `ARACHNI_PROFILE` env variable is set, `false` otherwise.
def profile?
!!ENV['ARACHNI_PROFILER']
end
if Arachni.windows?
require 'find'
require 'fileutils'
require 'Win32API'
require 'win32ole'
def get_long_win32_filename( short_name )
short_name = short_name.dup
max_path = 1024
long_name = ' ' * max_path
lfn_size = Win32API.new(
"kernel32",
"GetLongPathName",
['P','P','L'],
'L'
).call( short_name, long_name, max_path )
(1..max_path).include?( lfn_size ) ?
long_name[0..lfn_size-1] : short_name
end
else
def get_long_win32_filename( short_name )
short_name
end
end
end
end
if !Arachni.jruby?
require 'oj_mimic_json'
end
require_relative 'arachni/version'
require_relative 'arachni/banner'
# If there's no UI driving us then there's no output interface.
# Chances are that someone is using Arachni as a Ruby lib so there's no
# need for a functional output interface, so provide non-functional one.
#
# However, functional or not, the system does depend on one being available.
if !Arachni.constants.include?( :UI )
require_relative 'arachni/ui/foo/output'
end
require_relative 'arachni/framework'