packetgen-plugin-smb 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/specs.yml +28 -0
- data/.rubocop.yml +6 -0
- data/Gemfile +15 -0
- data/README.md +50 -12
- data/Rakefile +10 -4
- data/lib/packetgen-plugin-smb.rb +2 -2
- data/lib/packetgen/plugin/gssapi.rb +4 -2
- data/lib/packetgen/plugin/llmnr.rb +4 -4
- data/lib/packetgen/plugin/netbios.rb +2 -0
- data/lib/packetgen/plugin/netbios/datagram.rb +3 -3
- data/lib/packetgen/plugin/netbios/name.rb +4 -4
- data/lib/packetgen/plugin/netbios/session.rb +5 -5
- data/lib/packetgen/plugin/ntlm.rb +3 -3
- data/lib/packetgen/plugin/ntlm/authenticate.rb +2 -2
- data/lib/packetgen/plugin/ntlm/av_pair.rb +3 -5
- data/lib/packetgen/plugin/ntlm/challenge.rb +2 -2
- data/lib/packetgen/plugin/ntlm/negotiate.rb +2 -2
- data/lib/packetgen/plugin/ntlm/ntlmv2_response.rb +2 -2
- data/lib/packetgen/plugin/smb.rb +12 -12
- data/lib/packetgen/plugin/smb/blocks.rb +2 -2
- data/lib/packetgen/plugin/smb/browser.rb +2 -2
- data/lib/packetgen/plugin/smb/browser/domain_announcement.rb +2 -2
- data/lib/packetgen/plugin/smb/browser/host_announcement.rb +2 -2
- data/lib/packetgen/plugin/smb/browser/local_master_announcement.rb +2 -2
- data/lib/packetgen/plugin/smb/close.rb +2 -2
- data/lib/packetgen/plugin/smb/close/request.rb +2 -2
- data/lib/packetgen/plugin/smb/close/response.rb +2 -2
- data/lib/packetgen/plugin/smb/filetime.rb +4 -2
- data/lib/packetgen/plugin/smb/negotiate.rb +2 -2
- data/lib/packetgen/plugin/smb/negotiate/dialect.rb +7 -0
- data/lib/packetgen/plugin/smb/negotiate/request.rb +7 -0
- data/lib/packetgen/plugin/smb/negotiate/response.rb +8 -2
- data/lib/packetgen/plugin/smb/nt_create_and_x.rb +2 -2
- data/lib/packetgen/plugin/smb/ntcreateandx/request.rb +4 -4
- data/lib/packetgen/plugin/smb/ntcreateandx/response.rb +2 -2
- data/lib/packetgen/plugin/smb/string.rb +40 -28
- data/lib/packetgen/plugin/smb/trans.rb +2 -2
- data/lib/packetgen/plugin/smb/trans/request.rb +3 -3
- data/lib/packetgen/plugin/smb/trans/response.rb +2 -2
- data/lib/packetgen/plugin/smb2.rb +3 -3
- data/lib/packetgen/plugin/smb2/base.rb +3 -3
- data/lib/packetgen/plugin/smb2/error.rb +3 -4
- data/lib/packetgen/plugin/smb2/guid.rb +4 -3
- data/lib/packetgen/plugin/smb2/negotiate.rb +2 -2
- data/lib/packetgen/plugin/smb2/negotiate/context.rb +3 -3
- data/lib/packetgen/plugin/smb2/negotiate/request.rb +3 -5
- data/lib/packetgen/plugin/smb2/negotiate/response.rb +4 -6
- data/lib/packetgen/plugin/smb2/session_setup.rb +2 -2
- data/lib/packetgen/plugin/smb2/session_setup/request.rb +4 -4
- data/lib/packetgen/plugin/smb2/session_setup/response.rb +5 -5
- data/lib/packetgen/plugin/smb_version.rb +3 -1
- data/packetgen-plugin-smb.gemspec +4 -11
- metadata +6 -82
- data/.travis.yml +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b63382e5580528b23ba059cd370db53203efec6cd6273388f88b15976b9343d
|
4
|
+
data.tar.gz: 425f63395bdc0c38e1288f0690fd8cc51c944645b5fc017e2c6289ba9c54b78d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08a4a6e817ff3ae8c7c341c6af64722fcdf09331767627adf04c36a6f442dcc6ea7dfb21cd76f2ec3c1f9818b5b3e565806b5391d041130c189de9fc89eacaf6'
|
7
|
+
data.tar.gz: b537ad94930b18a5ab93a219a66090384c84f0cfae44426b42304732c0f31e41c9903e9cf8eb41778e82661eb5803d33cdca640104b7a0e5db37df2497320af9
|
@@ -0,0 +1,28 @@
|
|
1
|
+
name: Specs
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
branches: [ master ]
|
5
|
+
pull_request:
|
6
|
+
branches: [ master ]
|
7
|
+
jobs:
|
8
|
+
test:
|
9
|
+
strategy:
|
10
|
+
fail-fast: false
|
11
|
+
matrix:
|
12
|
+
os: [ubuntu-latest]
|
13
|
+
ruby: [2.4, 2.5, 2.6, 2.7]
|
14
|
+
runs-on: ${{ matrix.os }}
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
- name: Install dependencies
|
18
|
+
run: sudo apt-get update -qq && sudo apt-get install libpcap-dev -qq
|
19
|
+
- name: Set up Ruby
|
20
|
+
uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: ${{ matrix.ruby }}
|
23
|
+
- name: Run tests
|
24
|
+
run: |
|
25
|
+
bundle config set path 'vendor/bundle'
|
26
|
+
bundle config set --local without noci
|
27
|
+
bundle install
|
28
|
+
bundle exec rake
|
data/.rubocop.yml
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-performance
|
3
|
+
Layout/LineLength:
|
4
|
+
Max: 150
|
1
5
|
Layout/SpaceAroundEqualsInParameterDefault:
|
2
6
|
EnforcedStyle: no_space
|
3
7
|
Lint/EmptyWhen:
|
@@ -6,6 +10,8 @@ Lint/Void:
|
|
6
10
|
Enabled: false
|
7
11
|
Metrics:
|
8
12
|
Enabled: false
|
13
|
+
Style/AccessModifierDeclarations:
|
14
|
+
Enabled: false
|
9
15
|
Style/AsciiComments:
|
10
16
|
Enabled: false
|
11
17
|
Style/ClassAndModuleChildren:
|
data/Gemfile
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source 'https://rubygems.org'
|
2
4
|
|
3
5
|
gemspec
|
6
|
+
|
7
|
+
gem 'bundler', '>=1.17', '<3'
|
8
|
+
gem 'rake', '~> 12.3'
|
9
|
+
gem 'rspec', '~> 3.10'
|
10
|
+
|
11
|
+
group :noci do
|
12
|
+
gem 'debase', '~>0.2'
|
13
|
+
gem 'rubocop', '~> 1.6.0'
|
14
|
+
gem 'rubocop-performance', '~> 1.9'
|
15
|
+
gem 'ruby-debug-ide', '~> 0.7'
|
16
|
+
gem 'simplecov', '~> 0.18'
|
17
|
+
gem 'yard', '~> 0.9'
|
18
|
+
end
|
data/README.md
CHANGED
@@ -1,23 +1,26 @@
|
|
1
1
|
[![Gem Version](https://badge.fury.io/rb/packetgen-plugin-smb.svg)](https://badge.fury.io/rb/packetgen-plugin-smb)
|
2
|
-
[![Build Status](https://travis-ci.com/sdaubert/packetgen-plugin-smb.svg?branch=master)](https://travis-ci.com/sdaubert/packetgen-plugin-smb)
|
3
2
|
|
4
3
|
# Packetgen::Plugin::SMB
|
5
4
|
|
6
5
|
This is a plugin for [PacketGen gem](https://github.com/sdaubert/packetgen). It adds some support for SMB protocol suite:
|
7
6
|
|
7
|
+
* NetBIOS:
|
8
|
+
* Datagram service,
|
9
|
+
* Session service,
|
8
10
|
* SMB:
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
* SMB common header,
|
12
|
+
* Negotiate command,
|
13
|
+
* Close command,
|
14
|
+
* NtCreateAndX command,
|
15
|
+
* Trans command,
|
16
|
+
* Browser subprotocol,
|
14
17
|
* SMB2:
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
+
* SMB2 common header (support 2.x and 3.x dialects),
|
19
|
+
* Negotiate command,
|
20
|
+
* SessionSetup command,
|
18
21
|
* GSSAPI, used to transport negotiation over SMB2 commands,
|
19
|
-
* NTLM, SMB authentication protocol
|
20
|
-
|
22
|
+
* NTLM, SMB authentication protocol,
|
23
|
+
* LLMNR (_Link-Local Multicast Name Resolution_), resolution protocol used in SMB networks.
|
21
24
|
|
22
25
|
## Installation
|
23
26
|
|
@@ -37,7 +40,42 @@ Or install it yourself as:
|
|
37
40
|
|
38
41
|
## Usage
|
39
42
|
|
40
|
-
|
43
|
+
### SMB2 with NTLM negociation
|
44
|
+
|
45
|
+
See [examples/smb-responder](/examples/smb-responder).
|
46
|
+
|
47
|
+
### LLMNR
|
48
|
+
|
49
|
+
LLMNR is a multicast protocol. Unless you want to have a fine control on UDP layer, the simplest way is to use it over a UDP ruby socket:
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
require 'socket'
|
53
|
+
require 'packetgen'
|
54
|
+
require 'packetgen-plugin-smb'
|
55
|
+
|
56
|
+
LLMNR_MCAST_ADDR = '224.0.0.252'
|
57
|
+
LOCAL_IPADDR = 'x.x.x.x' # your IP
|
58
|
+
|
59
|
+
# Open a UDP socket
|
60
|
+
socket = UDPSocket.new
|
61
|
+
# Bind it to receive LLMNR response packets
|
62
|
+
socket.bind(LOCAL_IPADDR, 0)
|
63
|
+
|
64
|
+
# Send a LLMNR query
|
65
|
+
query = PacketGen.gen('LLMNR', id: 0x1234, opcode: 'query')
|
66
|
+
query.llmnr.qd << { rtype: 'Question', name: 'example.local' }
|
67
|
+
socket.send(query.to_s, 0, LLMNR_MCAST_ADDR, PacketGen::Plugin::LLMNR::UDP_PORT)
|
68
|
+
|
69
|
+
# Get answer
|
70
|
+
# data = socket.recv(1024)
|
71
|
+
data, peer = socket.recvfrom(1024)
|
72
|
+
answer = PacketGen.parse(data, first_header: 'LLMNR')
|
73
|
+
example_local_ip = answer.llmnr.an.to_a
|
74
|
+
.find { |an| an.is_a?(PacketGen::Header::DNS::RR) }.human_rdata
|
75
|
+
puts example_local_ip
|
76
|
+
```
|
77
|
+
|
78
|
+
You have to manage multicast if you want to make a LLMNR responder. For further details, see [examples/llmnr-responder](/examples/llmnr-responder).
|
41
79
|
|
42
80
|
## See also
|
43
81
|
|
data/Rakefile
CHANGED
@@ -1,13 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
3
|
require 'bundler/gem_tasks'
|
3
4
|
require 'rspec/core/rake_task'
|
4
|
-
require 'yard'
|
5
5
|
|
6
6
|
task default: :spec
|
7
7
|
|
8
8
|
RSpec::Core::RakeTask.new
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
begin
|
11
|
+
require 'yard'
|
12
|
+
|
13
|
+
YARD::Rake::YardocTask.new do |t|
|
14
|
+
t.options = ['--no-private']
|
15
|
+
t.files = ['lib/**/*.rb', '-', 'LICENSE']
|
16
|
+
end
|
17
|
+
rescue LoadError
|
18
|
+
# no yard, so no yard task
|
13
19
|
end
|
data/lib/packetgen-plugin-smb.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file is part of packetgen-plugin-smb.
|
2
4
|
# See https://github.com/sdaubert/packetgen-plugin-smb for more informations
|
3
5
|
# Copyright (C) 2018 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
6
|
# This program is published under MIT license.
|
5
7
|
|
6
|
-
# frozen_string_literal: true
|
7
|
-
|
8
8
|
require 'packetgen'
|
9
9
|
require_relative 'packetgen/plugin/smb_version'
|
10
10
|
require_relative 'packetgen/plugin/gssapi'
|
@@ -1,10 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file is part of packetgen-plugin-smb.
|
2
4
|
# See https://github.com/sdaubert/packetgen-plugin-smb for more informations
|
3
5
|
# Copyright (C) 2018 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
6
|
# This program is published under MIT license.
|
5
7
|
|
6
|
-
# frozen_string_literal: true
|
7
|
-
|
8
8
|
require 'rasn1'
|
9
9
|
|
10
10
|
module PacketGen::Plugin
|
@@ -113,6 +113,8 @@ module PacketGen::Plugin
|
|
113
113
|
# @param [String] str
|
114
114
|
# @return [self]
|
115
115
|
def read(str)
|
116
|
+
return self if str.nil?
|
117
|
+
|
116
118
|
parse!(str, ber: true)
|
117
119
|
self
|
118
120
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file is part of packetgen-plugin-smb.
|
2
4
|
# See https://github.com/sdaubert/packetgen-plugin-smb for more informations
|
3
5
|
# Copyright (C) 2018 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
6
|
# This program is published under MIT license.
|
5
7
|
|
6
|
-
# frozen_string_literal: true
|
7
|
-
|
8
8
|
module PacketGen::Plugin
|
9
9
|
# Link-Local Multicast Name Resolution (LLMNR) header ({https://tools.ietf.org/html/rfc4795 RFC 4795}).
|
10
10
|
# @author Sylvain Daubert
|
@@ -43,13 +43,13 @@ module PacketGen::Plugin
|
|
43
43
|
ip.dst = dst unless dst.nil?
|
44
44
|
ip.ttl = 1 if ip[:dst].mcast?
|
45
45
|
|
46
|
-
# rubocop:disable Lint/
|
46
|
+
# rubocop:disable Lint/SuppressedException
|
47
47
|
begin
|
48
48
|
llh = ll_header(self)
|
49
49
|
llh.dst = MAC_IPV4_MCAST if ip[:dst].mcast?
|
50
50
|
rescue PacketGen::FormatError
|
51
51
|
end
|
52
|
-
# rubocop:enable Lint/
|
52
|
+
# rubocop:enable Lint/SuppressedException
|
53
53
|
end
|
54
54
|
end
|
55
55
|
PacketGen::Header.add_class LLMNR
|
@@ -1,15 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file is part of PacketGen
|
2
4
|
# See https://github.com/sdaubert/packetgen-plugin-smb for more informations
|
3
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
6
|
# This program is published under MIT license.
|
5
7
|
|
6
|
-
# frozen_string_literal: true
|
7
|
-
|
8
8
|
module PacketGen::Plugin
|
9
9
|
# Module to group all NetBIOS headers
|
10
10
|
# @author Sylvain Daubert
|
11
11
|
module NetBIOS
|
12
|
-
# NetBIOS
|
12
|
+
# NetBIOS Datagram Service messages.
|
13
13
|
# @author Sylvain Daubert
|
14
14
|
class Datagram < PacketGen::Header::Base
|
15
15
|
# Give protocol name
|
@@ -1,13 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file is part of PacketGen
|
2
4
|
# See https://github.com/sdaubert/packetgen-plugin-smb for more informations
|
3
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
6
|
# This program is published under MIT license.
|
5
7
|
|
6
|
-
# frozen_string_literal: true
|
7
|
-
|
8
8
|
module PacketGen::Plugin
|
9
|
-
|
10
|
-
|
9
|
+
# Module to group all NetBIOS headers
|
10
|
+
# @author Sylvain Daubert
|
11
11
|
module NetBIOS
|
12
12
|
# NetBIOS Name.
|
13
13
|
# @author Sylvain Daubert
|
@@ -1,10 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file is part of PacketGen
|
2
4
|
# See https://github.com/sdaubert/packetgen-plugin-smb for more informations
|
3
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
6
|
# This program is published under MIT license.
|
5
7
|
|
6
|
-
# frozen_string_literal: true
|
7
|
-
|
8
8
|
module PacketGen::Plugin
|
9
9
|
# Module to group all NetBIOS headers
|
10
10
|
# @author Sylvain Daubert
|
@@ -25,12 +25,12 @@ module PacketGen::Plugin
|
|
25
25
|
|
26
26
|
# Session packet types
|
27
27
|
TYPES = {
|
28
|
-
'message'
|
29
|
-
'request'
|
28
|
+
'message' => 0,
|
29
|
+
'request' => 0x81,
|
30
30
|
'positive_response' => 0x82,
|
31
31
|
'negative_response' => 0x83,
|
32
32
|
'retarget_response' => 0x84,
|
33
|
-
'keep_alive'
|
33
|
+
'keep_alive' => 0x85,
|
34
34
|
}.freeze
|
35
35
|
|
36
36
|
# @!attribute type
|
@@ -1,10 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file is part of packetgen-plugin-smb.
|
2
4
|
# See https://github.com/sdaubert/packetgen-plugin-smb for more informations
|
3
5
|
# Copyright (C) 2018 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
6
|
# This program is published under MIT license.
|
5
7
|
|
6
|
-
# frozen_string_literal: true
|
7
|
-
|
8
8
|
module PacketGen::Plugin
|
9
9
|
# Base class for NTLM authentication protocol.
|
10
10
|
# @author Sylvain Daubert
|
@@ -159,7 +159,7 @@ module PacketGen::Plugin
|
|
159
159
|
else
|
160
160
|
type.new(options)
|
161
161
|
end
|
162
|
-
content.read(payload[offset_in_payload, length]) if length
|
162
|
+
content.read(payload[offset_in_payload, length]) if length.positive?
|
163
163
|
send(:"#{name}=", content)
|
164
164
|
end
|
165
165
|
|
@@ -1,10 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file is part of packetgen-plugin-smb.
|
2
4
|
# See https://github.com/sdaubert/packetgen-plugin-smb for more informations
|
3
5
|
# Copyright (C) 2018 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
6
|
# This program is published under MIT license.
|
5
7
|
|
6
|
-
# frozen_string_literal: true
|
7
|
-
|
8
8
|
module PacketGen::Plugin
|
9
9
|
class NTLM
|
10
10
|
# NTLM Challenge message
|
@@ -1,10 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file is part of packetgen-plugin-smb.
|
2
4
|
# See https://github.com/sdaubert/packetgen-plugin-smb for more informations
|
3
5
|
# Copyright (C) 2018 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
6
|
# This program is published under MIT license.
|
5
7
|
|
6
|
-
# frozen_string_literal: true
|
7
|
-
|
8
8
|
module PacketGen::Plugin
|
9
9
|
class NTLM
|
10
10
|
# Known AvPair IDs
|
@@ -64,9 +64,7 @@ module PacketGen::Plugin
|
|
64
64
|
|
65
65
|
# Get unicode property
|
66
66
|
# @return [Boolean]
|
67
|
-
|
68
|
-
@unicode
|
69
|
-
end
|
67
|
+
attr_reader :unicode
|
70
68
|
alias unicode? unicode
|
71
69
|
|
72
70
|
# Set unicode property
|
@@ -1,10 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file is part of packetgen-plugin-smb.
|
2
4
|
# See https://github.com/sdaubert/packetgen-plugin-smb for more informations
|
3
5
|
# Copyright (C) 2018 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
6
|
# This program is published under MIT license.
|
5
7
|
|
6
|
-
# frozen_string_literal: true
|
7
|
-
|
8
8
|
module PacketGen::Plugin
|
9
9
|
class NTLM
|
10
10
|
# NTLM Challenge message
|
@@ -1,10 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file is part of packetgen-plugin-smb.
|
2
4
|
# See https://github.com/sdaubert/packetgen-plugin-smb for more informations
|
3
5
|
# Copyright (C) 2018 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
6
|
# This program is published under MIT license.
|
5
7
|
|
6
|
-
# frozen_string_literal: true
|
7
|
-
|
8
8
|
module PacketGen::Plugin
|
9
9
|
class NTLM
|
10
10
|
# NTLM Negotiate message
|
@@ -1,10 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file is part of packetgen-plugin-smb.
|
2
4
|
# See https://github.com/sdaubert/packetgen-plugin-smb for more informations
|
3
5
|
# Copyright (C) 2018 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
6
|
# This program is published under MIT license.
|
5
7
|
|
6
|
-
# frozen_string_literal: true
|
7
|
-
|
8
8
|
module PacketGen::Plugin
|
9
9
|
class NTLM
|
10
10
|
class Ntlmv2Response < PacketGen::Types::Fields
|
data/lib/packetgen/plugin/smb.rb
CHANGED
@@ -1,26 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file is part of packetgen-plugin-smb.
|
2
4
|
# See https://github.com/sdaubert/packetgen-plugin-smb for more informations
|
3
5
|
# Copyright (C) 2018 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
6
|
# This program is published under MIT license.
|
5
7
|
|
6
|
-
# frozen_string_literal: true
|
7
|
-
|
8
8
|
module PacketGen::Plugin
|
9
9
|
# Server Message Block (SMB) header.
|
10
10
|
# @author Sylvain Daubert
|
11
11
|
class SMB < PacketGen::Header::Base
|
12
12
|
# Known commands
|
13
13
|
COMMANDS = {
|
14
|
-
'delete_dir'
|
15
|
-
'close'
|
16
|
-
'delete'
|
17
|
-
'query_info2'
|
18
|
-
'trans'
|
19
|
-
'echo'
|
20
|
-
'open_and_x'
|
21
|
-
'read_and_x'
|
22
|
-
'write_and_x'
|
23
|
-
'trans2'
|
14
|
+
'delete_dir' => 0x01,
|
15
|
+
'close' => 0x04,
|
16
|
+
'delete' => 0x06,
|
17
|
+
'query_info2' => 0x23,
|
18
|
+
'trans' => 0x25,
|
19
|
+
'echo' => 0x2b,
|
20
|
+
'open_and_x' => 0x2d,
|
21
|
+
'read_and_x' => 0x2e,
|
22
|
+
'write_and_x' => 0x2f,
|
23
|
+
'trans2' => 0x32,
|
24
24
|
'tree_disconnect' => 0x71,
|
25
25
|
'negotiate' => 0x72,
|
26
26
|
'session_setup_and_x' => 0x73,
|