panmind-tarantula 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. data/CHANGELOG +49 -0
  2. data/LICENSE +20 -0
  3. data/README.rdoc +171 -0
  4. data/Rakefile +83 -0
  5. data/VERSION.yml +4 -0
  6. data/examples/example_helper.rb +57 -0
  7. data/examples/relevance/core_extensions/ellipsize_example.rb +19 -0
  8. data/examples/relevance/core_extensions/file_example.rb +8 -0
  9. data/examples/relevance/core_extensions/response_example.rb +29 -0
  10. data/examples/relevance/core_extensions/test_case_example.rb +20 -0
  11. data/examples/relevance/tarantula/attack_handler_example.rb +29 -0
  12. data/examples/relevance/tarantula/basic_attack_example.rb +12 -0
  13. data/examples/relevance/tarantula/crawler_example.rb +375 -0
  14. data/examples/relevance/tarantula/form_example.rb +50 -0
  15. data/examples/relevance/tarantula/form_submission_example.rb +171 -0
  16. data/examples/relevance/tarantula/html_document_handler_example.rb +43 -0
  17. data/examples/relevance/tarantula/html_report_helper_example.rb +46 -0
  18. data/examples/relevance/tarantula/html_reporter_example.rb +82 -0
  19. data/examples/relevance/tarantula/invalid_html_handler_example.rb +33 -0
  20. data/examples/relevance/tarantula/io_reporter_example.rb +11 -0
  21. data/examples/relevance/tarantula/link_example.rb +84 -0
  22. data/examples/relevance/tarantula/log_grabber_example.rb +26 -0
  23. data/examples/relevance/tarantula/rails_integration_proxy_example.rb +101 -0
  24. data/examples/relevance/tarantula/result_example.rb +85 -0
  25. data/examples/relevance/tarantula/tidy_handler_example.rb +58 -0
  26. data/examples/relevance/tarantula/transform_example.rb +20 -0
  27. data/examples/relevance/tarantula_example.rb +23 -0
  28. data/laf/images/header_bg.jpg +0 -0
  29. data/laf/images/logo.png +0 -0
  30. data/laf/images/tagline.png +0 -0
  31. data/laf/javascripts/jquery-1.2.3.js +3408 -0
  32. data/laf/javascripts/jquery-ui-tabs.js +890 -0
  33. data/laf/javascripts/jquery.tablesorter.js +861 -0
  34. data/laf/javascripts/tarantula.js +10 -0
  35. data/laf/stylesheets/tarantula.css +346 -0
  36. data/lib/relevance/core_extensions/ellipsize.rb +34 -0
  37. data/lib/relevance/core_extensions/file.rb +9 -0
  38. data/lib/relevance/core_extensions/metaclass.rb +78 -0
  39. data/lib/relevance/core_extensions/response.rb +9 -0
  40. data/lib/relevance/core_extensions/string_chars_fix.rb +11 -0
  41. data/lib/relevance/core_extensions/test_case.rb +19 -0
  42. data/lib/relevance/tarantula.rb +59 -0
  43. data/lib/relevance/tarantula/attack.rb +18 -0
  44. data/lib/relevance/tarantula/attack_handler.rb +37 -0
  45. data/lib/relevance/tarantula/basic_attack.rb +40 -0
  46. data/lib/relevance/tarantula/crawler.rb +254 -0
  47. data/lib/relevance/tarantula/detail.html.erb +81 -0
  48. data/lib/relevance/tarantula/form.rb +23 -0
  49. data/lib/relevance/tarantula/form_submission.rb +88 -0
  50. data/lib/relevance/tarantula/html_document_handler.rb +36 -0
  51. data/lib/relevance/tarantula/html_report_helper.rb +39 -0
  52. data/lib/relevance/tarantula/html_reporter.rb +105 -0
  53. data/lib/relevance/tarantula/index.html.erb +37 -0
  54. data/lib/relevance/tarantula/invalid_html_handler.rb +18 -0
  55. data/lib/relevance/tarantula/io_reporter.rb +34 -0
  56. data/lib/relevance/tarantula/link.rb +76 -0
  57. data/lib/relevance/tarantula/log_grabber.rb +16 -0
  58. data/lib/relevance/tarantula/rails_integration_proxy.rb +87 -0
  59. data/lib/relevance/tarantula/recording.rb +12 -0
  60. data/lib/relevance/tarantula/response.rb +13 -0
  61. data/lib/relevance/tarantula/result.rb +77 -0
  62. data/lib/relevance/tarantula/test_report.html.erb +32 -0
  63. data/lib/relevance/tarantula/tidy_handler.rb +32 -0
  64. data/lib/relevance/tarantula/transform.rb +17 -0
  65. data/tasks/tarantula_tasks.rake +42 -0
  66. data/template/tarantula_test.rb +22 -0
  67. metadata +213 -0
@@ -0,0 +1,10 @@
1
+ $(document).ready(function() {
2
+ $(".tablesorter").tablesorter({
3
+ sortColumn: 'name', // Integer or String of the name of the column to sort by.
4
+ cssAsc: 'sort asc', // class name for ascending sorting action to header
5
+ cssDesc: 'sort desc', // class name for descending sorting action to header
6
+ headerClass: 'header' // class name for headers (th's)
7
+ });
8
+ $('#tabs-container > ul').tabs();
9
+ });
10
+
@@ -0,0 +1,346 @@
1
+ /* RESET */
2
+ html, body, div, span, applet, object, iframe,
3
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
4
+ a, abbr, acronym, address, big, cite, code,
5
+ del, dfn, em, font, img, ins, kbd, q, s, samp,
6
+ small, strike, strong, sub, sup, tt, var,
7
+ b, u, i, center,
8
+ dl, dt, dd, ol, ul, li,
9
+ fieldset, form, label, legend,
10
+ table, caption, tbody, tfoot, thead, tr, th, td {
11
+ margin: 0;
12
+ padding: 0;
13
+ border: 0;
14
+ outline: 0;
15
+ font-size: 100%;
16
+ vertical-align: baseline;
17
+ background: transparent;
18
+ }
19
+ body {
20
+ line-height: 1;
21
+ }
22
+ ol, ul {
23
+ list-style: none;
24
+ }
25
+ blockquote, q {
26
+ quotes: none;
27
+ }
28
+
29
+ /* remember to define focus styles! */
30
+ :focus {
31
+ outline: 0;
32
+ }
33
+
34
+ /* remember to highlight inserts somehow! */
35
+ ins {
36
+ text-decoration: none;
37
+ }
38
+ del {
39
+ text-decoration: line-through;
40
+ }
41
+
42
+ /* tables still need 'cellspacing="0"' in the markup */
43
+ table {
44
+ border-collapse: collapse;
45
+ border-spacing: 0;
46
+ }
47
+
48
+ body {
49
+ line-height: 1em;
50
+ font-family: Tahoma, Arial, Helvetica, sans-serif;
51
+ color: #050505;
52
+ }
53
+
54
+ /* header */
55
+ #header {
56
+ background: #37302e url(../images/header_bg.jpg) no-repeat top left;
57
+ height: 70px;
58
+ border-bottom: 2px solid #d0d0d0;
59
+ }
60
+
61
+ #header h1 {
62
+ width:206px;
63
+ height:56px;
64
+ text-indent: -9999em;
65
+ background: transparent url(../images/logo.png) no-repeat top center;
66
+ position: absolute;
67
+ top: 7px;
68
+ left: 42px;
69
+ }
70
+
71
+ #header h2 {
72
+ width:196px;
73
+ height:34px;
74
+ text-indent: -9999em;
75
+ background: transparent url(../images/tagline.png) no-repeat top center;
76
+ position: absolute;
77
+ top: 15px;
78
+ left: 257px;
79
+ }
80
+
81
+ #header p {
82
+ display: block;
83
+ position: absolute;
84
+ right: 42px;
85
+ width: 315px;
86
+ padding: 8px;
87
+ color: #fff;
88
+ font-size: 13px;
89
+ line-height: 15px;
90
+ }
91
+
92
+ #header a:link, #header a:visited, #header a {
93
+ color: #70b1ca;
94
+ }
95
+
96
+ #header a:hover {
97
+ text-decoration: none;
98
+ }
99
+
100
+ #header hr {
101
+ display: none;
102
+ }
103
+
104
+ .left { text-align: left !important; }
105
+ .right { text-align: right !important; }
106
+ .center { text-align: center !important; }
107
+
108
+ /* page */
109
+
110
+ #page {
111
+ padding: 55px 10px 0 10px;
112
+ width: 1000px;
113
+ margin: auto;
114
+ position: relative;
115
+ }
116
+
117
+ div#page ul.tabs {
118
+ clear: both;
119
+ }
120
+
121
+ div#page ul.tabs li{
122
+ border: 1px solid #ABA6A1;
123
+ display: block;
124
+ float: left;
125
+ margin-right: 3px;
126
+ }
127
+
128
+ div#page ul.tabs li a {
129
+ display: block;
130
+ float: left;
131
+ clear: right;
132
+ min-width: 110px;
133
+ }
134
+
135
+ div#page ul.tabs li a.active, .ui-tabs-selected a {
136
+ background-color: #EC720B !important;
137
+ color: #050505 !important;
138
+ }
139
+
140
+ div#page ul.tabs li a {
141
+ background-color: #463B38;
142
+ height: 36px;
143
+ color: #fff;
144
+
145
+ padding: 12px 12px 0 12px;
146
+ font-size: 18px;
147
+ line-height: 18px;
148
+ text-decoration: none;
149
+ }
150
+
151
+ div#page ul.tabs li a:hover {
152
+ background-color: #EAA464 !important;
153
+ color: #613005;
154
+ }
155
+
156
+ div#page ul.tabs {
157
+ position: absolute;
158
+ top: 3px;
159
+ left: 10px;
160
+ }
161
+
162
+ .list {
163
+ width: 100%;
164
+ }
165
+
166
+ .list th {
167
+ cursor:pointer;
168
+ }
169
+
170
+ .list th, .list th a, .list tfoot td {
171
+ background: #b9b9a9;
172
+ color: #463c38;
173
+ text-decoration: none;
174
+
175
+ }
176
+
177
+ .sort {
178
+ font-size: 75%;
179
+ filter:alpha(opacity=50);
180
+ -moz-opacity:0.5;
181
+ -khtml-opacity: 0.5;
182
+ opacity: 0.5;
183
+ }
184
+
185
+ .list th, .list th a:hover span {
186
+ filter:alpha(opacity=100);
187
+ -moz-opacity:1;
188
+ -khtml-opacity: 1;
189
+ opacity: 1;
190
+ }
191
+
192
+ .list td, .list th {
193
+ text-align: center;
194
+ padding: 4px;
195
+ font-size: 14px;
196
+ }
197
+
198
+ .list .sort.asc .sort:after {
199
+ content: "\25BC";
200
+ }
201
+
202
+ .list .sort.desc .sort:after {
203
+ content: "\25B2";
204
+ }
205
+
206
+
207
+ div#page tbody a {
208
+ color: #6699cc;
209
+ }
210
+
211
+ div#page tbody a:hover {
212
+ text-decoration: none;
213
+ }
214
+
215
+ div#page table caption {
216
+ text-align: left;
217
+ padding: 7px;
218
+ background: #d0d0c4;
219
+ border-bottom: 2px solid #aba7a1;
220
+ -moz-border-radius-topleft: 2px;
221
+ -moz-border-radius-topright: 2px;
222
+ }
223
+
224
+ .list tbody td {
225
+ background: #f2f2eb;
226
+ }
227
+
228
+ .list tfoot td {
229
+ line-height: 18px;
230
+ }
231
+
232
+ .list .method {
233
+ width: 6em;
234
+ }
235
+
236
+ tr.even td {
237
+ background: #e9e9e2 !important;
238
+ }
239
+
240
+ /* Response Codes */
241
+
242
+ span.r1, span.r2, span.r3, span.r4,
243
+ span.r5 {
244
+ display: block;
245
+ padding: .15em;
246
+ margin: .15em;
247
+ color: #dac7ad;
248
+ }
249
+
250
+ /* Informational 1xx */
251
+ span.r1 {
252
+ background-color: #3333cc;
253
+ border: 1px solid #376edc;
254
+ }
255
+
256
+ /* Successfull 2xx */
257
+ span.r2 {
258
+ background-color: #006600;
259
+ border: 1px solid #008900;
260
+ }
261
+
262
+ /* Redirection 3xx */
263
+ span.r3 {
264
+ background-color: #555652;
265
+ border: 1px solid #80817b;
266
+ }
267
+
268
+ /* Client 4xx */
269
+ span.r4 {
270
+ background-color: #857400;
271
+ border: 1px solid #baa200;
272
+ }
273
+ /* Server Error 5xx */
274
+ span.r5 {
275
+ background-color: #c40000;
276
+ border: 1px solid #dc0000;
277
+ }
278
+
279
+ /* Detail */
280
+ #report h3 {
281
+ background: #D0D0C4; font-weight: normal;
282
+ border-bottom: 2px solid #ABA7A1;
283
+ -moz-border-radius-topleft: 2px; -moz-border-radius-topright: 2px;
284
+ -webkit-border-top-left-radius: 2px; -webkit-border-top-right-radius: 2px;
285
+ }
286
+
287
+ #report h3,
288
+ #report p {
289
+ width: 50%;
290
+ padding:6px 8px;
291
+ margin: 1px 0;
292
+ }
293
+
294
+ #report a {
295
+ color: #70B1CA
296
+ }
297
+
298
+ #report a:hover {
299
+ text-decoration: none;
300
+ }
301
+
302
+ #report p b {
303
+ color: #050505;
304
+ font-weight: normal;
305
+ }
306
+
307
+ #report p {
308
+ color: #463C38;
309
+ background: #f2f2eb;
310
+ line-height: 22px;
311
+ }
312
+
313
+ #report p span {
314
+ display: inline-block;
315
+ display: -moz-inline-block;
316
+ margin: 0;
317
+ padding: 2px 6px;
318
+ line-height: 16px;
319
+ }
320
+
321
+ #report h3 em {
322
+ display: block;
323
+ font-family: Consolas, Lucida Console, Monaco, monospace;
324
+ font-size: 75%;
325
+ font-style: normal;
326
+ font-weight: normal;
327
+ color: #463C38;
328
+ line-height: 22px;
329
+ }
330
+
331
+ /* Output */
332
+ .output {margin: 10px 0; width: 100%; font-size: 82.5%;}
333
+ .output th { background: #b9b9a9; text-align: left; padding-left: 2.25em; font-weight: normal; line-height: 18px; color: #463C38; border-bottom: 1px solid #fff;
334
+ -moz-border-radius-topleft: 2px; -moz-border-radius-topright: 2px;
335
+ -webkit-border-top-left-radius: 2px; -webkit-border-top-right-radius: 2px;
336
+ }
337
+ .output td { background: #f2f2eb; padding: 1px; line-height: 18px; }
338
+ .output { font-family: Consolas, Lucida Console, Monaco, monospace; }
339
+ .output .numbers { width: 3em; text-align: right; border-right: 1px solid #fff;}
340
+ .output .lines { width: auto; text-align: left;}
341
+ .output .line { display: block; text-align: left; padding: 1px 4px;}
342
+ .output .line.number { text-align: right; color: #585850; }
343
+
344
+ /* Tabs */
345
+ .ui-tabs-panel {display: block;}
346
+ .ui-tabs-panel.ui-tabs-hide {display: none !important;}
@@ -0,0 +1,34 @@
1
+ module Relevance::CoreExtensions::Nil
2
+ def ellipsize(cutoff = 20)
3
+ ""
4
+ end
5
+ end
6
+
7
+ module Relevance::CoreExtensions::String
8
+ def ellipsize(cutoff = 20)
9
+ if length > cutoff
10
+ "#{self[0...cutoff]}..."
11
+ else
12
+ self
13
+ end
14
+ end
15
+ end
16
+
17
+ module Relevance::CoreExtensions::Object
18
+ def ellipsize(cutoff = 20)
19
+ inspect.ellipsize(cutoff)
20
+ end
21
+ end
22
+
23
+ class Object
24
+ include Relevance::CoreExtensions::Object
25
+ end
26
+ class String
27
+ include Relevance::CoreExtensions::String
28
+ end
29
+ class NilClass
30
+ include Relevance::CoreExtensions::Nil
31
+ end
32
+
33
+
34
+
@@ -0,0 +1,9 @@
1
+ module Relevance::CoreExtensions::File
2
+ def extension(path)
3
+ extname(path)[1..-1]
4
+ end
5
+ end
6
+
7
+ class File
8
+ extend Relevance::CoreExtensions::File
9
+ end
@@ -0,0 +1,78 @@
1
+ # This is a direct copy of the facets library metaclass stuff.
2
+ # used by Tarantula pulling in all of Facets doesn't make sense here.
3
+
4
+ # From lib/core/facets/metaid.rb
5
+ module Kernel
6
+ def meta_alias(*args)
7
+ meta_class do
8
+ alias_method(*args)
9
+ end
10
+ end
11
+
12
+ def meta_eval(str=nil, &blk)
13
+ if str
14
+ meta_class.instance_eval(str)
15
+ else
16
+ meta_class.instance_eval(&blk)
17
+ end
18
+ end
19
+
20
+ def meta_def( name, &block )
21
+ meta_class do
22
+ define_method( name, &block )
23
+ end
24
+ end
25
+
26
+ def meta_class(&block)
27
+ if block_given?
28
+ (class << self; self; end).class_eval(&block)
29
+ else
30
+ (class << self; self; end)
31
+ end
32
+ end
33
+
34
+ alias_method :metaclass, :meta_class
35
+
36
+ def eigenclass
37
+ (class << self; self; end)
38
+ end
39
+ end
40
+
41
+ class Module
42
+ def class_def name, &blk
43
+ class_eval { define_method name, &blk }
44
+ end
45
+
46
+ protected :attr
47
+ protected :attr_reader
48
+ protected :attr_writer
49
+ protected :attr_accessor
50
+ protected :remove_method
51
+ protected :undef_method
52
+ end
53
+
54
+ # From /lib/more/facets/kernel/meta.rb
55
+ module Kernel
56
+ def meta
57
+ @_meta_functor ||= Functor.new do |op,*args|
58
+ (class << self; self; end).send(op,*args)
59
+ end
60
+ end
61
+ end
62
+
63
+ # From /lib/core/facets/functor.rb
64
+ class Functor
65
+ private(*instance_methods.select { |m| m !~ /(^__|^binding$)/ })
66
+
67
+ def initialize(&function)
68
+ @function = function
69
+ end
70
+
71
+ def to_proc
72
+ @function
73
+ end
74
+
75
+ def method_missing(op, *args, &blk)
76
+ @function.call(op, *args, &blk)
77
+ end
78
+ end