nasldoc 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +3 -3
- data/NEWS.markdown +9 -5
- data/README.markdown +38 -41
- data/Rakefile +49 -3
- data/TODO.markdown +20 -0
- data/bin/nasldoc +27 -1
- data/lib/nasldoc.rb +27 -1
- data/lib/nasldoc/assets/css/bootstrap.css +6004 -0
- data/lib/nasldoc/assets/css/bootstrap.min.css +859 -0
- data/lib/nasldoc/assets/css/shCore.css +226 -0
- data/lib/nasldoc/assets/css/shThemeDefault.css +117 -0
- data/lib/nasldoc/assets/{stylesheet.css → css/stylesheet.css} +37 -15
- data/lib/nasldoc/assets/img/glyphicons-halflings-white.png +0 -0
- data/lib/nasldoc/assets/img/glyphicons-halflings.png +0 -0
- data/lib/nasldoc/assets/{nessus.jpg → img/nessus.jpg} +0 -0
- data/lib/nasldoc/assets/js/bootstrap.js +2036 -0
- data/lib/nasldoc/assets/js/bootstrap.min.js +7 -0
- data/lib/nasldoc/assets/js/jquery-1.8.2.js +9440 -0
- data/lib/nasldoc/assets/js/shBrushNasl.js +33 -0
- data/lib/nasldoc/assets/js/shCore.js +17 -0
- data/lib/nasldoc/cli.rb +26 -0
- data/lib/nasldoc/cli/application.rb +150 -222
- data/lib/nasldoc/cli/comment.rb +317 -0
- data/lib/nasldoc/templates/file.erb +362 -154
- data/lib/nasldoc/templates/index.erb +93 -9
- data/lib/nasldoc/templates/old/file.erb +332 -0
- data/lib/nasldoc/templates/old/xfile.erb +267 -0
- data/lib/nasldoc/templates/old/xindex.erb +16 -0
- data/lib/nasldoc/templates/old/xoverview.erb +26 -0
- data/lib/nasldoc/templates/old/xsidebar.erb +21 -0
- data/lib/nasldoc/templates/xindex.erb +16 -0
- data/nasldoc.gemspec +45 -18
- metadata +45 -13
- data/lib/nasldoc/templates/overview.erb +0 -27
- data/lib/nasldoc/templates/sidebar.erb +0 -20
@@ -0,0 +1,317 @@
|
|
1
|
+
# Copyright (c) 2011-2013 Tenable Network Security.
|
2
|
+
# All rights reserved.
|
3
|
+
#
|
4
|
+
# Redistribution and use in source and binary forms, with or without
|
5
|
+
# modification, are permitted provided that the following conditions are met:
|
6
|
+
#
|
7
|
+
# * Redistributions of source code must retain the above copyright
|
8
|
+
# notice, this list of conditions and the following disclaimer.
|
9
|
+
# * Redistributions in binary form must reproduce the above copyright
|
10
|
+
# notice, this list of conditions and the following disclaimer in the
|
11
|
+
# documentation and/or other materials provided with the distribution.
|
12
|
+
# * Neither the name of the Tenable Network Security nor the names of its contributors
|
13
|
+
# may be used to endorse or promote products derived from this software
|
14
|
+
# without specific prior written permission.
|
15
|
+
#
|
16
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
17
|
+
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
18
|
+
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
19
|
+
# DISCLAIMED. IN NO EVENT SHALL TENABLE NETWORK SECURITY BE LIABLE FOR ANY DIRECT, INDIRECT,
|
20
|
+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
21
|
+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
22
|
+
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
23
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
24
|
+
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
25
|
+
# OF THE POSSIBILITY OF SUCH DAMAGE.
|
26
|
+
|
27
|
+
module NaslDoc
|
28
|
+
module CLI
|
29
|
+
class CommentException < Exception
|
30
|
+
end
|
31
|
+
|
32
|
+
class DuplicateArgumentException < CommentException
|
33
|
+
end
|
34
|
+
|
35
|
+
class DuplicateTagException < CommentException
|
36
|
+
end
|
37
|
+
|
38
|
+
class TagFormatException < CommentException
|
39
|
+
end
|
40
|
+
|
41
|
+
class UnrecognizedTagException < CommentException
|
42
|
+
end
|
43
|
+
|
44
|
+
class UnsupportedClassException < CommentException
|
45
|
+
end
|
46
|
+
|
47
|
+
class Comment
|
48
|
+
# Common attributes.
|
49
|
+
attr_reader :name, :type, :valid
|
50
|
+
|
51
|
+
# Freeform text attributes.
|
52
|
+
attr_accessor :description, :summary
|
53
|
+
|
54
|
+
# Tag attributes.
|
55
|
+
attr_accessor :anonparams, :categories, :deprecated, :includes, :nessus
|
56
|
+
attr_accessor :params, :remarks, :return
|
57
|
+
|
58
|
+
# Export and function attributes.
|
59
|
+
attr_accessor :function
|
60
|
+
|
61
|
+
# File attributes.
|
62
|
+
attr_accessor :filename, :signed
|
63
|
+
|
64
|
+
# Global attributes.
|
65
|
+
attr_accessor :variables
|
66
|
+
|
67
|
+
@@tags = [
|
68
|
+
'anonparam',
|
69
|
+
'category',
|
70
|
+
'deprecated',
|
71
|
+
'include',
|
72
|
+
'nessus',
|
73
|
+
'param',
|
74
|
+
'remark',
|
75
|
+
'return'
|
76
|
+
]
|
77
|
+
|
78
|
+
def initialize(node, path)
|
79
|
+
# Create common attributes.
|
80
|
+
@name = nil
|
81
|
+
@type = nil
|
82
|
+
@valid = false
|
83
|
+
|
84
|
+
# Create freeform text attributes.
|
85
|
+
@summary = nil
|
86
|
+
@description = nil
|
87
|
+
|
88
|
+
# Create tag attributes.
|
89
|
+
@anonparams = {}
|
90
|
+
@categories = []
|
91
|
+
@deprecated = nil
|
92
|
+
@includes = []
|
93
|
+
@nessus = nil
|
94
|
+
@params = {}
|
95
|
+
@remarks = []
|
96
|
+
@return = nil
|
97
|
+
|
98
|
+
# Create export and function attributes.
|
99
|
+
@function = nil
|
100
|
+
|
101
|
+
# Create file attributes.
|
102
|
+
@filename = nil
|
103
|
+
@signed = nil
|
104
|
+
|
105
|
+
# Create global attributes.
|
106
|
+
@variables = []
|
107
|
+
|
108
|
+
# Determine if this is a nasldoc comment.
|
109
|
+
text = node.text.body;
|
110
|
+
@valid = !Regexp.new("(^\s*\#{2,3}\s*$|#{trusted_regex})").match(text).nil?
|
111
|
+
return unless @valid
|
112
|
+
|
113
|
+
# Remember the type.
|
114
|
+
unless node.next.nil?
|
115
|
+
@type = node.next.class.name.gsub(/.*::/, '').downcase.to_sym
|
116
|
+
else
|
117
|
+
# The first comment in a file might not have a next node.
|
118
|
+
@type = :file
|
119
|
+
end
|
120
|
+
|
121
|
+
# Store any other attributes we may need, since we're not keeping a
|
122
|
+
# reference to the node.
|
123
|
+
case @type
|
124
|
+
when :export
|
125
|
+
extract_function(node.function)
|
126
|
+
when :file
|
127
|
+
extract_file(node, path)
|
128
|
+
when :function
|
129
|
+
extract_function(node)
|
130
|
+
when :global
|
131
|
+
extract_global(node)
|
132
|
+
else
|
133
|
+
raise UnsupportedClassException, "The class #{node.next.class.name} is not supported."
|
134
|
+
end
|
135
|
+
|
136
|
+
# Parse the comment's text.
|
137
|
+
parse(text)
|
138
|
+
end
|
139
|
+
|
140
|
+
def parse(text)
|
141
|
+
# Remove the trusted header.
|
142
|
+
re_sig = Regexp.new(trusted_regex)
|
143
|
+
text.gsub!(re_sig, '');
|
144
|
+
|
145
|
+
# Remove the comment prefixes ('#') from the text.
|
146
|
+
text.gsub!(/^#+/, '');
|
147
|
+
|
148
|
+
# Parse all the paragraphs of free-form text.
|
149
|
+
parse_paragraphs(text)
|
150
|
+
|
151
|
+
# Parse all the tags.
|
152
|
+
parse_tags(text)
|
153
|
+
end
|
154
|
+
|
155
|
+
def parse_paragraphs(text)
|
156
|
+
re_none = Regexp.new(/[^[:space:]]/)
|
157
|
+
re_tags = Regexp.new(tags_regex)
|
158
|
+
|
159
|
+
# Collect together a list of paragraphs.
|
160
|
+
min = 9999
|
161
|
+
paras = []
|
162
|
+
text.each_line('') do |para|
|
163
|
+
# Skip if the paragraph has a line starting with a tag, or has no
|
164
|
+
# content.
|
165
|
+
next unless para =~ re_none
|
166
|
+
next if para =~ re_tags
|
167
|
+
para.rstrip!
|
168
|
+
paras << para
|
169
|
+
|
170
|
+
# Determine the minimum indentation across all paragraphs.
|
171
|
+
para.each_line do |line|
|
172
|
+
padding = line[/^ */]
|
173
|
+
min = [min, padding.length].min
|
174
|
+
|
175
|
+
# No point in continuing if we hit the lower bound.
|
176
|
+
break if min == 0
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
# Strip the minimum number of spaces from the left.
|
181
|
+
if min > 0
|
182
|
+
regex = Regexp.new("^ {#{min}}")
|
183
|
+
paras.map! { |p| p.gsub(regex, '') }
|
184
|
+
end
|
185
|
+
|
186
|
+
# The first paragraph is the summary.
|
187
|
+
@summary = paras.shift
|
188
|
+
|
189
|
+
# The following paragraphs are the description.
|
190
|
+
@description = paras
|
191
|
+
end
|
192
|
+
|
193
|
+
def parse_tags(text)
|
194
|
+
re_name = Regexp.new("[_a-zA-Z][_a-zA-Z0-9]*")
|
195
|
+
re_tags = Regexp.new(tags_regex)
|
196
|
+
|
197
|
+
# Tags start a line which continues until the next tag or blank line.
|
198
|
+
text.each_line('') do |para|
|
199
|
+
# Skip if the paragraph it doesn't have a line starting with a tag.
|
200
|
+
next if para !~ re_tags
|
201
|
+
|
202
|
+
# Break the paragraphs into blocks, each starting with a tag.
|
203
|
+
until para.empty?
|
204
|
+
# Find the bounds of the block.
|
205
|
+
beg = para.index(re_tags)
|
206
|
+
break if beg.nil?
|
207
|
+
fin = para.index(re_tags, beg + 1) || -1
|
208
|
+
|
209
|
+
# Pull the block out of the paragraph.
|
210
|
+
block = para[beg..fin]
|
211
|
+
para = para[fin..-1]
|
212
|
+
|
213
|
+
# Remove the tag from the block.
|
214
|
+
tag = block[re_tags]
|
215
|
+
block = block[tag.length..-1]
|
216
|
+
next if block.nil?
|
217
|
+
|
218
|
+
# Squash all spaces on the block, being mindful that if the block is
|
219
|
+
# nil the tag is useless.
|
220
|
+
block.gsub!(/[ \n\r\t]+/, ' ')
|
221
|
+
next if block.nil?
|
222
|
+
block.strip!
|
223
|
+
next if block.nil?
|
224
|
+
|
225
|
+
# Squash the tag and trim the '@' off for accessing the object's
|
226
|
+
# attribute.
|
227
|
+
tag.lstrip!
|
228
|
+
attr = tag[1..-1]
|
229
|
+
|
230
|
+
case tag
|
231
|
+
when '@anonparam', '@param'
|
232
|
+
# Parse the argument name.
|
233
|
+
name = block[re_name]
|
234
|
+
if name.nil?
|
235
|
+
raise TagFormatException, "Failed to parse the #{tag}'s name for #@name."
|
236
|
+
end
|
237
|
+
|
238
|
+
block = block[name.length..-1]
|
239
|
+
if block.nil?
|
240
|
+
raise TagFormatException, "Failed to parse the #{tag}'s block for #@name."
|
241
|
+
end
|
242
|
+
block.lstrip!
|
243
|
+
|
244
|
+
# Check for previous declarations of this name.
|
245
|
+
if @anonparams.key?(name)
|
246
|
+
raise DuplicateTagException, "The param '#{name}' was previously declared as an @anonparam for #@name."
|
247
|
+
end
|
248
|
+
|
249
|
+
if @params.key?(name) and not @params[name].nil?
|
250
|
+
raise DuplicateTagException, "The param '#{name}' was previously declared as a @param for #@name."
|
251
|
+
end
|
252
|
+
|
253
|
+
hash = self.send(attr + 's')
|
254
|
+
hash[name] = block
|
255
|
+
when '@category'
|
256
|
+
unless @categories.empty?
|
257
|
+
raise DuplicateTagException, "The #{tag} tag appears more than once for #@name."
|
258
|
+
end
|
259
|
+
|
260
|
+
@categories = block.split(/,/).map &:strip
|
261
|
+
when '@deprecated', '@nessus', '@return'
|
262
|
+
unless self.send(attr).nil?
|
263
|
+
raise DuplicateTagException, "The #{tag} tag appears more than once for #@name."
|
264
|
+
end
|
265
|
+
|
266
|
+
self.send(attr + '=', block)
|
267
|
+
when '@include', '@remark'
|
268
|
+
self.send(attr + 's').push(block)
|
269
|
+
else
|
270
|
+
raise UnrecognizedTagException, "The #{tag} tag is not recognized in #@name."
|
271
|
+
end
|
272
|
+
end
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
def tags_regex
|
277
|
+
"^\s*@(#{@@tags.join('|')})"
|
278
|
+
end
|
279
|
+
|
280
|
+
def trusted_regex
|
281
|
+
"^#TRUSTED [[:xdigit:]]{1024}$"
|
282
|
+
end
|
283
|
+
|
284
|
+
def extract_file(node, path)
|
285
|
+
# Remember the filename.
|
286
|
+
@filename = File.basename(path)
|
287
|
+
|
288
|
+
# Name this comment for use in error messages.
|
289
|
+
@name = "file #@filename"
|
290
|
+
|
291
|
+
# Determine whether the filename is signed, but don't validate the
|
292
|
+
# signature.
|
293
|
+
@signed = !Regexp.new(trusted_regex).match(node.text.body).nil?
|
294
|
+
end
|
295
|
+
|
296
|
+
def extract_function(node)
|
297
|
+
# Remember the function name.
|
298
|
+
fn = node.next
|
299
|
+
@function = fn.name.name
|
300
|
+
|
301
|
+
# Name this comment for use in error messages.
|
302
|
+
@name = "function #@function"
|
303
|
+
|
304
|
+
# Add in all named parameters, even ones that weren't annotated.
|
305
|
+
fn.params.each { |arg| @params[arg.name] = nil }
|
306
|
+
end
|
307
|
+
|
308
|
+
def extract_global(node)
|
309
|
+
# Remember all the variables.
|
310
|
+
@variables = node.next.idents.map &:name
|
311
|
+
|
312
|
+
# Name this comment for use in error messages.
|
313
|
+
@name = "global variable(s) #{@variables.join(', ')}"
|
314
|
+
end
|
315
|
+
end
|
316
|
+
end
|
317
|
+
end
|
@@ -1,159 +1,367 @@
|
|
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
|
-
|
1
|
+
<%
|
2
|
+
def comment(name, type)
|
3
|
+
filter1 = proc { |c| c.type == type }
|
4
|
+
|
5
|
+
filter2 = case type
|
6
|
+
when :export, :function
|
7
|
+
Proc.new { |c| c.function == name }
|
8
|
+
when :file
|
9
|
+
Proc.new { |c| true }
|
10
|
+
when :global
|
11
|
+
Proc.new { |c| c.variables.include? name }
|
12
|
+
end
|
13
|
+
|
14
|
+
@comments.select(&filter1).select(&filter2).shift
|
15
|
+
end
|
16
|
+
%>
|
17
|
+
|
18
|
+
<%
|
19
|
+
def safe(obj, default, *attrs)
|
20
|
+
attrs.each do |attr|
|
21
|
+
return default unless obj.respond_to? attr
|
22
|
+
obj = obj.send(attr)
|
23
|
+
end
|
24
|
+
|
25
|
+
obj
|
26
|
+
end
|
27
|
+
%>
|
28
|
+
|
29
|
+
<!DOCTYPE html>
|
30
|
+
<html lang="en">
|
31
|
+
<head>
|
32
|
+
<meta charset="utf-8">
|
33
|
+
<title>nasldoc: nasl</title>
|
34
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
35
|
+
<meta name="description" content="">
|
36
|
+
<meta name="author" content="">
|
37
|
+
|
38
|
+
<!-- Le styles -->
|
39
|
+
<style type="text/css">
|
40
|
+
body {
|
41
|
+
padding-top: 60px;
|
42
|
+
padding-bottom: 40px;
|
43
|
+
}
|
44
|
+
.sidebar-nav {
|
45
|
+
padding: 9px 0;
|
46
|
+
}
|
47
|
+
</style>
|
48
|
+
|
49
|
+
<link href="css/bootstrap.min.css" rel="stylesheet">
|
50
|
+
<link href="css/shCore.css" rel="stylesheet" type="text/css" />
|
51
|
+
<link href="css/shThemeDefault.css" rel="stylesheet" type="text/css" />
|
52
|
+
|
53
|
+
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
|
54
|
+
<!--[if lt IE 9]>
|
55
|
+
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
56
|
+
<![endif]-->
|
57
|
+
|
58
|
+
<!-- Fav and touch icons -->
|
59
|
+
<link rel="shortcut icon" href="ico/favicon.ico">
|
60
|
+
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="ico/apple-touch-icon-144-precomposed.png">
|
61
|
+
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="ico/apple-touch-icon-114-precomposed.png">
|
62
|
+
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="ico/apple-touch-icon-72-precomposed.png">
|
63
|
+
<link rel="apple-touch-icon-precomposed" href="ico/apple-touch-icon-57-precomposed.png">
|
64
|
+
</head>
|
65
|
+
|
66
|
+
<body>
|
67
|
+
|
68
|
+
<div class="navbar navbar-inverse navbar-fixed-top">
|
69
|
+
<div class="navbar-inner">
|
70
|
+
<div class="container-fluid">
|
71
|
+
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
72
|
+
<span class="icon-bar"></span>
|
73
|
+
<span class="icon-bar"></span>
|
74
|
+
<span class="icon-bar"></span>
|
75
|
+
</a>
|
76
|
+
<a class="brand" href="index.html">nasldoc</a>
|
77
|
+
<div class="nav-collapse collapse">
|
78
|
+
<ul class="nav">
|
79
|
+
<li class="active"><a href="index.html">Home</a></li>
|
80
|
+
</ul>
|
81
|
+
</div><!--/.nav-collapse -->
|
82
|
+
</div>
|
83
|
+
</div>
|
84
|
+
</div>
|
85
|
+
|
86
|
+
<div class="container-fluid">
|
87
|
+
<div class="row-fluid">
|
88
|
+
<div class="span3">
|
89
|
+
<div class="well sidebar-nav">
|
90
|
+
<ul class="nav nav-list">
|
91
|
+
<% @file_list.each_with_index do |file, i| %>
|
92
|
+
<% row = i.even? ? 'even' : 'odd' %>
|
93
|
+
<% link = url(file) %>
|
94
|
+
<li class="<%= row %>">
|
95
|
+
<a href="<%= link %>"><%= link.gsub('.html', '.inc') %></a>
|
96
|
+
</li>
|
97
|
+
<% end %>
|
98
|
+
</ul>
|
99
|
+
</div><!--/.well -->
|
100
|
+
</div><!--/span-->
|
101
|
+
<div class="span9">
|
102
|
+
|
103
|
+
<a name="top"></a>
|
104
|
+
<h1>Overview of <%= @current_file %></h1>
|
105
|
+
<% unless @overview.nil? %>
|
106
|
+
<% unless @overview.summary.nil? %>
|
107
|
+
<p class="summary"><%= @overview.summary %></p>
|
108
|
+
<% end %>
|
109
|
+
<% @overview.description.each do |paragraph| %>
|
110
|
+
<p class="description"><%= paragraph %></p>
|
111
|
+
<% end %>
|
112
|
+
|
113
|
+
<% if @overview.signed %>
|
114
|
+
<h1>Signed</h1>
|
115
|
+
<p>This library contains a signature, indicating that it is permitted to
|
116
|
+
call trusted builtin functions.</p>
|
117
|
+
<p class="warning">The signature on this library has not been checked, so
|
118
|
+
there is no guarantee it will run in Nessus.</p>
|
119
|
+
<% end %>
|
120
|
+
|
121
|
+
<% unless @overview.includes.empty? %>
|
122
|
+
|
123
|
+
<h1>Required Includes</h1>
|
124
|
+
<p>These files must be included by the importing code.</p>
|
125
|
+
<ul>
|
126
|
+
<% @overview.includes.sort.each do |inc| %>
|
127
|
+
<li><a href="<%= url(inc) %>"><%= inc %></a></li>
|
128
|
+
<% end %>
|
129
|
+
</ul>
|
130
|
+
<% end %>
|
131
|
+
<% end %>
|
132
|
+
|
133
|
+
<% unless @includes.empty? %>
|
134
|
+
|
135
|
+
<h1>Automatic Includes</h1>
|
136
|
+
<p>These files are automatically included by the library.</p>
|
137
|
+
<ul>
|
138
|
+
<% @includes.each do |inc| %>
|
139
|
+
<li><a href="<%= url(inc) %>"><%= inc %></a></li>
|
140
|
+
<% end %>
|
141
|
+
</ul>
|
142
|
+
<% end %>
|
143
|
+
|
144
|
+
<% {Public: @globs_pub, Private: @globs_prv}.each do |name, list| %>
|
145
|
+
<% unless list.empty? %>
|
146
|
+
|
147
|
+
<h1><%= name %> Variable Summary</h1>
|
148
|
+
|
149
|
+
<% if name == :Public %>
|
150
|
+
<p>Public variables are intended to be accessed by the code that imports
|
151
|
+
this library.</p>
|
152
|
+
<% else %>
|
153
|
+
<p>Private variables are not intended to be accessed by the code that
|
154
|
+
imports this library. There is no functional difference between private
|
155
|
+
and public variables, only convention, and they may be accessed as
|
156
|
+
normal. </p>
|
157
|
+
<% end %>
|
158
|
+
|
159
|
+
<table class="nopad">
|
160
|
+
<tr class="TableHeadingColor">
|
161
|
+
<th>Name</th>
|
162
|
+
<th>Summary</th>
|
163
|
+
</tr>
|
164
|
+
<% list.each do |name| %>
|
165
|
+
<tr>
|
166
|
+
<td><a href="#<%= name %>"><%= name %></a></td>
|
167
|
+
<td><%= safe(comment(name, :global), "", :summary) %></td>
|
168
|
+
</tr>
|
169
|
+
<% end %>
|
170
|
+
</table>
|
171
|
+
<% end %>
|
172
|
+
<% end %>
|
173
|
+
|
174
|
+
<% {Public: @funcs_pub, Private: @funcs_prv}.each do |name, list| %>
|
175
|
+
<% unless list.empty? %>
|
176
|
+
<h1><%= name %> Function Summary</h1>
|
177
|
+
|
178
|
+
<% if name == :Public %>
|
179
|
+
<p>Public functions are intended to be called by the code that imports
|
180
|
+
this library.</p>
|
181
|
+
<% else %>
|
182
|
+
<p>Private functions are not intended to be called by the code that
|
183
|
+
imports this library. There is no functional difference between private
|
184
|
+
and public functions, only convention, and they may be called as
|
185
|
+
normal. </p>
|
186
|
+
<% end %>
|
187
|
+
|
188
|
+
<table class="nopad">
|
189
|
+
<tr class="TableHeadingColor">
|
190
|
+
<th>Name</th>
|
191
|
+
<th>Summary</th>
|
192
|
+
</tr>
|
193
|
+
<% list.keys.sort.each do |name| %>
|
194
|
+
<tr>
|
195
|
+
<td><a href="#<%= name %>"><%= name %></a></td>
|
196
|
+
<td><%= safe(comment(name, :function), "", :summary) %></td>
|
197
|
+
</tr>
|
198
|
+
<% end %>
|
199
|
+
</table>
|
200
|
+
<% end %>
|
201
|
+
<% end %>
|
202
|
+
|
203
|
+
<% {Public: @globs_pub, Private: @globs_prv}.each do |name, list| %>
|
204
|
+
<% unless list.empty? %>
|
205
|
+
<h1><%= name %> Variable Details</h1>
|
206
|
+
<% list.each do |name| %>
|
207
|
+
<h2 id="<%= name %>"><%= name %></h2>
|
208
|
+
<% comm = comment(name, :global) %>
|
209
|
+
|
210
|
+
<% unless comm.nil? %>
|
211
|
+
<% unless comm.summary.nil? %>
|
212
|
+
|
213
|
+
<h3>Summary</h3>
|
214
|
+
<p class="summary"><%= comm.summary %></p>
|
215
|
+
<% end %>
|
216
|
+
|
217
|
+
<% unless comm.description.empty? %>
|
218
|
+
<h3>Description</h3>
|
219
|
+
<% comm.description.each do |para| %>
|
220
|
+
<p class="description"><%= para %></p>
|
32
221
|
<% end %>
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
</tr>
|
40
|
-
|
41
|
-
<% argz = "" %>
|
42
|
-
<% @functions.each do |function| %>
|
43
|
-
<tr>
|
44
|
-
<td>
|
45
|
-
<% argz = function["args"] %>
|
46
|
-
|
47
|
-
<% if function["anon_params"].size != 0 %>
|
48
|
-
<% function["anon_params"].each do |k,v| %>
|
49
|
-
<% if argz.length > 0 %>
|
50
|
-
<% argz << ", " %>
|
51
|
-
<% end %>
|
52
|
-
<% argz << "<i>#{k}</i>" %>
|
53
|
-
<% end %>
|
54
|
-
<% else %>
|
55
|
-
<% argz = function["args"] %>
|
56
|
-
<% end %>
|
57
|
-
|
58
|
-
<code><a href='#<%= function["name"] %>'><%= function["name"]%>(<%= argz %>)</a></code>
|
59
|
-
<% summary = function['summary'].split("<br />") %>
|
60
|
-
|
61
|
-
<% if summary[0] != "" %>
|
62
|
-
<% summary = summary[0] %>
|
63
|
-
<% elsif summary[1] != "" %>
|
64
|
-
<% summary = summary[1] %>
|
65
|
-
<% end %>
|
66
|
-
|
67
|
-
<br /> <%= summary %>
|
68
|
-
</td>
|
69
|
-
</tr>
|
70
|
-
<% end %>
|
71
|
-
</table>
|
72
|
-
|
73
|
-
<h1>Function Details</h1>
|
74
|
-
|
75
|
-
<% @functions.each do |function| %>
|
76
|
-
<% argz = String.new %>
|
77
|
-
<% argz = function["args"] %>
|
78
|
-
<% if function["anon_params"].size != 0 %>
|
79
|
-
<% function["anon_params"].each do |k,v| %>
|
80
|
-
<% argz << ", <i>#{k}</i>" unless argz.include?(k) %>
|
81
|
-
<% end %>
|
82
|
-
<% else %>
|
83
|
-
<% argz = function["args"] %>
|
84
|
-
<% end %>
|
85
|
-
|
86
|
-
<h2><a name='<%= function["name"] %>'><%= function["name"]%></a></h2>
|
87
|
-
<pre><b><%= function["name"]%> (<%= argz %>)</b></pre>
|
88
|
-
<p><%= function["summary"]%></p>
|
89
|
-
|
90
|
-
<% if function["params"].size != 0 %>
|
91
|
-
<h3>Named Parameters:</h3>
|
92
|
-
<ul>
|
93
|
-
<% function["params"].each do |k,v| %>
|
94
|
-
<li><code><%= k %></code> - <%= v %></li>
|
95
|
-
<% end %>
|
96
|
-
</ul>
|
97
|
-
<% end %>
|
98
|
-
|
99
|
-
<% if function["anon_params"].size != 0 %>
|
100
|
-
<h3>Anonymous Parameters:</h3>
|
101
|
-
<ul>
|
102
|
-
<% function["anon_params"].each do |k,v| %>
|
103
|
-
<li><code><%= k %></code> - <%= v %></li>
|
104
|
-
<% end %>
|
105
|
-
</ul>
|
106
|
-
<% end %>
|
107
|
-
|
108
|
-
<% if function["deprecated"].size != 0 %>
|
109
|
-
<h3>Deprecated:</h3>
|
110
|
-
<ul>
|
111
|
-
<% function["deprecated"].each do |k,v| %>
|
112
|
-
<li><%= k %></li>
|
113
|
-
<% end %>
|
114
|
-
</ul>
|
115
|
-
<% end %>
|
116
|
-
|
117
|
-
<% if function["category"].size != 0 %>
|
118
|
-
<h3>Function Category:</h3>
|
119
|
-
<ul>
|
120
|
-
<% function["category"].each do |k,v| %>
|
121
|
-
<li><code><%= k %></code></li>
|
122
|
-
<% end %>
|
123
|
-
</ul>
|
124
|
-
<% end %>
|
125
|
-
|
126
|
-
<% if function["remark"].size != 0 %>
|
127
|
-
<h3>Function Remarks:</h3>
|
128
|
-
<ul>
|
129
|
-
<% function["remark"].each do |k,v| %>
|
130
|
-
<li><code><%= k %></code></li>
|
131
|
-
<% end %>
|
132
|
-
</ul>
|
133
|
-
<% end %>
|
134
|
-
|
135
|
-
<% if function["nessus"].size != 0 %>
|
136
|
-
<h3>Nessus Version Required:</h3>
|
137
|
-
<ul>
|
138
|
-
<% function["nessus"].each do |k,v| %>
|
139
|
-
<li><code><%= k %></code></li>
|
140
|
-
<% end %>
|
141
|
-
</ul>
|
142
|
-
<% end %>
|
143
|
-
|
144
|
-
<% if function["returns"].size != 0 %>
|
145
|
-
<h3>Returns:</h3>
|
146
|
-
<ul>
|
147
|
-
<% function["returns"].each do |k,v| %>
|
148
|
-
<li><%= v %></li>
|
149
|
-
<% end %>
|
150
|
-
</ul>
|
222
|
+
<% end %>
|
223
|
+
|
224
|
+
<% unless comm.remarks.empty? %>
|
225
|
+
<h3>Remarks</h3>
|
226
|
+
<% comm.remarks.each do |rem| %>
|
227
|
+
<p class="remark"><%= rem %></p>
|
151
228
|
<% end %>
|
152
|
-
|
153
|
-
|
229
|
+
<% end %>
|
230
|
+
|
231
|
+
<% unless comm.deprecated.nil? %>
|
232
|
+
<h3>Deprecated</h3>
|
233
|
+
<p class="deprecated"><%= comm.deprecated %></p>
|
234
|
+
<% end %>
|
154
235
|
|
155
|
-
|
236
|
+
<% unless comm.nessus.nil? %>
|
237
|
+
<h3>Nessus Version</h3>
|
238
|
+
<p class="nessus"><%= comm.nessus %></p>
|
239
|
+
<% end %>
|
240
|
+
|
241
|
+
<% unless comm.categories.empty? %>
|
242
|
+
<h3>Categories</h3>
|
243
|
+
<ul>
|
244
|
+
<% comm.categories.sort.each do |cat| %>
|
245
|
+
<li><%= cat %></li>
|
246
|
+
<% end %>
|
247
|
+
</ul>
|
156
248
|
<% end %>
|
157
|
-
|
158
|
-
|
249
|
+
<% end %>
|
250
|
+
|
251
|
+
<a href="#top">top</a>
|
252
|
+
<hr>
|
253
|
+
<% end %>
|
254
|
+
<% end %>
|
255
|
+
<% end %>
|
256
|
+
|
257
|
+
<% {Public: @funcs_pub, Private: @funcs_prv}.each do |name, list| %>
|
258
|
+
<% unless list.empty? %>
|
259
|
+
<h1><%= name %> Function Details</h1>
|
260
|
+
<% list.keys.sort.each do |name| %>
|
261
|
+
<h2 id="<%= name %>"><%= name %></h2>
|
262
|
+
<% comm = comment(name, :function) %>
|
263
|
+
|
264
|
+
<% unless comm.nil? %>
|
265
|
+
<% unless comm.summary.nil? %>
|
266
|
+
<h3>Summary</h3>
|
267
|
+
<p class="summary"><%= comm.summary %></p>
|
268
|
+
<% end %>
|
269
|
+
|
270
|
+
<% unless comm.description.empty? %>
|
271
|
+
<h3>Description</h3>
|
272
|
+
<% comm.description.each do |para| %>
|
273
|
+
<p class="description"><%= para %></p>
|
274
|
+
<% end %>
|
275
|
+
<% end %>
|
276
|
+
|
277
|
+
<% unless comm.remarks.empty? %>
|
278
|
+
<h3>Remarks</h3>
|
279
|
+
<% comm.remarks.each do |rem| %>
|
280
|
+
<p class="remark"><%= rem %></p>
|
281
|
+
<% end %>
|
282
|
+
<% end %>
|
283
|
+
|
284
|
+
<% unless comm.deprecated.nil? %>
|
285
|
+
<h3>Deprecated</h3>
|
286
|
+
<p class="deprecated"><%= comm.deprecated %></p>
|
287
|
+
<% end %>
|
288
|
+
|
289
|
+
<% unless comm.nessus.nil? %>
|
290
|
+
<h3>Nessus Version</h3>
|
291
|
+
<p class="nessus"><%= comm.nessus %></p>
|
292
|
+
<% end %>
|
293
|
+
|
294
|
+
<% unless comm.categories.empty? %>
|
295
|
+
<h3>Categories</h3>
|
296
|
+
<ul>
|
297
|
+
<% comm.categories.sort.each do |cat| %>
|
298
|
+
<li><%= cat %></li>
|
299
|
+
<% end %>
|
300
|
+
</ul>
|
301
|
+
<% end %>
|
302
|
+
|
303
|
+
<% unless comm.anonparams.empty? %>
|
304
|
+
<h3>Anonymous Parameters</h3>
|
305
|
+
<dl>
|
306
|
+
<% comm.anonparams.sort.each do |name, block| %>
|
307
|
+
<dt><%= name %></dt>
|
308
|
+
<dd><%= block %></dd>
|
309
|
+
<% end %>
|
310
|
+
</dl>
|
311
|
+
<% end %>
|
312
|
+
<% end %>
|
313
|
+
|
314
|
+
<% unless @functions[name].nil? || @functions[name].empty? %>
|
315
|
+
<h3>Named Parameters</h3>
|
316
|
+
<dl>
|
317
|
+
<% @functions[name][:params].sort.each do |name| %>
|
318
|
+
<dt><%= name %></dt>
|
319
|
+
<% unless comm.nil? || !comm.params.has_key?(name) %>
|
320
|
+
<dd><%= comm.params[name] %></dd>
|
321
|
+
<% end %>
|
322
|
+
<% end %>
|
323
|
+
</dl>
|
324
|
+
<% end %>
|
325
|
+
|
326
|
+
<% unless comm.nil? || comm.return.nil? %>
|
327
|
+
<h3>Return Value</h3>
|
328
|
+
<p class="return"><%= comm.return %></p>
|
329
|
+
<% end %>
|
330
|
+
|
331
|
+
<h3>Code</h3>
|
332
|
+
<pre class="brush: nasl">
|
333
|
+
<%= @functions[name][:code] %>
|
334
|
+
</pre>
|
335
|
+
<a href="#top">top</a>
|
336
|
+
<hr>
|
337
|
+
<% end %>
|
338
|
+
<% end %>
|
339
|
+
<% end %>
|
340
|
+
|
341
|
+
</div><!--/span-->
|
342
|
+
</div><!--/row-->
|
343
|
+
|
344
|
+
<hr>
|
345
|
+
|
346
|
+
<footer>
|
347
|
+
<p>© Tenable Network Security 2013</p>
|
348
|
+
</footer>
|
349
|
+
|
350
|
+
</div><!--/.fluid-container-->
|
351
|
+
|
352
|
+
<!-- Le javascript
|
353
|
+
================================================== -->
|
354
|
+
<!-- Placed at the end of the document so the pages load faster -->
|
355
|
+
<script type="text/javascript" src="js/jquery-1.8.2.js"></script>
|
356
|
+
<script type="text/javascript" src="js/bootstrap.min.js"></script>
|
357
|
+
<script type="text/javascript" src="js/shCore.js"></script>
|
358
|
+
<script type="text/javascript" src="js/shBrushNasl.js"></script>
|
359
|
+
|
360
|
+
<script type="text/javascript">
|
361
|
+
SyntaxHighlighter.defaults['collapse'] = true;
|
362
|
+
SyntaxHighlighter.defaults['gutter'] = false;
|
363
|
+
SyntaxHighlighter.all();
|
364
|
+
</script>
|
365
|
+
|
366
|
+
</body>
|
159
367
|
</html>
|