nasldoc 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,27 @@
1
+ # News
2
+
3
+ #0.0.8 (July 2011)
4
+ - Open sourced project on github
5
+ - Added daily_badurl.inc to the blacklist
6
+
7
+ #0.0.7 (June 8, 2011)
8
+ - Blacklisted "blacklist_dss.inc", "blacklist_rsa.inc", "blacklist_ssl_rsa1024.inc", "blacklist_ssl_rsa2048.inc", "daily_badip.inc", "known_CA.inc" plugins because they are pure binary and take forever to process <req: josh>
9
+ - Added an option for a output directory
10
+ - Added a internal page hyperlink via [function_name] <req:mak>
11
+ - Updated the wiki documents
12
+
13
+ #0.0.6 (May 4, 2011)
14
+ - Added @category for the function category, going to be used to generate a different function index like the wiki
15
+ - Added a @remark <string> tag for all other special notes <req:dwong/gtheall>
16
+ - Added [file#function] hyperlink generation
17
+ - Minor output bug fixes
18
+
19
+ #0.0.5 (April 3, 2011)
20
+ - Minor bug fixes
21
+
22
+ #0.0.4 (March 15, 2011)
23
+ - Turned it into a ruby gem to make it easier to use
24
+ - Parses out include()'s now and creates bind hyperlinks to that file
25
+ - Replaced \n with <br> in all of the comment fields to preserve newlines in the html output
26
+ - Added a ### tag for an overview block, like a file header
27
+ - Optimized some file reading code
@@ -0,0 +1,94 @@
1
+ #Setup
2
+
3
+ Setting up nasldoc to run is fairly simple. All you really need is the Ruby interpreter.
4
+
5
+ * [http://www.rubylang.org Ruby Programming Language]
6
+
7
+ #Development
8
+
9
+ Before writing nasldoc from scratch I tried to use several different open source solutions.
10
+
11
+ - jsdoc - This tool was promising but the author hardcoded /** */ as the comment delimiter which causes issues with Nasl since we cannot add a new comment style.
12
+ - javadoc - Parsed out the java language which made it impossible to do Nasl with it
13
+ - phpDocumentor - Worked well on parsing .inc files, but required /** */ comment styles
14
+ - Doxygen - Everything about Doxygen is hardcoded into the source, I wasn't able to change anything to get it to work with Nasl.
15
+
16
+ #Usage
17
+
18
+ Using nasldoc is fairly simple just pass it a directory or a single file that you want to generate the documentation for. Nasldoc is configured to only parse .inc files which special comment markup.
19
+
20
+ % nasldoc /opt/nessus/lib/nessus/plugins/
21
+
22
+ This will cause a directory called nasldoc/ to be created in your current directory. This directory will contain all of the generated html documents, just open index.html inside of nasldoc/ and view the documentation.
23
+
24
+ #Comment Markup
25
+
26
+ Nasldoc comments are inclosed in ## blocks and use special tags to mark items, currently there are only 3 tags. Tags can be added in a matter of minutes to the parser.
27
+
28
+ Nasldoc supports several markup tags this tags are:
29
+
30
+ * @param - used to label named arguments to a function
31
+ * @anonparam - used to label anonymous arguments to a function
32
+ * @return - what the function returns
33
+
34
+ ##Function Description Block
35
+
36
+ The function description block is free form text from the first ## to the first @tag in the nasldoc body, the lines are split on the # and rejoined with spaces.
37
+
38
+ ##Example
39
+
40
+ <pre>
41
+ ##
42
+ # Builds and sends a MaxDB dbm_version command packet and returns the results.
43
+ #
44
+ # @param socket The socket that the packet will be sent on
45
+ #
46
+ # @return An array of hashes for each of the info from the dbm_version command
47
+ ##
48
+ function maxdb_version(socket)
49
+ {
50
+ local_var version_pkt, data, version;
51
+
52
+ version_pkt =
53
+ maxdb_command_pkt() +
54
+ "dbm_version";
55
+
56
+ version_pkt = insstr(version_pkt, mkdword(strlen(version_pkt)), 0, 3);
57
+ version_pkt = insstr(version_pkt, mkdword(strlen(version_pkt)), 20, 23);
58
+
59
+ send(socket:socket, data:version_pkt);
60
+ data = maxdb_read_pkt(socket:socket);
61
+ version = maxdb_parse_version_info(data:data);
62
+
63
+ return version;
64
+ }
65
+ </pre>
66
+
67
+ #Templates
68
+
69
+ Nasldoc uses the ERB templating engine to make generating the output html dead simple. Attached is an example of the sidebar, ruby code can be injected to help generate the layout.
70
+
71
+ ##Example
72
+
73
+ <pre>
74
+ <html>
75
+ <head>
76
+ <title>nasldoc</title>
77
+ <link rel = 'stylesheet' type= 'text/css' href='stylesheet.css'>
78
+ </head>
79
+ <body>
80
+ <img src='nessus.jpg' />
81
+ <br><br><br>
82
+ <ul>
83
+ <% @file_list.each_with_index do |file, i| %>
84
+ <% row_class = i % 2 == 0 ? "even" : "odd" %>
85
+ <% output_file = file.gsub(".", "_") %>
86
+ <% output_file = File.basename(file).gsub(".", "_") %>
87
+ <li class="<%= row_class %>"><a href='<%= output_file %>.html' target='content'><%= File.basename(file) %></a></li>
88
+ <% end %>
89
+ </ul>
90
+ <br><br><br>
91
+ <ul><a href='overview.html' target='content'>Home</a></ul>
92
+ </body>
93
+ </html>
94
+ </pre>
@@ -0,0 +1,21 @@
1
+ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
2
+
3
+ require 'rubygems'
4
+ require "nasldoc"
5
+ require 'rake'
6
+
7
+ task :build do
8
+ system "gem build #{NaslDoc::APP_NAME}.gemspec"
9
+ end
10
+
11
+ task :release => :build do
12
+ system "gem push #{NaslDoc::APP_NAME}-#{NaslDoc::VERSION}.gem"
13
+ end
14
+
15
+ task :clean do
16
+ system "rm *.gem"
17
+ system "rm *.db"
18
+ system "rm *.cfg"
19
+ system "rm *.pdf"
20
+ system "rm -rf coverage"
21
+ end
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '/../lib'))
4
+
5
+ $stdout.sync = true
6
+ $stderr.sync = true
7
+
8
+ require 'rubygems'
9
+ require 'nasldoc'
10
+
11
+ app = NaslDoc::CLI::Application.new
12
+ app.main
@@ -0,0 +1,9 @@
1
+ module NaslDoc
2
+ APP_NAME = "nasldoc"
3
+ VERSION = "0.0.8"
4
+ end
5
+
6
+ require 'erb'
7
+ require 'nasldoc/cli'
8
+ require 'pathname'
9
+ require 'optparse'
@@ -0,0 +1,93 @@
1
+ /* JSDoc style sheet */
2
+
3
+ /* Define colors, fonts and other style attributes here to override the defaults */
4
+
5
+ /* Page background color */
6
+ body {
7
+ background-color: #FFFFFF;
8
+ margin-left: 0px;
9
+ margin-top: 0px;
10
+ margin-right: 0px;
11
+ margin-bottom: 0px;
12
+ list-style-position: outside;
13
+ background-repeat: repeat-y;
14
+ background-position: center;
15
+ }
16
+
17
+ #content {
18
+ padding: 5px;
19
+ }
20
+
21
+ table.nopad {
22
+ border:1px solid black;
23
+ width:100%;
24
+ border-collapse: collapse;
25
+ }
26
+
27
+ .odd {
28
+ background-color: #EEEEEE;
29
+ }
30
+
31
+ .even {
32
+ background-color: white;
33
+ }
34
+
35
+ tr {
36
+ border:1px solid black;
37
+ padding:0px;
38
+ }
39
+
40
+ td {
41
+ border:1px solid black;
42
+ padding:0px;
43
+ }
44
+
45
+ .header {
46
+ background: #EEEEEE;
47
+ width: 100%;
48
+ }
49
+ .TableHeadingColor { background: #EEEEEE }
50
+
51
+ td,p, li, ul {
52
+ font-family: Helvetica Neue, Verdana, Arial, Helvetica, sans-serif;
53
+ font-size: 13px;
54
+ line-height: 16px;
55
+ font-weight: normal;
56
+ color: #333333;
57
+ text-decoration: none;
58
+ }
59
+
60
+ a {
61
+ font-family: Helvetica Neue, Verdana, Arial, Helvetica, sans-serif;
62
+ font-size: 13px;
63
+ font-weight: normal;
64
+ color: #397AB2;
65
+ text-decoration: underline;
66
+ }
67
+ a:link {
68
+ font-family: Helvetica Neue, Verdana, Arial, Helvetica, sans-serif;
69
+ font-size: 13px;
70
+ font-weight: normal;
71
+ color: #397AB2;
72
+ text-decoration: underline;
73
+ }
74
+ a:hover {
75
+ font-family: Helvetica Neue, Verdana, Arial, Helvetica, sans-serif;
76
+ font-size: 13px;
77
+ font-weight: normal;
78
+ color: #4E6F9A;
79
+ }
80
+
81
+ h1 {
82
+ font-family: Helvetica Neue, Verdana, Arial, Helvetica, sans-serif;
83
+ font-size: 26px;
84
+ font-style: normal;
85
+ line-height: normal;
86
+ font-weight: bold;
87
+ color: #397AB2;
88
+ clip: rect(auto,auto,auto,auto);
89
+ margin-bottom: 0px;
90
+ padding-bottom: 0px;
91
+ }
92
+
93
+
@@ -0,0 +1,6 @@
1
+ module NaslDoc
2
+ module CLI
3
+ end
4
+ end
5
+
6
+ require 'nasldoc/cli/application'
@@ -0,0 +1,351 @@
1
+ module NaslDoc
2
+ module CLI
3
+ class Application
4
+
5
+ #
6
+ #
7
+ def initialize
8
+ @file_list = Array.new
9
+ @options = Hash.new
10
+
11
+ @options[:output_directory] = "nasldoc_ouput/"
12
+
13
+ @functions = Array.new
14
+ @function_count = 0
15
+
16
+ @includes = Array.new
17
+ @overview = Array.new
18
+ @overview_includes = Array.new
19
+
20
+ @template_dir = Pathname.new(__FILE__).realpath.to_s.gsub('cli/application.rb', 'templates')
21
+ @asset_dir = Pathname.new(__FILE__).realpath.to_s.gsub('cli/application.rb', 'assets')
22
+ @current_file = ""
23
+
24
+ end
25
+
26
+ # For ERB Support
27
+ #
28
+ def get_binding
29
+ binding
30
+ end
31
+
32
+ #
33
+ #
34
+ def build_template name, file=nil
35
+ if file == nil
36
+ file = name
37
+ end
38
+
39
+ puts "[*] Creating #{File.basename file}.html..."
40
+ @erb = ERB.new File.new("#{@template_dir}/#{name}.erb").read, nil, "%"
41
+ html = @erb.result(get_binding)
42
+
43
+ output_file = File.basename(file).gsub(".", "_")
44
+
45
+ File.open("#{@options[:output_directory]}/#{output_file}.html", 'w+') do |f|
46
+ f.puts html
47
+ end
48
+ end
49
+
50
+ #
51
+ #
52
+ def build_file_pages
53
+ @file_list.each do |file|
54
+ puts "[*] Processing File: #{file}"
55
+ @current_file = File.basename(file, ".inc")
56
+ contents = File.open(file, 'rb') { |f| f.read } unless file == nil
57
+
58
+ ##
59
+ add_nasldoc_stubs contents
60
+ exit
61
+ ##
62
+
63
+
64
+ contents = process_file_overview contents
65
+ process_file_includes contents
66
+ process_file contents
67
+ build_template "file", file
68
+ end
69
+ end
70
+
71
+ #
72
+ #
73
+ def process_file_overview file
74
+ regex = '###((\s*?.*?).*?)###$'
75
+
76
+ @overview = Array.new
77
+ @overview_includes = Array.new
78
+
79
+ file.scan(/#{regex}/m).each do |overview_text|
80
+ text = overview_text.first.gsub(/^#/, '')
81
+
82
+ text.split("\n").each do |line|
83
+ line.strip!
84
+ if line.start_with?("@") == false and line.length != 0
85
+ @overview << line
86
+ else
87
+ if line =~ /@include/
88
+ @overview_includes << line.gsub("@include", '')
89
+ else
90
+ @overview << line
91
+ end
92
+ end
93
+ end
94
+ end
95
+
96
+ @overview = @overview.join("<br />")
97
+
98
+ return file.gsub(/#{regex}/m, '')
99
+ end
100
+
101
+ #
102
+ #
103
+ def process_file_includes file
104
+ regex = '^include\([\'|\"](.*)[\'|\"]\);\n'
105
+
106
+ @includes = Array.new
107
+
108
+ file.scan(/#{regex}/).each do |include_file|
109
+ @include = Hash.new
110
+ @include["file"] = include_file
111
+
112
+ @includes << @include
113
+ end
114
+ end
115
+
116
+ def add_nasldoc_stubs file
117
+ regex = '[^##((\s*?.*?).*?)##]$.(^\s*)(function)(?:\s+|(\s*&\s*))(?:|([a-zA-Z0-9_]+))\s*(\()(.*?)(\))'
118
+ new_file = file.dup
119
+
120
+ file.scan(/#{regex}/m).each do |b1, function, b2, name, openpar, args, closepar|
121
+ nasldoc = ""
122
+ line = "#{function} #{name}#{openpar}#{args}#{closepar}"
123
+
124
+ params = args.split(",")
125
+
126
+ nasldoc << "\n##\n"
127
+ nasldoc << "# <Function description here>\n"
128
+ nasldoc << "#\n"
129
+ params.each do |arg|
130
+ nasldoc << "# @param #{arg.strip}\n"
131
+ end unless params.size == 0
132
+ nasldoc << "#\n"
133
+ nasldoc << "##\n"
134
+ nasldoc << "#{function} #{name}#{openpar}#{args}#{closepar}"
135
+
136
+ new_file = new_file.gsub(line, nasldoc)
137
+
138
+ end
139
+
140
+ puts new_file
141
+ end
142
+
143
+ #
144
+ #
145
+ def process_file file
146
+ regex = '##((\s*?.*?).*?)##$.(^\s*)(function)(?:\s+|(\s*&\s*))(?:|([a-zA-Z0-9_]+))\s*(\()(.*?)(\))'
147
+
148
+ @functions = Array.new
149
+
150
+ file.scan(/#{regex}/m).each do |comments, commentz, mod, function, space, name, openpar, args, closepar|
151
+ @function = Hash.new
152
+
153
+ @function["name"] = name
154
+ @function["args"] = args
155
+
156
+ summary = ""
157
+
158
+ comments.split("#").each do |line|
159
+ line = line.gsub("\n", "<br />")
160
+ line.strip!
161
+ if line.start_with?("@") == false
162
+ summary << " " + line
163
+ else
164
+ break
165
+ end
166
+ end
167
+
168
+ @function["summary"] = summary.strip.gsub("\n", "<br />")
169
+
170
+ @function["comments"] = comments = comments.gsub(/^#/, '').gsub("\n", "<br />")
171
+ @function["nasl_doc"] = comments.gsub("@", "||@").split("||")
172
+
173
+ anon_params = Hash.new
174
+ params = Hash.new
175
+ returns = Hash.new
176
+ deprecated = Hash.new
177
+ nessus = Hash.new
178
+ category = Hash.new
179
+ remark = Hash.new
180
+
181
+ @function["nasl_doc"].each do |doc|
182
+ if doc =~ /(\[(.*)#(.*)\])/
183
+ file_url = $2
184
+ function = $3
185
+ url = file_url + "_inc.html" + "#" + function
186
+ doc = doc.gsub($1, "<a href=\"#{url}\">#{function}</a>")
187
+ end
188
+
189
+ if doc =~ /(\[(.*)\])/
190
+ function = $2
191
+ url = @current_file + "_inc.html" + "#" + function
192
+ doc = doc.gsub($1, "<a href=\"#{url}\">#{function}</a>")
193
+ end
194
+
195
+ if doc =~ /@anonparam/
196
+ tmp = doc.sub("@anonparam", "").strip
197
+ parm = tmp.split(' ')[0]
198
+ anon_params[parm] = tmp.sub(parm, "")
199
+ end
200
+
201
+ if doc =~ /@param/
202
+ doc.sub!("@param", "").strip!
203
+ parm = doc.split(' ')[0]
204
+ desc = doc.sub(parm, "")
205
+ params[parm] = desc
206
+ end
207
+
208
+ if doc =~ /@return/
209
+ doc.sub!("@return", "").strip!
210
+ returns[doc] = doc
211
+ end
212
+
213
+ if doc =~ /@deprecated/
214
+ doc.sub!("@deprecated", "").strip!
215
+ deprecated[doc] = doc
216
+ end
217
+
218
+ if doc =~ /@nessus/
219
+ doc.sub!("@nessus", "").strip!
220
+ nessus[doc] = doc
221
+ end
222
+
223
+ if doc =~ /@category/
224
+ doc.sub!("@category", "").strip!
225
+ category[doc] = doc
226
+ end
227
+
228
+ if doc =~ /@remark/
229
+ doc.sub!("@remark", "").strip!
230
+ remark[doc] = doc
231
+ end
232
+ end
233
+
234
+ @function["anon_params"] = anon_params
235
+ @function["params"] = params
236
+ @function["returns"] = returns
237
+ @function["deprecated"] = deprecated
238
+ @function["nessus"] = nessus
239
+ @function["category"] = category
240
+ @function["remark"] = remark
241
+
242
+ @functions << @function
243
+ end
244
+
245
+ @function_count = @function_count + @functions.size
246
+ end
247
+
248
+ #
249
+ #
250
+ def copy_assets
251
+ puts "[*] Copying stylesheet.css to output dir"
252
+ `cp #{@asset_dir}/stylesheet.css #{@options[:output_directory]}`
253
+ puts "[*] Copying nessus.jpg to output dir"
254
+ `cp #{@asset_dir}/nessus.jpg #{@options[:output_directory]}`
255
+ end
256
+
257
+ #
258
+ #
259
+ def print_documentation_stats
260
+ puts "\n\nDocumentation Statistics"
261
+ puts "Files: #{@file_list.size}"
262
+ puts "Functions: #{@function_count}"
263
+ end
264
+
265
+ #
266
+ #
267
+ def remove_blacklist file_list
268
+ blacklist = [
269
+ "blacklist_dss.inc", "blacklist_rsa.inc", "blacklist_ssl_rsa1024.inc",
270
+ "blacklist_ssl_rsa2048.inc", "daily_badip.inc", "known_CA.inc", "daily_badurl.inc"
271
+ ]
272
+
273
+ new_file_list = file_list.dup
274
+
275
+ file_list.each_with_index do |file, index|
276
+ blacklist.each do |bf|
277
+ if file =~ /#{bf}/
278
+ new_file_list.delete(file)
279
+ end
280
+ end
281
+ end
282
+
283
+ return new_file_list
284
+ end
285
+
286
+ #
287
+ #
288
+ def parse_args
289
+ opts = OptionParser.new do |opt|
290
+ opt.banner = "#{APP_NAME} v#{VERSION}\nJacob Hammack\njhammack@tenable.com\n\n"
291
+ opt.banner << "Usage: #{APP_NAME} [options] [file|directory]"
292
+ opt.separator('')
293
+ opt.separator("Options")
294
+
295
+ opt.on('-o','--output DIRECTORY','Directory to output results to, Created if it doesn\'t exist') do |option|
296
+ @options[:output_directory] = option
297
+ end
298
+
299
+ opt.separator ''
300
+ opt.separator 'Other Options'
301
+
302
+ opt.on_tail('-v', '--version', "Shows application version information") do
303
+ puts "#{APP_NAME} - #{VERSION}"
304
+ exit
305
+ end
306
+
307
+ opt.on_tail("-?", "--help", "Show this message") do
308
+ puts opt.to_s + "\n"
309
+ exit
310
+ end
311
+ end
312
+
313
+ if ARGV.length != 0
314
+ opts.parse!
315
+ else
316
+ puts opts.to_s + "\n"
317
+ exit
318
+ end
319
+ end
320
+
321
+ #
322
+ #
323
+ def main
324
+ parse_args
325
+
326
+ if File.directory?(ARGV.first) == true
327
+ pattern = File.join(ARGV.first, "*.inc")
328
+ @file_list = Dir.glob pattern
329
+ else
330
+ @file_list << ARGV.first
331
+ end
332
+
333
+ if File.directory?(@options[:output_directory]) == false
334
+ Dir.mkdir @options[:output_directory]
335
+ end
336
+
337
+ @file_list = remove_blacklist(@file_list)
338
+
339
+ puts "[*] Building documentation..."
340
+
341
+ build_template "index"
342
+ build_template "sidebar"
343
+ build_template "overview"
344
+ build_file_pages
345
+ copy_assets
346
+
347
+ print_documentation_stats
348
+ end
349
+ end
350
+ end
351
+ end
@@ -0,0 +1,159 @@
1
+ <html>
2
+ <head>
3
+ <title><%= @current_file %></title>
4
+ <link rel = 'stylesheet' type= 'text/css' href='stylesheet.css'>
5
+ </head>
6
+ <body>
7
+ <div id='content'>
8
+ <a name='top'></a>
9
+ <h1><%= @current_file %> Overview</h1>
10
+ <% if @overview.size != 0 %>
11
+ <p><%= @overview %></p>
12
+ <% end %>
13
+
14
+ <br />
15
+
16
+ <% if @includes.size != 0 %>
17
+ <h1>Defined Includes</h1>
18
+ <ul>
19
+ <% @includes.each do |i| %>
20
+ <li><a href="<%= i['file'].first.gsub('.', '_') %>.html"><%= i['file'].first %></a></li>
21
+ <% end %>
22
+ </ul>
23
+ <% end %>
24
+
25
+ <% if @overview_includes.size != 0 %>
26
+ <h1>Required Includes</h1>
27
+ <ul>
28
+ <% @overview_includes.each do |i| %>
29
+ <li><a href="<%= i.gsub('.', '_') %>.html"><%= i %></a></li>
30
+ <% end %>
31
+ </ul>
32
+ <% end %>
33
+
34
+ <table class="nopad">
35
+ <tr class='TableHeadingColor'>
36
+ <td>
37
+ <h1>Function Summary</h1>
38
+ </td>
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 />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%= 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>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>
151
+ <% end %>
152
+
153
+ <a href='#top'>top</a>
154
+
155
+ <hr>
156
+ <% end %>
157
+ </div>
158
+ </body>
159
+ </html>
@@ -0,0 +1,12 @@
1
+ <html>
2
+ <head>
3
+ <title>nasldoc</title>
4
+ <link rel = 'stylesheet' type= 'text/css' href='stylesheet.css'>
5
+ </head>
6
+ <frameset cols='20%,80%'>
7
+ <frame name='sidebar' src='sidebar.html'>
8
+ <frameset rows='100%'>
9
+ <frame name='content' src='overview.html'>
10
+ </frameset>
11
+ </frameset>
12
+ </html>
@@ -0,0 +1,27 @@
1
+ <html>
2
+ <head>
3
+ <title>nasldoc</title>
4
+ <link rel = 'stylesheet' type= 'text/css' href='stylesheet.css'>
5
+ </head>
6
+ <body>
7
+ <div id="content">
8
+ <table class="nopad">
9
+ <tr class='TableHeadingColor'>
10
+ <td>
11
+ <a name='top'></a><h1>File Summary</h1>
12
+ </td>
13
+ </tr>
14
+
15
+ <% @file_list.each do |file| %>
16
+ <% output_file = file.gsub(".", "_") %>
17
+ <% output_file = File.basename(file).gsub(".", "_") %>
18
+ <tr>
19
+ <td>
20
+ <a href='<%= output_file %>.html' target='content'><%= File.basename(file) %></a>
21
+ </td>
22
+ </tr>
23
+ <% end %>
24
+ </table>
25
+ </div>
26
+ </body>
27
+ </html>
@@ -0,0 +1,20 @@
1
+ <html>
2
+ <head>
3
+ <title>nasldoc</title>
4
+ <link rel = 'stylesheet' type= 'text/css' href='stylesheet.css'>
5
+ </head>
6
+ <body>
7
+ <img src='nessus.jpg' />
8
+ <br><br><br>
9
+ <ul>
10
+ <% @file_list.each_with_index do |file, i| %>
11
+ <% row_class = i % 2 == 0 ? "even" : "odd" %>
12
+ <% output_file = file.gsub(".", "_") %>
13
+ <% output_file = File.basename(file).gsub(".", "_") %>
14
+ <li class="<%= row_class %>"><a href='<%= output_file %>.html' target='content'><%= File.basename(file) %></a></li>
15
+ <% end %>
16
+ </ul>
17
+ <br><br><br>
18
+ <ul><a href='overview.html' target='content'>Home</a></ul>
19
+ </body>
20
+ </html>
@@ -0,0 +1,27 @@
1
+ base = __FILE__
2
+ $:.unshift(File.join(File.dirname(base), 'lib'))
3
+
4
+ require 'rubygems'
5
+ require 'nasldoc'
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "#{NaslDoc::APP_NAME}"
9
+ s.version = NaslDoc::VERSION
10
+ s.homepage = "https://researchwiki.corp.tenablesecurity.com/index.php/Nasl_doc"
11
+ s.summary = "#{NaslDoc::APP_NAME}"
12
+ s.description = "#{NaslDoc::APP_NAME} is a NASL documentation generator"
13
+ s.license = "BSD"
14
+
15
+ s.author = "Jacob Hammack"
16
+ s.email = "jhammack@tenable.com"
17
+
18
+ s.files = Dir['[A-Z]*'] + Dir['lib/**/*'] + ["#{NaslDoc::APP_NAME}.gemspec"]
19
+ s.bindir = "bin"
20
+ s.executables = "#{NaslDoc::APP_NAME}"
21
+ s.require_paths = ["lib"]
22
+ s.has_rdoc = 'yard'
23
+ s.extra_rdoc_files = ["README.markdown", "NEWS.markdown", "TODO.markdown"]
24
+
25
+ s.required_rubygems_version = ">= 1.3.6"
26
+ s.rubyforge_project = "#{NaslDoc::APP_NAME}"
27
+ end
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nasldoc
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.8
6
+ platform: ruby
7
+ authors:
8
+ - Jacob Hammack
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-07-14 00:00:00 -05:00
14
+ default_executable:
15
+ dependencies: []
16
+
17
+ description: nasldoc is a NASL documentation generator
18
+ email: jhammack@tenable.com
19
+ executables:
20
+ - nasldoc
21
+ extensions: []
22
+
23
+ extra_rdoc_files:
24
+ - README.markdown
25
+ - NEWS.markdown
26
+ - TODO.markdown
27
+ files:
28
+ - NEWS.markdown
29
+ - Rakefile
30
+ - README.markdown
31
+ - TODO.markdown
32
+ - lib/nasldoc/assets/nessus.jpg
33
+ - lib/nasldoc/assets/stylesheet.css
34
+ - lib/nasldoc/cli/application.rb
35
+ - lib/nasldoc/cli.rb
36
+ - lib/nasldoc/templates/file.erb
37
+ - lib/nasldoc/templates/index.erb
38
+ - lib/nasldoc/templates/overview.erb
39
+ - lib/nasldoc/templates/sidebar.erb
40
+ - lib/nasldoc.rb
41
+ - nasldoc.gemspec
42
+ - bin/nasldoc
43
+ has_rdoc: yard
44
+ homepage: https://researchwiki.corp.tenablesecurity.com/index.php/Nasl_doc
45
+ licenses:
46
+ - BSD
47
+ post_install_message:
48
+ rdoc_options: []
49
+
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: "0"
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: 1.3.6
64
+ requirements: []
65
+
66
+ rubyforge_project: nasldoc
67
+ rubygems_version: 1.6.2
68
+ signing_key:
69
+ specification_version: 3
70
+ summary: nasldoc
71
+ test_files: []
72
+