nasl 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +51 -51
- data/lib/nasl/version.rb +1 -1
- data/nasl.gemspec +2 -2
- data/test/unit/parser/test_assignment.rb +2 -2
- metadata +44 -42
data/README.md
CHANGED
@@ -25,69 +25,69 @@ To avoid conflicting with the NASL interpreter, the NASL gem's binary is
|
|
25
25
|
installed as <nasl-parse>. As an application, it has very few actions that it
|
26
26
|
can perform.
|
27
27
|
|
28
|
-
|
28
|
+
* Benchmark: This benchmarks the time taken to parse the input path(s) over a
|
29
29
|
number of iterations. The number of iterations can be adjusted by the <-i>
|
30
30
|
switch.
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
32
|
+
% nasl-parse -i 10 benchmark /opt/nessus/lib/nessus/plugins/ssl_certificate_chain.nasl
|
33
|
+
-------------------------[ ssl_certificate_chain.nasl ]-------------------------
|
34
|
+
Rehearsal --------------------------------------------
|
35
|
+
Tokenize 1.687500 0.000000 1.687500 ( 1.688397)
|
36
|
+
Parse 1.835938 0.015625 1.851562 ( 1.857094)
|
37
|
+
----------------------------------- total: 3.539062sec
|
38
|
+
|
39
|
+
user system total real
|
40
|
+
Tokenize 1.304688 0.015625 1.320312 ( 1.319951)
|
41
|
+
Parse 1.046875 0.000000 1.046875 ( 1.046957)
|
42
|
+
-------------------------[ ssl_certificate_chain.nasl ]-------------------------
|
43
|
+
|
44
|
+
* Parse: This parses the input path(s) and indicates whether the parse was
|
45
45
|
successful.
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
47
|
+
% nasl-parse parse /opt/nessus/lib/nessus/plugins/ssl_certificate_chain.nasl
|
48
|
+
-------------------------[ ssl_certificate_chain.nasl ]-------------------------
|
49
|
+
Successfully parsed the contents of the file.
|
50
|
+
-------------------------[ ssl_certificate_chain.nasl ]-------------------------
|
51
51
|
|
52
|
-
|
52
|
+
* Test: This runs unit tests distributed with the application. Specific unit
|
53
53
|
tests can be specified on the command line, otherwise all tests will be run.
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
55
|
+
% nasl-parse test
|
56
|
+
Run options:
|
57
|
+
|
58
|
+
# Running tests:
|
59
|
+
|
60
|
+
.............................................................................
|
61
|
+
|
62
|
+
Finished tests in 11.773983s, 6.5398 tests/s, 33493.8487 assertions/s.
|
63
|
+
|
64
|
+
77 tests, 394356 assertions, 0 failures, 0 errors, 0 skips
|
65
|
+
|
66
|
+
* Tokenize: This tokenizes the input path(s) and prints the token/byte-range
|
67
67
|
pairs to stdout.
|
68
68
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
69
|
+
% nasl-parse tokenize /opt/nessus/lib/nessus/plugins/ssl_certificate_chain.nasl
|
70
|
+
-------------------------[ ssl_certificate_chain.nasl ]-------------------------
|
71
|
+
[COMMENT, 0...1076]
|
72
|
+
[IF, 1076...1079]
|
73
|
+
[LPAREN, 1079...1080]
|
74
|
+
[IDENT, 1080...1091]
|
75
|
+
[CMP_LT, 1091...1093]
|
76
|
+
...
|
77
|
+
-------------------------[ ssl_certificate_chain.nasl ]-------------------------
|
78
|
+
|
79
|
+
* XML: This parses the input path(s), and then prints an XML representation of
|
80
80
|
the parse tree to stdout.
|
81
81
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
82
|
+
% nasl-parse xml /opt/nessus/lib/nessus/plugins/ssl_certificate_chain.nasl
|
83
|
+
-------------------------[ ssl_certificate_chain.nasl ]-------------------------
|
84
|
+
<tree>
|
85
|
+
<if>
|
86
|
+
<expression>
|
87
|
+
<op><</op>
|
88
|
+
<lvalue>
|
89
|
+
...
|
90
|
+
-------------------------[ ssl_certificate_chain.nasl ]-------------------------
|
91
91
|
|
92
92
|
Library
|
93
93
|
-------
|
data/lib/nasl/version.rb
CHANGED
data/nasl.gemspec
CHANGED
@@ -6,7 +6,7 @@ require 'nasl/version'
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = 'nasl'
|
8
8
|
s.version = Nasl::VERSION
|
9
|
-
s.license =
|
9
|
+
s.license = 'BSD'
|
10
10
|
s.homepage = 'http://github.com/tenable/nasl'
|
11
11
|
s.summary = 'A parser for the Nessus Attack Scripting Language.'
|
12
12
|
s.description = File.open('README.md').read
|
@@ -24,6 +24,6 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.add_development_dependency 'racc'
|
25
25
|
s.add_development_dependency 'rake'
|
26
26
|
|
27
|
-
s.add_runtime_dependency 'builder'
|
27
|
+
s.add_runtime_dependency 'builder', '>= 3.1.4'
|
28
28
|
s.add_runtime_dependency 'rainbow'
|
29
29
|
end
|
@@ -37,7 +37,7 @@ class TestAssignment < Test::Unit::TestCase
|
|
37
37
|
def test_string
|
38
38
|
same(
|
39
39
|
"q = '';",
|
40
|
-
'<tree><assignment><op>=</op><lvalue><identifier name="q"/></lvalue><data
|
40
|
+
'<tree><assignment><op>=</op><lvalue><identifier name="q"/></lvalue><data></data></assignment></tree>'
|
41
41
|
)
|
42
42
|
same(
|
43
43
|
"q = 'foo';",
|
@@ -45,7 +45,7 @@ class TestAssignment < Test::Unit::TestCase
|
|
45
45
|
)
|
46
46
|
same(
|
47
47
|
'q = "";',
|
48
|
-
'<tree><assignment><op>=</op><lvalue><identifier name="q"/></lvalue><string
|
48
|
+
'<tree><assignment><op>=</op><lvalue><identifier name="q"/></lvalue><string></string></assignment></tree>'
|
49
49
|
)
|
50
50
|
same(
|
51
51
|
'q = "foo";',
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nasl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: racc
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ! '>='
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
53
|
+
version: 3.1.4
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -58,7 +58,7 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 3.1.4
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: rainbow
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -79,44 +79,46 @@ description: ! "Installation\n============\n\nGit\n---\n\nInstalling the source
|
|
79
79
|
Git is done as follows:\n\n git clone git://github.com/tenable/nasl.git\n\nGem\n---\n\nInstalling
|
80
80
|
the package from RubyGems is done as follows:\n\n gem install nasl\n\nUsage\n=====\n\nStandalone\n----------\n\nTo
|
81
81
|
avoid conflicting with the NASL interpreter, the NASL gem's binary is\ninstalled
|
82
|
-
as <nasl-parse>. As an application, it has very few actions that it\ncan perform.\n\n
|
82
|
+
as <nasl-parse>. As an application, it has very few actions that it\ncan perform.\n\n*
|
83
83
|
Benchmark: This benchmarks the time taken to parse the input path(s) over a\n number
|
84
84
|
of iterations. The number of iterations can be adjusted by the <-i>\n switch.\n\n
|
85
|
-
\
|
86
|
-
\
|
87
|
-
\
|
88
|
-
\ 0.000000 1.687500 ( 1.688397)\n
|
89
|
-
( 1.857094)\n
|
90
|
-
\
|
91
|
-
( 1.319951)\n
|
92
|
-
|
93
|
-
input path(s) and indicates
|
94
|
-
parse /opt/nessus/lib/nessus/plugins/ssl_certificate_chain.nasl\n
|
95
|
-
ssl_certificate_chain.nasl ]-------------------------\n
|
96
|
-
contents of the file.\n
|
97
|
-
]-------------------------\n\n
|
98
|
-
application. Specific unit\n tests can be specified
|
99
|
-
all tests will be run.\n\n
|
100
|
-
tests:\n
|
101
|
-
\
|
102
|
-
\
|
103
|
-
This tokenizes the input path(s) and prints the token/byte-range\n pairs
|
104
|
-
\
|
105
|
-
\
|
106
|
-
\
|
107
|
-
\
|
108
|
-
\
|
109
|
-
XML: This parses the
|
110
|
-
parse tree to stdout.\n\n
|
111
|
-
\
|
112
|
-
\
|
113
|
-
\
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
85
|
+
\ % nasl-parse -i 10 benchmark /opt/nessus/lib/nessus/plugins/ssl_certificate_chain.nasl\n
|
86
|
+
\ -------------------------[ ssl_certificate_chain.nasl ]-------------------------\n
|
87
|
+
\ Rehearsal --------------------------------------------\n Tokenize
|
88
|
+
\ 1.687500 0.000000 1.687500 ( 1.688397)\n Parse 1.835938 0.015625
|
89
|
+
\ 1.851562 ( 1.857094)\n ----------------------------------- total: 3.539062sec\n
|
90
|
+
\ \n user system total real\n Tokenize
|
91
|
+
\ 1.304688 0.015625 1.320312 ( 1.319951)\n Parse 1.046875 0.000000
|
92
|
+
\ 1.046875 ( 1.046957)\n -------------------------[ ssl_certificate_chain.nasl
|
93
|
+
]-------------------------\n\n* Parse: This parses the input path(s) and indicates
|
94
|
+
whether the parse was\n successful.\n\n % nasl-parse parse /opt/nessus/lib/nessus/plugins/ssl_certificate_chain.nasl\n
|
95
|
+
\ -------------------------[ ssl_certificate_chain.nasl ]-------------------------\n
|
96
|
+
\ Successfully parsed the contents of the file.\n -------------------------[
|
97
|
+
ssl_certificate_chain.nasl ]-------------------------\n\n* Test: This runs unit
|
98
|
+
tests distributed with the application. Specific unit\n tests can be specified
|
99
|
+
on the command line, otherwise all tests will be run.\n\n % nasl-parse test\n
|
100
|
+
\ Run options:\n \n # Running tests:\n \n .............................................................................\n
|
101
|
+
\ \n Finished tests in 11.773983s, 6.5398 tests/s, 33493.8487 assertions/s.\n
|
102
|
+
\ \n 77 tests, 394356 assertions, 0 failures, 0 errors, 0 skips\n\n*
|
103
|
+
Tokenize: This tokenizes the input path(s) and prints the token/byte-range\n pairs
|
104
|
+
to stdout.\n\n % nasl-parse tokenize /opt/nessus/lib/nessus/plugins/ssl_certificate_chain.nasl\n
|
105
|
+
\ -------------------------[ ssl_certificate_chain.nasl ]-------------------------\n
|
106
|
+
\ [COMMENT, 0...1076]\n [IF, 1076...1079]\n
|
107
|
+
\ [LPAREN, 1079...1080]\n [IDENT, 1080...1091]\n
|
108
|
+
\ [CMP_LT, 1091...1093]\n ...\n -------------------------[
|
109
|
+
ssl_certificate_chain.nasl ]-------------------------\n\n* XML: This parses the
|
110
|
+
input path(s), and then prints an XML representation of\n the parse tree to stdout.\n\n
|
111
|
+
\ % nasl-parse xml /opt/nessus/lib/nessus/plugins/ssl_certificate_chain.nasl\n
|
112
|
+
\ -------------------------[ ssl_certificate_chain.nasl ]-------------------------\n
|
113
|
+
\ <tree>\n <if>\n <expression>\n <op><</op>\n
|
114
|
+
\ <lvalue>\n ...\n -------------------------[ ssl_certificate_chain.nasl
|
115
|
+
]-------------------------\n\nLibrary\n-------\n\nThe primary users of this gem
|
116
|
+
are [Pedant][pedant] and [Nasldoc][nasldoc]. Other\nuses are encouraged, of course!
|
117
|
+
The <Parser> class is the most useful part,\nobviously, and can be used as follows:\n\n
|
118
|
+
\ require 'nasl'\n\n tree = Nasl::Parser.new.parse(file_contents, path_to_file)\n\nThat's
|
119
|
+
all there is to it. If there are any errors, it'll throw an instance of\n<ParseException>
|
120
|
+
that will include as much context about the error as possible.\n\n[nasldoc]: https://github.com/tenable/nasldoc\n[pedant]:
|
121
|
+
https://github.com/tenable/pedant\n"
|
120
122
|
email:
|
121
123
|
- mak@kolybabi.com
|
122
124
|
executables:
|
@@ -215,7 +217,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
215
217
|
version: '0'
|
216
218
|
segments:
|
217
219
|
- 0
|
218
|
-
hash: -
|
220
|
+
hash: -1487675631773899078
|
219
221
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
220
222
|
none: false
|
221
223
|
requirements:
|
@@ -224,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
224
226
|
version: '0'
|
225
227
|
segments:
|
226
228
|
- 0
|
227
|
-
hash: -
|
229
|
+
hash: -1487675631773899078
|
228
230
|
requirements: []
|
229
231
|
rubyforge_project: nasl
|
230
232
|
rubygems_version: 1.8.24
|