Comments (4)
Can you either provide a Wireshark capture of the SMB exchange for that command or run the following and share smbprotocol.log
import logging
import smbclient
file_log = logging.FileHandler('smbprotocol.log')
file_log.setLevel(logging.DEBUG)
file_log.setFormatter(logging.Formatter('%(asctime)s - %(name)s - %(message)s'))
for name in ['smbprotocol', 'spnego']:
logger = logging.getLogger(name)
logger.setLevel(logging.DEBUG)
logger.addHandler(file_log)
smbclient.register_session("100.100.180.140", username="USER", password="PASS")
This should give me some more info as to why and where it's failing with STATUS_MORE_PROCESSING_REQUIRED
. For the session setup this should be expected when using NTLM auth but as long as it's handled accordingly it is handled fine. Can you also share what version of smbprotocol
you have installed?
from smbprotocol.
I have this issue
[root@localhost ~]# cat smbprotocol.log
2020-11-29 19:51:19,016 - smbprotocol.connection - Initialising connection, guid: 2f4e7931-c029-41bf-ac70-3e490917239b, require_singing: True, server_name: 192.168.35.101, port: 445
2020-11-29 19:51:19,016 - smbprotocol.connection - Setting up transport connection
2020-11-29 19:51:19,016 - smbprotocol.connection - Starting negotiation with SMB server
2020-11-29 19:51:19,017 - smbprotocol.connection - Negotiating with SMB2 protocol with highest client dialect of: SMB_3_1_1
2020-11-29 19:51:19,017 - smbprotocol.connection - Adding client guid 2f4e7931-c029-41bf-ac70-3e490917239b to negotiate request
2020-11-29 19:51:19,017 - smbprotocol.connection - Adding client capabilities 69 to negotiate request
2020-11-29 19:51:19,017 - smbprotocol.connection - Adding preauth integrity capabilities of hash SHA512 and salt b'wT\xf0\x12*p\xcb\x8ee\xc3\x15\xa2\x92&\x9c\xe4\xd8}\xa2\xae\x95\xabd\xd4\xf7u\x98\xc6\xf5\x1e\xdc\xc8' to negotiate request
2020-11-29 19:51:19,017 - smbprotocol.connection - Adding encryption capabilities of AES128 GCM and AES128 CCM to negotiate request
2020-11-29 19:51:19,018 - smbprotocol.connection - Sending SMB2 Negotiate message
2020-11-29 19:51:19,018 - smbprotocol.connection - SMB3NegotiateRequest:
structure_size = 36
dialect_count = 5
security_mode = (2) SMB2_NEGOTIATE_SIGNING_REQUIRED
reserved = 0
capabilities = (69) SMB2_GLOBAL_CAP_DFS, SMB2_GLOBAL_CAP_ENCRYPTION, SMB2_GLOBAL_CAP_LARGE_MTU
client_guid = 2f4e7931-c029-41bf-ac70-3e490917239b
negotiate_context_offset = 112
negotiate_context_count = 2
reserved2 = 0
dialects = [
(514) SMB_2_0_2,
(528) SMB_2_1_0,
(768) SMB_3_0_0,
(770) SMB_3_0_2,
(785) SMB_3_1_1
]
padding = 00 00
negotiate_context_list = [
SMB2NegotiateContextRequest:
context_type = (1) SMB2_PREAUTH_INTEGRITY_CAPABILITIES
data_length = 38
reserved = 0
data =
SMB2PreauthIntegrityCapabilities:
hash_algorithm_count = 1
salt_length = 32
hash_algorithms = [
(1) SHA_512
]
salt = 77 54 F0 12 2A 70 CB 8E 65 C3 15 A2 92 26 9C E4 D8 7D A2 AE 95 AB 64 D4 F7 75 98 C6 F5 1E DC C8
Raw Hex:
01 00 20 00 01 00 77 54
F0 12 2A 70 CB 8E 65 C3
15 A2 92 26 9C E4 D8 7D
A2 AE 95 AB 64 D4 F7 75
98 C6 F5 1E DC C8
padding = 00 00
Raw Hex:
01 00 26 00 00 00 00 00
01 00 20 00 01 00 77 54
F0 12 2A 70 CB 8E 65 C3
15 A2 92 26 9C E4 D8 7D
A2 AE 95 AB 64 D4 F7 75
98 C6 F5 1E DC C8 00 00,
SMB2NegotiateContextRequest:
context_type = (2) SMB2_ENCRYPTION_CAPABILITIES
data_length = 6
reserved = 0
data =
SMB2EncryptionCapabilities:
cipher_count = 2
ciphers = [
(2) AES_128_GCM,
(1) AES_128_CCM
]
Raw Hex:
02 00 02 00 01 00
padding =
Raw Hex:
02 00 06 00 00 00 00 00
02 00 02 00 01 00
]
Raw Hex:
24 00 05 00 02 00 00 00
45 00 00 00 2F 4E 79 31
C0 29 41 BF AC 70 3E 49
09 17 23 9B 70 00 00 00
02 00 00 00 02 02 10 02
00 03 02 03 11 03 00 00
01 00 26 00 00 00 00 00
01 00 20 00 01 00 77 54
F0 12 2A 70 CB 8E 65 C3
15 A2 92 26 9C E4 D8 7D
A2 AE 95 AB 64 D4 F7 75
98 C6 F5 1E DC C8 00 00
02 00 06 00 00 00 00 00
02 00 02 00 01 00
2020-11-29 19:51:19,021 - smbprotocol.transport - Connecting to DirectTcp socket
2020-11-29 19:51:19,028 - smbprotocol.connection - Receiving SMB2 Negotiate response
2020-11-29 19:51:19,028 - smbprotocol.connection - SMB2HeaderResponse:
protocol_id = FE 53 4D 42
structure_size = 64
credit_charge = 0
status = (0) STATUS_SUCCESS
command = (0) SMB2_NEGOTIATE
credit_response = 1
flags = (1) SMB2_FLAGS_SERVER_TO_REDIR
next_command = 0
message_id = 0
reserved = 0
tree_id = 0
session_id = 0
signature = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
data = 41 00 01 00 11 03 02 00 B7 8A 9C AE 3E FD 4F 46 A1 92 7D 78 54 AA EE E0 17 00 00 00 00 00 01 00 00 00 10 00 00 00 10 00 56 9C 8E 58 78 C6 D6 01 76 4A 95 F9 5C C6 D6 01 80 00 7A 00 00 01 00 00 60 82 00 76 06 82 00 06 2B 06 01 05 05 02 A0 82 00 68 30 82 00 64 A0 82 00 2C 30 82 00 28 06 82 00 09 2A 86 48 82 F7 12 01 02 02 06 82 00 09 2A 86 48 86 F7 12 01 02 02 06 82 00 0A 2B 06 01 04 01 82 37 02 02 0A A3 82 00 30 30 82 00 2C A0 82 00 28 1B 82 00 24 6E 6F 74 5F 64 65 66 69 6E 65 64 5F 69 6E 5F 52 46 43 34 31 37 38 40 70 6C 65 61 73 65 5F 69 67 6E 6F 72 65 00 00 00 00 00 00 01 00 26 00 00 00 00 00 01 00 20 00 01 00 3D 53 B5 2F 64 3D 68 CC DB 10 E7 3D 67 3E 07 AF 97 23 F6 44 73 1F C2 C9 D8 20 4E 6D 68 86 52 BE 00 00 02 00 04 00 00 00 00 00 01 00 02 00
Raw Hex:
FE 53 4D 42 40 00 00 00
00 00 00 00 00 00 01 00
01 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
41 00 01 00 11 03 02 00
B7 8A 9C AE 3E FD 4F 46
A1 92 7D 78 54 AA EE E0
17 00 00 00 00 00 01 00
00 00 10 00 00 00 10 00
56 9C 8E 58 78 C6 D6 01
76 4A 95 F9 5C C6 D6 01
80 00 7A 00 00 01 00 00
60 82 00 76 06 82 00 06
2B 06 01 05 05 02 A0 82
00 68 30 82 00 64 A0 82
00 2C 30 82 00 28 06 82
00 09 2A 86 48 82 F7 12
01 02 02 06 82 00 09 2A
86 48 86 F7 12 01 02 02
06 82 00 0A 2B 06 01 04
01 82 37 02 02 0A A3 82
00 30 30 82 00 2C A0 82
00 28 1B 82 00 24 6E 6F
74 5F 64 65 66 69 6E 65
64 5F 69 6E 5F 52 46 43
34 31 37 38 40 70 6C 65
61 73 65 5F 69 67 6E 6F
72 65 00 00 00 00 00 00
01 00 26 00 00 00 00 00
01 00 20 00 01 00 3D 53
B5 2F 64 3D 68 CC DB 10
E7 3D 67 3E 07 AF 97 23
F6 44 73 1F C2 C9 D8 20
4E 6D 68 86 52 BE 00 00
02 00 04 00 00 00 00 00
01 00 02 00
2020-11-29 19:51:19,030 - smbprotocol.connection - Negotiated dialect: (785) SMB_3_1_1
2020-11-29 19:51:19,030 - smbprotocol.connection - Connection require signing: True
2020-11-29 19:51:19,031 - smbprotocol.session - Initialising session with username: nati.com\Administrator
2020-11-29 19:51:19,031 - smbprotocol.session - Decoding SPNEGO token containing supported auth mechanisms
2020-11-29 19:51:19,031 - spnego.negotiate - SPNEGO step input: YIIAdgaCAAYrBgEFBQKgggBoMIIAZKCCACwwggAoBoIACSqGSIL3EgECAgaCAAkqhkiG9xIBAgIGggAKKwYBBAGCNwICCqOCADAwggAsoIIAKBuCACRub3RfZGVmaW5lZF9pbl9SRkM0MTc4QHBsZWFzZV9pZ25vcmU=
2020-11-29 19:51:19,035 - spnego.negotiate - SPNEGO step output: YEAGBisGAQUFAqA2MDSgDjAMBgorBgEEAYI3AgIKoiIEIE5UTE1TU1AAAQAAADeCCOAAAAAAIAAAAAAAAAAgAAAA
2020-11-29 19:51:19,036 - smbprotocol.session - Sending SMB2_SESSION_SETUP request message
2020-11-29 19:51:19,036 - smbprotocol.session - Receiving SMB2_SESSION_SETUP response message
2020-11-29 19:51:19,038 - smbprotocol.session - More processing is required for SMB2_SESSION_SETUP
2020-11-29 19:51:19,038 - spnego.negotiate - SPNEGO step input: oYIAuzCCALegggADCgEBoYIADgaCAAorBgEEAYI3AgIKooIAmgSCAJZOVExNU1NQAAIAAAAIAAgAMAAAADWCiWDS/NyLVb0c3AAAAAAAAAAAXgBeADgAAABOAEEAVABJAAEAEABTAFYATQBfAEMASQBGAFMAAgAIAE4AQQBUAEkAAwAiAFMAVgBNAF8AQwBJAEYAUwAuAE4AQQBUAEkALgBDAE8ATQAEABAATgBBAFQASQAuAEMATwBNAAAAAAA=
2020-11-29 19:51:19,041 - spnego.negotiate - SPNEGO step output: oYIBhzCCAYOgAwoBA6KCAWYEggFiTlRMTVNTUAADAAAAGAAYAFAAAADAAMAAaAAAABAAEAAoAQAAGgAaADgBAAAAAAAAUgEAABAAEABSAQAANYKJYN8CvNSq+FXT5GU4KgYpckUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATL19PY02undP+8/gZWKYmAQEAAAAAAABonWcBicbWAYOrwLagDUx8AAAAAAEAEABTAFYATQBfAEMASQBGAFMAAgAIAE4AQQBUAEkAAwAiAFMAVgBNAF8AQwBJAEYAUwAuAE4AQQBUAEkALgBDAE8ATQAEABAATgBBAFQASQAuAEMATwBNAAkAJgBDAEkARgBTAC8AMQA5ADIALgAxADYAOAAuADMANQAuADEAMAAxAAYABAACAAAAAAAAAAAAAABuAGEAdABpAC4AYwBvAG0AQQBkAG0AaQBuAGkAcwB0AHIAYQB0AG8AcgA79Gj/INHB6JB36KrXBfzAoxIEEAEAAACtQLe3503hGAAAAAA=
2020-11-29 19:51:19,041 - smbprotocol.session - Sending SMB2_SESSION_SETUP request message
2020-11-29 19:51:19,042 - smbprotocol.session - Receiving SMB2_SESSION_SETUP response message
2020-11-29 19:51:19,045 - smbprotocol.connection - Disconnecting transport connection
2020-11-29 19:51:19,045 - smbprotocol.transport - Disconnecting DirectTcp socket
from smbprotocol.
What's the traceback from Python that you are getting. Are you also getting STATUS_MORE_PROCESSING_REQUIRED
as based on your log I cannot see how that is happening with the current code. What version of smbprotocol
do you have installed, pip info | grep smbprotocol
.
from smbprotocol.
Closing as I cannot solve the problem without more information.
from smbprotocol.
Related Issues (20)
- How to List Files and Read with Pandas in a Remote Directory HOT 2
- how to load a numpy file on smb HOT 4
- `reset_connection_cache` not deleting on disconnection failure. HOT 1
- standard `kwargs` not supported in `copytree` HOT 5
- Difference between SMBDirEntry._dir_info and .stat() HOT 8
- On disconnectt wait for msg_worker thread to end. HOT 2
- Example/Documentation unclear for low level reading of file size. HOT 6
- Unable to login to Azure drives from linux HOT 1
- Cannot use `share_access="r"` with `smbclient.shutil.copytree()` HOT 10
- smbprotocol.connection.Connection.connect() no longer shows the low-level connection error HOT 5
- Compounded related requests: should TreeId and SessionId be set to 0xff..ff? HOT 3
- SpnegoError when connecting to impacket test server HOT 5
- smbprotocol.transport.Tcp._recv can end up in a dead lock HOT 4
- `listdir` requires server name on its call
- Wrong raw_type when deleting a directory HOT 1
- mkdir -p recursive directory create HOT 2
- Enquiry about exception propagation in `transport.py` HOT 2
- SMBAuthenticationError sometimes HOT 8
- STATUS_LOGON_FAILURE HOT 6
- Unable to get accurate acl from Security Descriptor HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from smbprotocol.