firescan 0.07 → 0.08

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,4 @@
1
+ #--
1
2
  # Firebind -- Path Scan Client Software
2
3
  # Copyright (C) 2013 Firebind Inc. All rights reserved.
3
4
  # Authors - Jay Houghton
@@ -13,6 +14,7 @@
13
14
  # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
15
  # License for the specific language governing permissions and limitations under
15
16
  # the License.
17
+ #++
16
18
 
17
19
  module Firebind
18
20
 
@@ -1,3 +1,4 @@
1
+ #--
1
2
  # Firebind -- Path Scan Client Software
2
3
  # Copyright (C) 2013 Firebind Inc. All rights reserved.
3
4
  # Authors - Jay Houghton
@@ -13,6 +14,7 @@
13
14
  # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
15
  # License for the specific language governing permissions and limitations under
15
16
  # the License.
17
+ #++
16
18
 
17
19
  require 'net/http'
18
20
  require 'uri'
@@ -35,12 +37,14 @@ module Firebind
35
37
  include Observable
36
38
  include Tools
37
39
 
40
+ attr_accessor :tag
41
+
38
42
  # Create a new Scan
39
43
  #
40
44
  #--
41
45
  # @param [Object] command_server
42
46
  # @param [Object] ports
43
- def initialize (command_server, ports, transport, timeout=5000, protocol=:SimpleProtocol, username=NIL, password=NIL)
47
+ def initialize (command_server, ports, transport, timeout=5000, protocol=:SimpleProtocol, username=nil, password=nil, tag=nil)
44
48
  @command_server = command_server
45
49
  @portspec = Firebind::Portspec.new(ports)
46
50
  @timeout = timeout
@@ -48,6 +52,7 @@ module Firebind
48
52
  @username = username
49
53
  @password = password
50
54
  @transport = transport
55
+ @tag = tag
51
56
  @done = false
52
57
  @state = ScanState.new(command_server,protocol,transport,@portspec,timeout)
53
58
 
@@ -136,13 +141,14 @@ module Firebind
136
141
 
137
142
  end
138
143
 
144
+ @state.on_scan_complete($client_scan_completed)
145
+
139
146
  api_update
140
147
 
141
- if @portspec.size == @state.ports_scanned
142
- @state.on_scan_complete($client_scan_completed)
143
- changed
144
- notify_observers(@state)
145
- end
148
+ #if @portspec.size == @state.ports_scanned
149
+ changed
150
+ notify_observers(@state)
151
+
146
152
 
147
153
  #update
148
154
  @state
@@ -182,13 +188,13 @@ module Firebind
182
188
  request = Net::HTTP::Post.new(uri.request_uri)
183
189
  request.basic_auth(@username, @password)
184
190
 
185
- transport_proto = if @transport == :UDP then 'udp' else 'tcp' end
191
+ transport_proto = if @transport == :UDP then 'UDP' else 'TCP' end
186
192
 
187
- data = {portSpec:@portspec.to_s,protocol:transport_proto}
193
+ data = {portSpec:@portspec.to_s,transport:transport_proto,scanTimeout:@timeout,tag:@tag}
188
194
  request.body = data.to_json
189
195
 
190
196
  #noinspection RubyStringKeysInHashInspection
191
- #request.set_form_data({'portSpec' => @portspec.to_s, 'protocol' => 'TCP'})
197
+ #request.set_form_data({'portSpec' => @portspec.to_s, 'transport' => 'TCP'})
192
198
 
193
199
  begin
194
200
  response = http.request(request)
@@ -265,12 +271,18 @@ module Firebind
265
271
  data << { guid:@state.guid, serverId:@state.echo_server, portSpec:ps.to_s, statusCode:code, status:status}
266
272
  end
267
273
 
274
+ debug(@state.to_s)
268
275
  test_status = if @state.current_state == :SCAN_COMPLETE then 'Success' else 'Failed' end
269
276
 
270
277
  #build json payload with results
271
278
  report = { clientReport: { guid:@state.guid, serverId:@state.echo_server, testStatus:test_status, uid:@username},
272
279
  clientReportData: data }
273
- #jj report
280
+
281
+ if $debug
282
+ debug('Scan update composed:')
283
+ jj report
284
+ end
285
+
274
286
  json = report.to_json
275
287
  request.body = json
276
288
 
@@ -1,3 +1,4 @@
1
+ #--
1
2
  # Firebind -- Path Scan Client Software
2
3
  # Copyright (C) 2013 Firebind Inc. All rights reserved.
3
4
  # Authors - Jay Houghton
@@ -13,6 +14,7 @@
13
14
  # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
15
  # License for the specific language governing permissions and limitations under
15
16
  # the License.
17
+ #++
16
18
 
17
19
  module Firebind
18
20
  class ScanError < IOError
@@ -1,3 +1,4 @@
1
+ #--
1
2
  # Firebind -- Path Scan Client Software
2
3
  # Copyright (C) 2013 Firebind Inc. All rights reserved.
3
4
  # Authors - Jay Houghton
@@ -13,6 +14,7 @@
13
14
  # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
15
  # License for the specific language governing permissions and limitations under
15
16
  # the License.
17
+ #++
16
18
 
17
19
  require_relative 'tools'
18
20
  module Firebind
@@ -43,13 +45,13 @@ module Firebind
43
45
  @transport = transport
44
46
  @portspec = portspec
45
47
  @timeout = timeout
46
- @guid = NIL
47
- @echo_server = NIL
48
+ @guid = nil
49
+ @echo_server = nil
48
50
  @port = 0
49
51
  @last_duration = 0
50
52
  @ports_scanned = 0
51
53
  @result_map = Hash.new {|hash,key| hash[key]=[]} # block form
52
- @message = NIL
54
+ @message = nil
53
55
  end
54
56
 
55
57
  def to_s
@@ -1,3 +1,4 @@
1
+ #--
1
2
  # Firebind -- Path Scan Client Software
2
3
  # Copyright (C) 2013 Firebind Inc. All rights reserved.
3
4
  # Authors - Jay Houghton
@@ -13,6 +14,7 @@
13
14
  # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
15
  # License for the specific language governing permissions and limitations under
15
16
  # the License.
17
+ #++
16
18
 
17
19
  require_relative 'tcp_transport'
18
20
  require_relative 'udp_transport'
@@ -27,7 +29,7 @@ module Firebind
27
29
  include Tools
28
30
 
29
31
  # @param [Object] transport
30
- def initialize(guid,echo_host,transport,timeout,state=NIL)
32
+ def initialize(guid,echo_host,transport,timeout,state=nil)
31
33
  @guid = guid
32
34
  @echo_host = echo_host
33
35
  @state = state
@@ -1,3 +1,4 @@
1
+ #--
1
2
  # Firebind -- Path Scan Client Software
2
3
  # Copyright (C) 2013 Firebind Inc. All rights reserved.
3
4
  # Authors - Jay Houghton
@@ -13,6 +14,7 @@
13
14
  # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
15
  # License for the specific language governing permissions and limitations under
15
16
  # the License.
17
+ #++
16
18
 
17
19
  require_relative 'transport'
18
20
  require_relative 'tools'
@@ -51,9 +53,9 @@ module Firebind
51
53
  readables,writables,errors = IO.select([@socket], [@socket], [@socket], @timeout_seconds)
52
54
  debug "readables=#{readables} writables=#{writables} errors=#{errors}"
53
55
 
54
- readable = readables != NIL && readables.length > 0
55
- writable = writables != NIL && writables.length > 0
56
- error = errors != NIL && errors.length > 0
56
+ readable = readables != nil && readables.length > 0
57
+ writable = writables != nil && writables.length > 0
58
+ error = errors != nil && errors.length > 0
57
59
 
58
60
  if error
59
61
  raise Firebind::ScanError.new(:HANDSHAKE_CONNECTION_REFUSED)
@@ -1,3 +1,4 @@
1
+ #--
1
2
  # Firebind -- Path Scan Client Software
2
3
  # Copyright (C) 2013 Firebind Inc. All rights reserved.
3
4
  # Authors - Jay Houghton
@@ -13,6 +14,7 @@
13
14
  # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
15
  # License for the specific language governing permissions and limitations under
15
16
  # the License.
17
+ #++
16
18
 
17
19
  # Utility module for translating socket and result codes.
18
20
  module Tools
@@ -1,3 +1,4 @@
1
+ #--
1
2
  # Firebind -- Path Scan Client Software
2
3
  # Copyright (C) 2013 Firebind Inc. All rights reserved.
3
4
  # Authors - Jay Houghton
@@ -13,6 +14,7 @@
13
14
  # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
15
  # License for the specific language governing permissions and limitations under
15
16
  # the License.
17
+ #++
16
18
 
17
19
  require_relative 'tools'
18
20
  require 'socket'
@@ -1,3 +1,4 @@
1
+ #--
1
2
  # Firebind -- Path Scan Client Software
2
3
  # Copyright (C) 2013 Firebind Inc. All rights reserved.
3
4
  # Authors - Jay Houghton
@@ -13,6 +14,7 @@
13
14
  # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
15
  # License for the specific language governing permissions and limitations under
15
16
  # the License.
17
+ #++
16
18
 
17
19
  require_relative 'transport'
18
20
  require_relative 'tools'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: firescan
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.07'
4
+ version: '0.08'
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: 2013-12-02 00:00:00.000000000 Z
12
+ date: 2014-01-10 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! "firescan-ruby\n=============\n\nRuby reference implementation for
15
15
  the Firebind Firescan path scan client This code has been tested to work\nwith Ruby
@@ -31,7 +31,6 @@ executables:
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
- - build
35
34
  - LICENSE.txt
36
35
  - test/portspec_test.rb
37
36
  - test/runner.rb
@@ -78,7 +77,6 @@ files:
78
77
  - doc/LICENSE_txt.html
79
78
  - doc/Example.html
80
79
  - doc/Runner.html
81
- - doc/build.html
82
80
  - doc/Firebind/SimpleProtocol.html
83
81
  - doc/Firebind/Portspec.html
84
82
  - doc/Firebind/Transport.html
data/build DELETED
@@ -1,7 +0,0 @@
1
- #!/bin/bash
2
- rm *.gem
3
- rm -rf doc
4
- rdoc
5
- gem uninstall -x firescan
6
- gem build firescan.gemspec
7
- gem install firescan-*.gem
@@ -1,125 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
-
7
- <title>build - RDoc Documentation</title>
8
-
9
- <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
10
-
11
- <script type="text/javascript">
12
- var rdoc_rel_prefix = "./";
13
- </script>
14
-
15
- <script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
16
- <script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
17
- <script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
18
- <script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
19
- <script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
20
- <script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
21
-
22
-
23
- <body class="file">
24
- <nav id="metadata">
25
- <nav id="home-section" class="section">
26
- <h3 class="section-header">
27
- <a href="./index.html">Home</a>
28
- <a href="./table_of_contents.html#classes">Classes</a>
29
- <a href="./table_of_contents.html#methods">Methods</a>
30
- </h3>
31
- </nav>
32
-
33
-
34
- <nav id="search-section" class="section project-section" class="initially-hidden">
35
- <form action="#" method="get" accept-charset="utf-8">
36
- <h3 class="section-header">
37
- <input type="text" name="search" placeholder="Search" id="search-field"
38
- title="Type to search, Up and Down to navigate, Enter to load">
39
- </h3>
40
- </form>
41
-
42
- <ul id="search-results" class="initially-hidden"></ul>
43
- </nav>
44
-
45
-
46
-
47
-
48
- <div id="project-metadata">
49
- <nav id="fileindex-section" class="section project-section">
50
- <h3 class="section-header">Pages</h3>
51
-
52
- <ul>
53
-
54
- <li class="file"><a href="./LICENSE_txt.html">LICENSE</a>
55
-
56
- <li class="file"><a href="./README_txt.html">README</a>
57
-
58
- <li class="file"><a href="./USAGE_txt.html">USAGE</a>
59
-
60
- <li class="file"><a href="./VERSION_txt.html">VERSION</a>
61
-
62
- <li class="file"><a href="./build.html">build</a>
63
-
64
- <li class="file"><a href="./doc/created_rid.html">created.rid</a>
65
-
66
- <li class="file"><a href="./firescan_gemspec.html">firescan.gemspec</a>
67
-
68
- </ul>
69
- </nav>
70
-
71
- <nav id="classindex-section" class="section project-section">
72
- <h3 class="section-header">Class and Module Index</h3>
73
-
74
- <ul class="link-list">
75
-
76
- <li><a href="./Example.html">Example</a>
77
-
78
- <li><a href="./Firebind.html">Firebind</a>
79
-
80
- <li><a href="./Firebind/Client.html">Firebind::Client</a>
81
-
82
- <li><a href="./Firebind/Portspec.html">Firebind::Portspec</a>
83
-
84
- <li><a href="./Firebind/Scan.html">Firebind::Scan</a>
85
-
86
- <li><a href="./Firebind/ScanError.html">Firebind::ScanError</a>
87
-
88
- <li><a href="./Firebind/ScanState.html">Firebind::ScanState</a>
89
-
90
- <li><a href="./Firebind/SimpleProtocol.html">Firebind::SimpleProtocol</a>
91
-
92
- <li><a href="./Firebind/TcpTransport.html">Firebind::TcpTransport</a>
93
-
94
- <li><a href="./Firebind/Transport.html">Firebind::Transport</a>
95
-
96
- <li><a href="./Firebind/UdpTransport.html">Firebind::UdpTransport</a>
97
-
98
- <li><a href="./Runner.html">Runner</a>
99
-
100
- <li><a href="./TestPortspec.html">TestPortspec</a>
101
-
102
- <li><a href="./Tools.html">Tools</a>
103
-
104
- </ul>
105
- </nav>
106
-
107
- </div>
108
- </nav>
109
-
110
- <div id="documentation" class="description">
111
-
112
- <p>#!/bin/bash rm *.gem rm -rf doc rdoc gem uninstall -x firescan gem build <a
113
- href="firescan_gemspec.html">firescan.gemspec</a> gem install
114
- firescan-*.gem</p>
115
-
116
- </div>
117
-
118
-
119
-
120
- <footer id="validator-badges">
121
- <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
122
- <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 4.0.1.
123
- <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
124
- </footer>
125
-