nasl 0.0.8 → 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.
Files changed (86) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +5 -0
  3. data/README.md +11 -16
  4. data/Rakefile +38 -0
  5. data/bin/nasl-parse +1 -1
  6. data/lib/nasl.rb +1 -1
  7. data/lib/nasl/cli.rb +1 -1
  8. data/lib/nasl/command.rb +1 -1
  9. data/lib/nasl/commands/benchmark.rb +1 -1
  10. data/lib/nasl/commands/parse.rb +1 -1
  11. data/lib/nasl/commands/test.rb +1 -1
  12. data/lib/nasl/commands/tokenize.rb +1 -1
  13. data/lib/nasl/commands/xml.rb +1 -1
  14. data/lib/nasl/context.rb +5 -5
  15. data/lib/nasl/grammar.racc +104 -16
  16. data/lib/nasl/parser.rb +1 -1
  17. data/lib/nasl/parser/argument.rb +1 -1
  18. data/lib/nasl/parser/array.rb +51 -0
  19. data/lib/nasl/parser/assigment.rb +1 -1
  20. data/lib/nasl/parser/block.rb +7 -1
  21. data/lib/nasl/parser/break.rb +2 -2
  22. data/lib/nasl/parser/call.rb +3 -2
  23. data/lib/nasl/parser/comment.rb +2 -2
  24. data/lib/nasl/parser/continue.rb +2 -2
  25. data/lib/nasl/parser/decrement.rb +1 -1
  26. data/lib/nasl/parser/empty.rb +2 -2
  27. data/lib/nasl/parser/export.rb +1 -1
  28. data/lib/nasl/parser/expression.rb +1 -1
  29. data/lib/nasl/parser/for.rb +2 -2
  30. data/lib/nasl/parser/foreach.rb +4 -4
  31. data/lib/nasl/parser/function.rb +1 -1
  32. data/lib/nasl/parser/global.rb +1 -1
  33. data/lib/nasl/parser/identifier.rb +7 -2
  34. data/lib/nasl/parser/if.rb +2 -2
  35. data/lib/nasl/parser/import.rb +1 -1
  36. data/lib/nasl/parser/include.rb +2 -2
  37. data/lib/nasl/parser/increment.rb +1 -1
  38. data/lib/nasl/parser/integer.rb +7 -2
  39. data/lib/nasl/parser/ip.rb +2 -2
  40. data/lib/nasl/parser/key_value_pair.rb +43 -0
  41. data/lib/nasl/parser/list.rb +41 -0
  42. data/lib/nasl/parser/local.rb +1 -1
  43. data/lib/nasl/parser/lvalue.rb +1 -1
  44. data/lib/nasl/parser/node.rb +2 -2
  45. data/lib/nasl/parser/parameter.rb +43 -0
  46. data/lib/nasl/parser/reference.rb +41 -0
  47. data/lib/nasl/parser/repeat.rb +1 -1
  48. data/lib/nasl/parser/repetition.rb +1 -1
  49. data/lib/nasl/parser/return.rb +2 -2
  50. data/lib/nasl/parser/string.rb +7 -2
  51. data/lib/nasl/parser/tree.rb +2 -2
  52. data/lib/nasl/parser/undefined.rb +2 -2
  53. data/lib/nasl/parser/while.rb +1 -1
  54. data/lib/nasl/test.rb +1 -1
  55. data/lib/nasl/token.rb +2 -2
  56. data/lib/nasl/tokenizer.rb +7 -4
  57. data/lib/nasl/version.rb +27 -1
  58. data/nasl.gemspec +35 -8
  59. data/test/unit/parser/test_array.rb +174 -0
  60. data/test/unit/parser/test_assignment.rb +75 -4
  61. data/test/unit/parser/test_blank.rb +1 -1
  62. data/test/unit/parser/test_block.rb +29 -1
  63. data/test/unit/parser/test_call.rb +57 -5
  64. data/test/unit/parser/test_comment.rb +1 -1
  65. data/test/unit/parser/test_constant.rb +1 -1
  66. data/test/unit/parser/test_empty.rb +1 -1
  67. data/test/unit/parser/test_expressions.rb +8 -1
  68. data/test/unit/parser/test_foreach.rb +43 -0
  69. data/test/unit/parser/test_function.rb +147 -51
  70. data/test/unit/parser/test_global.rb +49 -0
  71. data/test/unit/parser/test_if.rb +3 -3
  72. data/test/unit/parser/test_include.rb +1 -1
  73. data/test/unit/parser/test_incr_decr.rb +1 -1
  74. data/test/unit/parser/test_ip.rb +1 -1
  75. data/test/unit/parser/test_list.rb +42 -0
  76. data/test/unit/parser/test_local.rb +49 -0
  77. data/test/unit/parser/test_return.rb +7 -3
  78. data/test/unit/parser/test_string.rb +1 -1
  79. data/test/unit/parser/test_whitespace.rb +1 -1
  80. data/test/unit/test_context.rb +1 -1
  81. data/test/unit/tokenizer/test_comment.rb +1 -1
  82. data/test/unit/tokenizer/test_empty.rb +1 -1
  83. data/test/unit/tokenizer/test_integer.rb +1 -1
  84. data/test/unit/tokenizer/test_references.rb +41 -0
  85. data/test/unit/tokenizer/test_string.rb +2 -1
  86. metadata +49 -86
@@ -0,0 +1,49 @@
1
+ ################################################################################
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
+ # All rights reserved.
4
+ #
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions are met:
7
+ #
8
+ # 1. Redistributions of source code must retain the above copyright notice, this
9
+ # list of conditions and the following disclaimer.
10
+ #
11
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ # this list of conditions and the following disclaimer in the documentation
13
+ # and/or other materials provided with the distribution.
14
+ #
15
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19
+ # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22
+ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23
+ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
+ ################################################################################
26
+
27
+ class TestGlobal < Test::Unit::TestCase
28
+ include Nasl::Test
29
+
30
+ def test_empty
31
+ fail_parse('global_var;')
32
+ end
33
+
34
+ def test_ident
35
+ pass('global_var a, b, c;')
36
+ end
37
+
38
+ def test_assign_expression
39
+ pass('global_var a = 1, b = 2, c = 3;')
40
+ end
41
+
42
+ def test_assign_reference
43
+ pass('global_var a = @a, b = @b, c = @c;')
44
+ end
45
+
46
+ def test_mixed
47
+ pass('global_var a, b = 2, c = @c;')
48
+ end
49
+ end
@@ -1,5 +1,5 @@
1
1
  ################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -74,12 +74,12 @@ class TestIf < Test::Unit::TestCase
74
74
  # else problem. The else should be attached to the nearest unterminated If.
75
75
  same(
76
76
  %q|if (1) if (1) foo(); else bar();|,
77
- '<tree><if><integer value="1"/><if><integer value="1"/><call><identifier name="foo"/></call><call><identifier name="bar"/></call></if></if></tree>'
77
+ '<tree><if><integer value="1"/><if><integer value="1"/><call><lvalue><identifier name="foo"/></lvalue></call><call><lvalue><identifier name="bar"/></lvalue></call></if></if></tree>'
78
78
  )
79
79
 
80
80
  diff(
81
81
  %q|if (1) if (1) foo(); else bar();|,
82
- '<tree><if><integer value="1"/><if><integer value="1"/><call><identifier name="foo"/></call></if><call><identifier name="bar"/></call></if></tree>'
82
+ '<tree><if><integer value="1"/><if><integer value="1"/><call><lvalue><identifier name="foo"/></lvalue></call></if><call><identifier name="bar"/></call></if></tree>'
83
83
  )
84
84
  end
85
85
  end
@@ -1,5 +1,5 @@
1
1
  ################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
1
  ################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
1
  ################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -0,0 +1,42 @@
1
+ ################################################################################
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
+ # All rights reserved.
4
+ #
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions are met:
7
+ #
8
+ # 1. Redistributions of source code must retain the above copyright notice, this
9
+ # list of conditions and the following disclaimer.
10
+ #
11
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ # this list of conditions and the following disclaimer in the documentation
13
+ # and/or other materials provided with the distribution.
14
+ #
15
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19
+ # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22
+ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23
+ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
+ ################################################################################
26
+
27
+ class TestList < Test::Unit::TestCase
28
+ include Nasl::Test
29
+
30
+ def test_empty
31
+ tree = parse("foo = [];")
32
+ assert_not_nil(tree)
33
+
34
+ lists = tree.all(:List)
35
+ assert_not_nil(lists)
36
+ assert_equal(1, lists.length)
37
+
38
+ list = lists.first
39
+ assert_not_nil(list)
40
+ assert_equal(0, list.elems.length)
41
+ end
42
+ end
@@ -0,0 +1,49 @@
1
+ ################################################################################
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
+ # All rights reserved.
4
+ #
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions are met:
7
+ #
8
+ # 1. Redistributions of source code must retain the above copyright notice, this
9
+ # list of conditions and the following disclaimer.
10
+ #
11
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ # this list of conditions and the following disclaimer in the documentation
13
+ # and/or other materials provided with the distribution.
14
+ #
15
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19
+ # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22
+ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23
+ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
+ ################################################################################
26
+
27
+ class TestLocal < Test::Unit::TestCase
28
+ include Nasl::Test
29
+
30
+ def test_empty
31
+ fail_parse('local_var;')
32
+ end
33
+
34
+ def test_ident
35
+ pass('local_var a, b, c;')
36
+ end
37
+
38
+ def test_assign_expression
39
+ pass('local_var a = 1, b = 2, c = 3;')
40
+ end
41
+
42
+ def test_assign_reference
43
+ pass('local_var a = @a, b = @b, c = @c;')
44
+ end
45
+
46
+ def test_mixed
47
+ pass('local_var a, b = 2, c = @c;')
48
+ end
49
+ end
@@ -1,5 +1,5 @@
1
1
  ################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -30,14 +30,18 @@ class TestReturn < Test::Unit::TestCase
30
30
  def test_blank
31
31
  fail_parse(%q|return()|)
32
32
  fail_parse(%q|return();|)
33
+ fail_parse(%q|return[]|)
33
34
  fail_parse(%q|return{}|)
34
- fail_parse(%q|return{};|)
35
35
  fail_parse(%q|return ()|)
36
36
  fail_parse(%q|return ();|)
37
+ fail_parse(%q|return []|)
37
38
  fail_parse(%q|return {}|)
38
- fail_parse(%q|return {};|)
39
39
 
40
40
  pass(%q|return;|)
41
+ pass(%q|return[];|)
42
+ pass(%q|return [];|)
43
+ pass(%q|return{};|)
44
+ pass(%q|return {};|)
41
45
  end
42
46
 
43
47
  def test_expression
@@ -1,5 +1,5 @@
1
1
  ################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
1
  ################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
1
  ################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
1
  ################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
1
  ################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
1
  ################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -0,0 +1,41 @@
1
+ ################################################################################
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
+ # All rights reserved.
4
+ #
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions are met:
7
+ #
8
+ # 1. Redistributions of source code must retain the above copyright notice, this
9
+ # list of conditions and the following disclaimer.
10
+ #
11
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ # this list of conditions and the following disclaimer in the documentation
13
+ # and/or other materials provided with the distribution.
14
+ #
15
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19
+ # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22
+ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23
+ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
+ ################################################################################
26
+
27
+ class TestTokenizerReferences < Test::Unit::TestCase
28
+ include Nasl::Test
29
+
30
+ def test_function_reference
31
+ tkz = tokenize("@");
32
+ assert_nothing_raised(Nasl::TokenException) { tkz.get_token }
33
+ assert_equal(:AT_SIGN, tkz.reset.get_token.first)
34
+ end
35
+
36
+ def test_variable_reference
37
+ tkz = tokenize("&");
38
+ assert_nothing_raised(Nasl::TokenException) { tkz.get_token }
39
+ assert_equal(:AMPERSAND, tkz.reset.get_token.first)
40
+ end
41
+ end
@@ -1,5 +1,5 @@
1
1
  ################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -24,6 +24,7 @@
24
24
  # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
25
  ################################################################################
26
26
 
27
+
27
28
  class TestTokenizerString < Test::Unit::TestCase
28
29
  include Nasl::Test
29
30
 
metadata CHANGED
@@ -1,132 +1,85 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nasl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
5
- prerelease:
4
+ version: 0.1.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Mak Kolybabi
8
+ - Alex Weber
9
+ - Jacob Hammack
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2012-10-25 00:00:00.000000000 Z
13
+ date: 2014-08-27 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: racc
16
17
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
18
  requirements:
19
- - - ! '>='
19
+ - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: '1.4'
22
22
  type: :development
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
25
  requirements:
27
- - - ! '>='
26
+ - - "~>"
28
27
  - !ruby/object:Gem::Version
29
- version: '0'
28
+ version: '1.4'
30
29
  - !ruby/object:Gem::Dependency
31
30
  name: rake
32
31
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
32
  requirements:
35
- - - ! '>='
33
+ - - "~>"
36
34
  - !ruby/object:Gem::Version
37
- version: '0'
35
+ version: '10.1'
38
36
  type: :development
39
37
  prerelease: false
40
38
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
39
  requirements:
43
- - - ! '>='
40
+ - - "~>"
44
41
  - !ruby/object:Gem::Version
45
- version: '0'
42
+ version: '10.1'
46
43
  - !ruby/object:Gem::Dependency
47
44
  name: builder
48
45
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
46
  requirements:
51
- - - ! '>='
47
+ - - "~>"
52
48
  - !ruby/object:Gem::Version
53
- version: 3.1.4
49
+ version: '3.1'
54
50
  type: :runtime
55
51
  prerelease: false
56
52
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
53
  requirements:
59
- - - ! '>='
54
+ - - "~>"
60
55
  - !ruby/object:Gem::Version
61
- version: 3.1.4
56
+ version: '3.1'
62
57
  - !ruby/object:Gem::Dependency
63
58
  name: rainbow
64
59
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
60
  requirements:
67
- - - ! '>='
61
+ - - "~>"
68
62
  - !ruby/object:Gem::Version
69
- version: '0'
63
+ version: '2.0'
70
64
  type: :runtime
71
65
  prerelease: false
72
66
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
67
  requirements:
75
- - - ! '>='
68
+ - - "~>"
76
69
  - !ruby/object:Gem::Version
77
- version: '0'
78
- description: ! "Installation\n============\n\nGit\n---\n\nInstalling the source from
79
- Git is done as follows:\n\n git clone git://github.com/tenable/nasl.git\n\nGem\n---\n\nInstalling
80
- the package from RubyGems is done as follows:\n\n gem install nasl\n\nUsage\n=====\n\nStandalone\n----------\n\nTo
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*
83
- Benchmark: This benchmarks the time taken to parse the input path(s) over a\n number
84
- of iterations. The number of iterations can be adjusted by the <-i>\n switch.\n\n
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>&lt;</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"
70
+ version: '2.0'
71
+ description: A language parser for the Nessus Attack Scripting Language. Supporting
72
+ NASL v5.2.
122
73
  email:
123
74
  - mak@kolybabi.com
75
+ - aweber@tenble.com
76
+ - jhammack@tenable.com
124
77
  executables:
125
78
  - nasl-parse
126
79
  extensions: []
127
80
  extra_rdoc_files: []
128
81
  files:
129
- - .gitignore
82
+ - ".gitignore"
130
83
  - Gemfile
131
84
  - README.md
132
85
  - Rakefile
@@ -141,8 +94,10 @@ files:
141
94
  - lib/nasl/commands/xml.rb
142
95
  - lib/nasl/context.rb
143
96
  - lib/nasl/grammar.racc
97
+ - lib/nasl/grammar.tab.rb
144
98
  - lib/nasl/parser.rb
145
99
  - lib/nasl/parser/argument.rb
100
+ - lib/nasl/parser/array.rb
146
101
  - lib/nasl/parser/assigment.rb
147
102
  - lib/nasl/parser/block.rb
148
103
  - lib/nasl/parser/break.rb
@@ -164,9 +119,13 @@ files:
164
119
  - lib/nasl/parser/increment.rb
165
120
  - lib/nasl/parser/integer.rb
166
121
  - lib/nasl/parser/ip.rb
122
+ - lib/nasl/parser/key_value_pair.rb
123
+ - lib/nasl/parser/list.rb
167
124
  - lib/nasl/parser/local.rb
168
125
  - lib/nasl/parser/lvalue.rb
169
126
  - lib/nasl/parser/node.rb
127
+ - lib/nasl/parser/parameter.rb
128
+ - lib/nasl/parser/reference.rb
170
129
  - lib/nasl/parser/repeat.rb
171
130
  - lib/nasl/parser/repetition.rb
172
131
  - lib/nasl/parser/return.rb
@@ -180,6 +139,7 @@ files:
180
139
  - lib/nasl/version.rb
181
140
  - nasl.gemspec
182
141
  - test/test_helper.rb
142
+ - test/unit/parser/test_array.rb
183
143
  - test/unit/parser/test_assignment.rb
184
144
  - test/unit/parser/test_blank.rb
185
145
  - test/unit/parser/test_block.rb
@@ -188,11 +148,15 @@ files:
188
148
  - test/unit/parser/test_constant.rb
189
149
  - test/unit/parser/test_empty.rb
190
150
  - test/unit/parser/test_expressions.rb
151
+ - test/unit/parser/test_foreach.rb
191
152
  - test/unit/parser/test_function.rb
153
+ - test/unit/parser/test_global.rb
192
154
  - test/unit/parser/test_if.rb
193
155
  - test/unit/parser/test_include.rb
194
156
  - test/unit/parser/test_incr_decr.rb
195
157
  - test/unit/parser/test_ip.rb
158
+ - test/unit/parser/test_list.rb
159
+ - test/unit/parser/test_local.rb
196
160
  - test/unit/parser/test_return.rb
197
161
  - test/unit/parser/test_string.rb
198
162
  - test/unit/parser/test_whitespace.rb
@@ -200,41 +164,35 @@ files:
200
164
  - test/unit/tokenizer/test_comment.rb
201
165
  - test/unit/tokenizer/test_empty.rb
202
166
  - test/unit/tokenizer/test_integer.rb
167
+ - test/unit/tokenizer/test_references.rb
203
168
  - test/unit/tokenizer/test_string.rb
204
- - lib/nasl/grammar.tab.rb
205
169
  homepage: http://github.com/tenable/nasl
206
170
  licenses:
207
171
  - BSD
172
+ metadata: {}
208
173
  post_install_message:
209
174
  rdoc_options: []
210
175
  require_paths:
211
176
  - lib
212
177
  required_ruby_version: !ruby/object:Gem::Requirement
213
- none: false
214
178
  requirements:
215
- - - ! '>='
179
+ - - ">="
216
180
  - !ruby/object:Gem::Version
217
181
  version: '0'
218
- segments:
219
- - 0
220
- hash: -1487675631773899078
221
182
  required_rubygems_version: !ruby/object:Gem::Requirement
222
- none: false
223
183
  requirements:
224
- - - ! '>='
184
+ - - ">="
225
185
  - !ruby/object:Gem::Version
226
186
  version: '0'
227
- segments:
228
- - 0
229
- hash: -1487675631773899078
230
187
  requirements: []
231
188
  rubyforge_project: nasl
232
- rubygems_version: 1.8.24
189
+ rubygems_version: 2.2.0
233
190
  signing_key:
234
- specification_version: 3
235
- summary: A parser for the Nessus Attack Scripting Language.
191
+ specification_version: 4
192
+ summary: A language parser for the Nessus Attack Scripting Language.
236
193
  test_files:
237
194
  - test/test_helper.rb
195
+ - test/unit/parser/test_array.rb
238
196
  - test/unit/parser/test_assignment.rb
239
197
  - test/unit/parser/test_blank.rb
240
198
  - test/unit/parser/test_block.rb
@@ -243,11 +201,15 @@ test_files:
243
201
  - test/unit/parser/test_constant.rb
244
202
  - test/unit/parser/test_empty.rb
245
203
  - test/unit/parser/test_expressions.rb
204
+ - test/unit/parser/test_foreach.rb
246
205
  - test/unit/parser/test_function.rb
206
+ - test/unit/parser/test_global.rb
247
207
  - test/unit/parser/test_if.rb
248
208
  - test/unit/parser/test_include.rb
249
209
  - test/unit/parser/test_incr_decr.rb
250
210
  - test/unit/parser/test_ip.rb
211
+ - test/unit/parser/test_list.rb
212
+ - test/unit/parser/test_local.rb
251
213
  - test/unit/parser/test_return.rb
252
214
  - test/unit/parser/test_string.rb
253
215
  - test/unit/parser/test_whitespace.rb
@@ -255,4 +217,5 @@ test_files:
255
217
  - test/unit/tokenizer/test_comment.rb
256
218
  - test/unit/tokenizer/test_empty.rb
257
219
  - test/unit/tokenizer/test_integer.rb
220
+ - test/unit/tokenizer/test_references.rb
258
221
  - test/unit/tokenizer/test_string.rb