miketeo / pysmb

pysmb is an experimental SMB/CIFS library written in Python. It implements the client-side SMB/CIFS protocol (SMB1 and SMB2) which allows your Python application to access and transfer files to/from SMB/CIFS shared folders like your Windows file sharing and Samba folders.
Other
341 stars 94 forks source link

NT 4 crypto #30

Closed r4ph43l-GitHub closed 9 years ago

r4ph43l-GitHub commented 9 years ago

With the New samba update i cannot use list_shares any more. Samba CN Show a New Parameter "allow nt4 crypto = yes" does not solve the problem.

miketeo commented 9 years ago

@r4ph43l-GitHub : Can you provide more information on your distro and Samba version?

r4ph43l-GitHub commented 9 years ago

Sure,

Sorry, took a sec - 3:30 am over here..

Clients are running latest pysmb, both, Win7 and Kali Linux distribution running python2.7 affected. Connection to shares looks ok, given the share name, they can be browsed and accessed without errors, only thing not running fine is listShares -

Current Implementation:

[...] def init(self,username, password, client_name, server_name, server_ip, shared_folder=None):

use_ntlm_v2 must be passed as named argument

            self.conn = SMBConnection(username, password, client_name, server_name, use_ntlm_v2 = False)
            self.shared = shared_folder
            assert self.conn.connect(server_ip, 139)

[...] def listShares(self): self.__ServerShares=[] if self.conn: print(self.conn) for dev in self.conn.listShares(): print(dev) if dev.type == SharedDevice.DISK_TREE: self.ServerShares.append(dev.name) return self.ServerShares [...]

// End of Code Snippets //

SAMBA:

288/924MB 0.00 0.01 0.05 1/125 11062root /etc/samba # /usr/bin/smbd -V Version 4.2.0

smb.conf (exctracts):

======================= Global Settings =====================================

[global]

workgroup = NT-Domain-Name or Workgroup-Name

; workgroup = MYGROUP

server string is the equivalent of the NT Description field

server string = uname -n

if you want to automatically load your printer list rather

than setting them up individually then you'll need this

printcap name = /dev/null load printers = no

It should not be necessary to spell out the print system type unless

yours is non-standard. Currently supported print systems include:

bsd, sysv, plp, lprng, aix, hpux, qnx

printing = bsd

disable spoolss = yes

this tells Samba to use a separate log file for each machine

that connects

log file = /var/log/samba/%m.log

Put a capping on the size of the log files (in Kb).

max log size = 50

Security mode. Most people will want user level security. See

security_level.txt for details.

security = user

DNS Proxy - tells Samba whether or not to try to resolve NetBIOS names

via DNS nslookups. The built-in default for versions 1.9.17 is yes,

this has been changed in version 1.9.18 to no.

dns proxy = no

allow nt4 crypto = yes require strong key = no

// End smb.conf_global //

ERROR MESSAGE:

OperationFailure: Failed to list shares: Unable to retrieve shared device list ==================== SMB Message 0 ====================

SMB Header:

Command: 0x03 (SMB2_COM_TREE_CONNECT) Status: 0x00000000 Flags: 0x00 PID: 6252 MID: 3 TID: 0 Data: 36 bytes 0900000048001c005c005c0041004c00410052004d00500049005c004900500043002400

SMB Data Packet (hex):

fe534d42400000000000000003000000000000000000000003000000000000006c1800000000000057cfad4d00000000000000000000000000000000 000000000900000048001c005c005c0041004c00410052004d00500049005c004900500043002400 ==================== SMB Message 1 ====================

SMB Header:

Command: 0x03 (SMB2_COM_TREE_CONNECT) Status: 0x00000000 Flags: 0x01 PID: 6252 MID: 3 TID: 1026590178 Data: 16 bytes 100002000000000000000000a9001f00

SMB Data Packet (hex):

fe534d42400000000000000003000100010000000000000003000000000000006c180000e285303d57cfad4d00000000000000000000000000000000 00000000100002000000000000000000a9001f00 ==================== SMB Message 2 ====================

SMB Header:

Command: 0x05 (SMB2_COM_CREATE) Status: 0x00000000 Flags: 0x00 PID: 6252 MID: 4 TID: 1026590178 Data: 68 bytes 3900000002000000000000000000000000000000000000009f0112000000000007000000010000004000400078000c00000000000000000073007200 7600730076006300

SMB Data Packet (hex):

fe534d42400000000000000005000000000000000000000004000000000000006c180000e285303d57cfad4d00000000000000000000000000000000 000000003900000002000000000000000000000000000000000000009f0112000000000007000000010000004000400078000c000000000000000000 730072007600730076006300 ==================== SMB Message 3 ====================

SMB Header:

Command: 0x05 (SMB2_COM_CREATE) Status: 0x00000000 Flags: 0x01 PID: 6252 MID: 4 TID: 1026590178 Data: 88 bytes 590000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000 000000003de8b73100000000716656fc000000000000000000000000

SMB Data Packet (hex):

fe534d42400000000000000005000100010000000000000004000000000000006c180000e285303d57cfad4d00000000000000000000000000000000 000000005900000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 80000000000000003de8b73100000000716656fc000000000000000000000000 ==================== SMB Message 4 ====================

SMB Header:

Command: 0x09 (SMB2_COM_WRITE) Status: 0x00000000 Flags: 0x00 PID: 6252 MID: 5 TID: 1026590178 Data: 164 bytes 310070007400000000000000000000003de8b73100000000716656fc000000000000000000000000000000000000000005000b031000000074000000 02000000b810b810000000000200000000000100c84f324b7016d30112785a47bf6ee18803000000045d888aeb1cc9119fe808002b10486002000000 01000100c84f324b7016d30112785a47bf6ee188030000002c1cb76c12984045030000000000000001000000

SMB Data Packet (hex):

fe534d42400000000000000009000000000000000000000005000000000000006c180000e285303d57cfad4d00000000000000000000000000000000 00000000310070007400000000000000000000003de8b73100000000716656fc000000000000000000000000000000000000000005000b0310000000 7400000002000000b810b810000000000200000000000100c84f324b7016d30112785a47bf6ee18803000000045d888aeb1cc9119fe808002b104860 0200000001000100c84f324b7016d30112785a47bf6ee188030000002c1cb76c12984045030000000000000001000000 ==================== SMB Message 5 ====================

SMB Header:

Command: 0x09 (SMB2_COM_WRITE) Status: 0x00000000 Flags: 0x01 PID: 6252 MID: 5 TID: 1026590178 Data: 16 bytes 11000000740000000000000000000000

SMB Data Packet (hex):

fe534d42400000000000000009000100010000000000000005000000000000006c180000e285303d57cfad4d00000000000000000000000000000000 0000000011000000740000000000000000000000 ==================== SMB Message 6 ====================

SMB Header:

Command: 0x08 (SMB2_COM_READ) Status: 0x00000000 Flags: 0x00 PID: 6252 MID: 6 TID: 1026590178 Data: 49 bytes 310000000004000000000000000000003de8b73100000000716656fc000000000000000000000000000000000000000000

SMB Data Packet (hex):

fe534d42400000000000000008000000000000000000000006000000000000006c180000e285303d57cfad4d00000000000000000000000000000000 00000000310000000004000000000000000000003de8b73100000000716656fc000000000000000000000000000000000000000000 ==================== SMB Message 7 ====================

SMB Header:

Command: 0x08 (SMB2_COM_READ) Status: 0x00000000 Flags: 0x01 PID: 6252 MID: 6 TID: 1026590178 Data: 84 bytes 1100500044000000000000000000000005000c03100000004400000002000000b810b810f05300000d005c504950455c737276737663000001000000 00000000045d888aeb1cc9119fe808002b10486002000000

SMB Data Packet (hex):

fe534d42400000000000000008000100010000000000000006000000000000006c180000e285303d57cfad4d00000000000000000000000000000000 000000001100500044000000000000000000000005000c03100000004400000002000000b810b810f05300000d005c504950455c7372767376630000 0100000000000000045d888aeb1cc9119fe808002b10486002000000 ==================== SMB Message 8 ====================

SMB Header:

Command: 0x0B (SMB2_COM_IOCTL) Status: 0x00000000 Flags: 0x00 PID: 6252 MID: 7 TID: 1026590178 Data: 148 bytes 3900000017c011003de8b73100000000716656fc00000000780000005c00000000000000000000000000000004200000010000000000000005000003 100000005c000000030000004c00000000000f00000002000a000000000000000a0000005c005c0041004c00410052004d0050004900000001000000 01000000040002000000000000000000ffffffff0800020000000000

SMB Data Packet (hex):

fe534d4240000000000000000b000000000000000000000007000000000000006c180000e285303d57cfad4d00000000000000000000000000000000 000000003900000017c011003de8b73100000000716656fc00000000780000005c000000000000000000000000000000042000000100000000000000 05000003100000005c000000030000004c00000000000f00000002000a000000000000000a0000005c005c0041004c00410052004d00500049000000 0100000001000000040002000000000000000000ffffffff0800020000000000 ==================== SMB Message 9 ====================

SMB Header:

Command: 0x0B (SMB2_COM_IOCTL) Status: 0x00000103 Flags: 0x03 PID: 0 MID: 7 TID: 0 Data: 9 bytes 090000000000000021

SMB Data Packet (hex):

fe534d4240000000030100000b00010003000000000000000700000000000000070000000000000057cfad4d00000000000000000000000000000000 00000000090000000000000021 ==================== SMB Message 10 ====================

SMB Header:

Command: 0x06 (SMB2_COM_CLOSE) Status: 0x00000000 Flags: 0x00 PID: 6252 MID: 8 TID: 0 Data: 24 bytes 18000000000000003de8b73100000000716656fc00000000

SMB Data Packet (hex):

fe534d42400000000000000006000000000000000000000008000000000000006c1800000000000057cfad4d00000000000000000000000000000000 0000000018000000000000003de8b73100000000716656fc00000000

r4ph43l-GitHub commented 9 years ago

Sry, just recognized - Samba Server is running on

3.18.10-1-ARCH #1 SMP PREEMPT Wed Mar 25 20:03:15 MDT 2015 armv7l GNU/Linux

r4ph43l-GitHub commented 9 years ago

Anything left you would need?

miketeo commented 9 years ago

Fixed in pysmb 1.1.16

r4ph43l-GitHub commented 9 years ago

Thx a lot.

On 10.05.2015 08:58, Michael Teo wrote:


Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft. http://www.avast.com