syspy 0.0.21 → 0.0.22
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/syspy +3 -1
- data/lib/tds_package_stream.rb +9 -11
- data/lib/tds_packages/tds_language.rb +7 -6
- data/lib/tds_packages/tds_paramfmt2.rb +2 -2
- metadata +3 -3
data/bin/syspy
CHANGED
@@ -40,8 +40,10 @@ module Syspy
|
|
40
40
|
replaced_statement.gsub!(match,param.to_s)
|
41
41
|
elsif(param.instance_of?(Time))
|
42
42
|
replaced_statement.gsub!(match,"\"#{param.strftime("%Y%m%d %H:%M:%S")}\"")
|
43
|
+
elsif(param.nil?)
|
44
|
+
replaced_statement.gsub!(match,"NULL")
|
43
45
|
else
|
44
|
-
Log.warn(Non replacable parameter: #{match}: #{param.inspect})
|
46
|
+
Log.warn("Non replacable parameter: #{match}: #{param.inspect}")
|
45
47
|
end
|
46
48
|
index += 1
|
47
49
|
}
|
data/lib/tds_package_stream.rb
CHANGED
@@ -4,7 +4,6 @@ require "thread"
|
|
4
4
|
require "bytes"
|
5
5
|
require "tds_types"
|
6
6
|
require "tds_tokens"
|
7
|
-
require "thread"
|
8
7
|
|
9
8
|
module Syspy
|
10
9
|
class TdsPackageStream
|
@@ -16,7 +15,7 @@ module Syspy
|
|
16
15
|
@interface = interface
|
17
16
|
@dst = dst
|
18
17
|
@dst_port = dst_port
|
19
|
-
@
|
18
|
+
@in,@out = IO.pipe()
|
20
19
|
end
|
21
20
|
|
22
21
|
def each_package()
|
@@ -29,7 +28,8 @@ module Syspy
|
|
29
28
|
|
30
29
|
if(content.match(HEADER_REGEXP))
|
31
30
|
payload = content[0..(-2 - HEADER_LENGTH)]
|
32
|
-
@
|
31
|
+
@out.write(payload)
|
32
|
+
@out.flush
|
33
33
|
content = ""
|
34
34
|
end
|
35
35
|
|
@@ -39,21 +39,19 @@ module Syspy
|
|
39
39
|
}
|
40
40
|
|
41
41
|
content = ""
|
42
|
-
|
43
|
-
io = StringIO.new(@packages.shift)
|
44
|
-
byte = Bytes.uint(io)
|
42
|
+
@in.each_byte(){|byte|
|
45
43
|
if(byte == 0x0F)
|
46
|
-
last_packet_indicator = Bytes.uint(
|
47
|
-
length = Bytes.uint16be(
|
44
|
+
last_packet_indicator = Bytes.uint(@in)
|
45
|
+
length = Bytes.uint16be(@in)
|
48
46
|
|
49
47
|
# skip next 4 bytes of the header
|
50
|
-
if(Bytes.uint32be(
|
48
|
+
if(Bytes.uint32be(@in) == 0x00)
|
51
49
|
content << @in.read(length - 8)
|
52
50
|
|
53
51
|
if(last_packet_indicator == 0x1)
|
54
52
|
begin
|
55
|
-
|
56
|
-
package = handle_package(
|
53
|
+
io = StringIO.new(content)
|
54
|
+
package = handle_package(io)
|
57
55
|
yield package if package
|
58
56
|
ensure
|
59
57
|
content = ""
|
@@ -15,12 +15,13 @@ module Syspy
|
|
15
15
|
if(token == TdsTokens::TDS_PARAMFMT || token == TdsTokens::TDS_PARAMFMT2)
|
16
16
|
paramfmt_length = Bytes.uintle(io,TdsTokens.length_field_size(token))
|
17
17
|
if(paramfmt_length < 1000000)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
@tds_paramfmt = TdsTokens.token_class(token).new(io,paramfmt_length)
|
19
|
+
if(@tds_paramfmt.params_count > 0)
|
20
|
+
token = read_uint(io)
|
21
|
+
if(token == TdsTokens::TDS_PARAMS)
|
22
|
+
@tds_params = TdsParams.new(io,@tds_paramfmt)
|
23
|
+
end
|
24
|
+
end
|
24
25
|
else
|
25
26
|
Log.warn("Illegal paramfmt length: #{paramfmt_length}")
|
26
27
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: syspy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.22
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2013-02-15 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bindata
|
16
|
-
requirement: &
|
16
|
+
requirement: &12546580 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *12546580
|
25
25
|
description:
|
26
26
|
email: matthias.balmer@sysinf.ch
|
27
27
|
executables:
|