relevance-tarantula 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/VERSION.yml +2 -2
- data/examples/example_helper.rb +1 -1
- data/examples/relevance/tarantula/rails_integration_proxy_example.rb +1 -1
- data/lib/relevance/tarantula/attack_form_submission.rb +3 -2
- data/lib/relevance/tarantula/detail.html.erb +11 -11
- data/lib/relevance/tarantula/form_submission.rb +7 -6
- data/lib/relevance/tarantula/result.rb +14 -3
- metadata +5 -4
data/Rakefile
CHANGED
data/VERSION.yml
CHANGED
data/examples/example_helper.rb
CHANGED
@@ -41,7 +41,7 @@ describe "Relevance::Tarantula::RailsIntegrationProxy" do
|
|
41
41
|
it "adds a response accessor to its delegate rails integration test" do
|
42
42
|
o = Object.new
|
43
43
|
Relevance::Tarantula::RailsIntegrationProxy.new(o)
|
44
|
-
o.methods(false).sort.should == %w{response response=}
|
44
|
+
o.methods(false).map(&:to_s).sort.should == %w{response response=}
|
45
45
|
end
|
46
46
|
|
47
47
|
end
|
@@ -25,18 +25,18 @@
|
|
25
25
|
</ul>
|
26
26
|
|
27
27
|
<div id="report">
|
28
|
-
<h3>Detail of <%= short_description %> <em>Generated on <%= Time.now %></em></h3>
|
29
|
-
<p><b>Resource</b> <a href="<%= full_url %>"><%= full_url %></a></p>
|
30
|
-
<p><b>Response</b> <span class="r<%= code.first %>"><%= code %></span></p>
|
31
|
-
<p><b>Referrer</b> <%= referrer || "" %></p>
|
28
|
+
<h3>Detail of <%= result.short_description %> <em>Generated on <%= Time.now %></em></h3>
|
29
|
+
<p><b>Resource</b> <a href="<%= result.full_url %>"><%= result.full_url %></a></p>
|
30
|
+
<p><b>Response</b> <span class="r<%= result.code.first %>"><%= result.code %></span></p>
|
31
|
+
<p><b>Referrer</b> <%= result.referrer || "" %></p>
|
32
32
|
|
33
33
|
<table class="output">
|
34
34
|
<tbody>
|
35
35
|
<tr>
|
36
36
|
<th colspan="2"># Data</th>
|
37
37
|
</tr>
|
38
|
-
<% if data %>
|
39
|
-
<%= wrap_in_line_number_table_row(data) %>
|
38
|
+
<% if result.data %>
|
39
|
+
<%= result.wrap_in_line_number_table_row(result.data) %>
|
40
40
|
<% else %>
|
41
41
|
<tr>
|
42
42
|
<td colspan="2">No Data</td>
|
@@ -50,8 +50,8 @@
|
|
50
50
|
<tr>
|
51
51
|
<th colspan="2"># Body</th>
|
52
52
|
</tr>
|
53
|
-
<% if body %>
|
54
|
-
<%= wrap_in_line_number_table_row(body) %>
|
53
|
+
<% if result.body %>
|
54
|
+
<%= result.wrap_in_line_number_table_row(result.body) %>
|
55
55
|
<% else %>
|
56
56
|
<tr>
|
57
57
|
<td colspan="2">No Body</td>
|
@@ -65,8 +65,8 @@
|
|
65
65
|
<tr>
|
66
66
|
<th colspan="2"># Log</th>
|
67
67
|
</tr>
|
68
|
-
<% if log %>
|
69
|
-
<%= wrap_in_line_number_table_row(log) {|line| wrap_stack_trace_line(line)} %>
|
68
|
+
<% if result.log %>
|
69
|
+
<%= result.wrap_in_line_number_table_row(result.log) {|line| wrap_stack_trace_line(line)} %>
|
70
70
|
<% else %>
|
71
71
|
<tr>
|
72
72
|
<td colspan="2">No Log</td>
|
@@ -78,4 +78,4 @@
|
|
78
78
|
</div>
|
79
79
|
</div>
|
80
80
|
</body>
|
81
|
-
</html>
|
81
|
+
</html>
|
@@ -47,12 +47,13 @@ class Relevance::Tarantula::FormSubmission
|
|
47
47
|
|
48
48
|
def random_data(input)
|
49
49
|
case input['name']
|
50
|
-
when /amount/
|
51
|
-
when /_id$/
|
52
|
-
when /uploaded_data/
|
53
|
-
when /^_method$/
|
54
|
-
when nil
|
55
|
-
else
|
50
|
+
when /amount/ then random_int
|
51
|
+
when /_id$/ then random_whole_number
|
52
|
+
when /uploaded_data/ then nil
|
53
|
+
when /^_method$/ then input['value']
|
54
|
+
when nil then input['value']
|
55
|
+
else
|
56
|
+
random_int
|
56
57
|
end
|
57
58
|
end
|
58
59
|
|
@@ -11,33 +11,43 @@ class Relevance::Tarantula::Result
|
|
11
11
|
self.instance_variable_set("@#{k}", v)
|
12
12
|
end
|
13
13
|
end
|
14
|
+
|
14
15
|
def short_description
|
15
16
|
[method,url].join(" ")
|
16
17
|
end
|
18
|
+
|
17
19
|
def sequence_number
|
18
20
|
@sequence_number ||= (self.class.next_number += 1)
|
19
21
|
end
|
22
|
+
|
20
23
|
def file_name
|
21
24
|
"#{sequence_number}.html"
|
22
25
|
end
|
26
|
+
|
23
27
|
def code
|
24
28
|
response && response.code
|
25
29
|
end
|
30
|
+
|
26
31
|
def body
|
27
32
|
response && response.body
|
28
33
|
end
|
34
|
+
|
29
35
|
def full_url
|
30
36
|
"#{DEFAULT_LOCALHOST}#{url}"
|
31
37
|
end
|
38
|
+
|
32
39
|
ALLOW_NNN_FOR = /^allow_(\d\d\d)_for$/
|
40
|
+
|
33
41
|
class << self
|
34
42
|
attr_accessor :next_number
|
43
|
+
|
35
44
|
def handle(result)
|
36
45
|
retval = result.dup
|
37
46
|
retval.success = successful?(result.response) || can_skip_error?(result)
|
38
47
|
retval.description = "Bad HTTP Response" unless retval.success
|
39
48
|
retval
|
40
49
|
end
|
50
|
+
|
41
51
|
def success_codes
|
42
52
|
%w{200 201 302 401}
|
43
53
|
end
|
@@ -51,16 +61,17 @@ class Relevance::Tarantula::Result
|
|
51
61
|
return false unless coll
|
52
62
|
coll.any? {|item| item === result.url}
|
53
63
|
end
|
64
|
+
|
54
65
|
def successful?(response)
|
55
66
|
success_codes.member?(response.code)
|
56
67
|
end
|
68
|
+
|
57
69
|
def method_missing(meth, *args)
|
58
70
|
super unless ALLOW_NNN_FOR =~ meth.to_s
|
59
71
|
(allow_errors_for[$1] ||= []).push(*args)
|
60
72
|
end
|
61
73
|
end
|
74
|
+
|
62
75
|
self.allow_errors_for = {}
|
63
76
|
self.next_number = 0
|
64
|
-
|
65
|
-
|
66
|
-
end
|
77
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relevance-tarantula
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Relevance, Inc.
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-08-21 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -109,6 +109,7 @@ files:
|
|
109
109
|
- template/tarantula_test.rb
|
110
110
|
has_rdoc: true
|
111
111
|
homepage: http://github.com/relevance/tarantula
|
112
|
+
licenses:
|
112
113
|
post_install_message:
|
113
114
|
rdoc_options:
|
114
115
|
- --charset=UTF-8
|
@@ -129,9 +130,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
130
|
requirements: []
|
130
131
|
|
131
132
|
rubyforge_project: thinkrelevance
|
132
|
-
rubygems_version: 1.
|
133
|
+
rubygems_version: 1.3.5
|
133
134
|
signing_key:
|
134
|
-
specification_version:
|
135
|
+
specification_version: 2
|
135
136
|
summary: A big hairy fuzzy spider that crawls your site, wreaking havoc
|
136
137
|
test_files:
|
137
138
|
- examples/example_helper.rb
|