Home

Awesome

About SMBLibrary:

SMBLibrary is an open-source C# SMB 1.0/CIFS, SMB 2.0, SMB 2.1 and SMB 3.0 server and client implementation.
SMBLibrary gives .NET developers an easy way to share a directory / file system / virtual file system, with any operating system that supports the SMB protocol.
SMBLibrary is modular, you can take advantage of Integrated Windows Authentication and the Windows storage subsystem on a Windows host or use independent implementations that allow for cross-platform compatibility.
SMBLibrary shares can be accessed from any Windows version since Windows NT 4.0.

Supported SMB / CIFS transport methods:

• NetBIOS over TCP (port 139)
• Direct TCP hosting (port 445)

'NetBIOS over TCP' and 'Direct TCP hosting' are almost identical, the only differences:

Notes:

By default, Windows already use ports 139 and 445. there are several techniques to free / utilize those ports:

Method 1: Disable Windows File and Printer Sharing server completely:
Windows XP/2003:
  1. For every network adapter: Uncheck 'File and Printer Sharing for Microsoft Networks".
  2. Navigate to 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT\Parameters' and set 'SMBDeviceEnabled' to '0' (this will free port 445).
  3. Reboot.
Windows 7/8/2008/2012:

Disable the "Server" service (p.s. "TCP\IP NETBIOS Helper" should be enabled).

Method 2: Use Windows File Sharing AND SMBLibrary:

Windows bind port 139 to the first IP addres of every adapter, while port 445 is bound globally. This means that if you'll disable port 445 (or block it using a firewall), you'll be able to use a different service on port 139 for every IP address.

Additional Notes:
Windows 7/8/2008/2012:
Method 3: Use an IP address that is invisible to Windows File Sharing:

Using PCap.Net you can programmatically setup a virtual Network adapter and intercept SMB traffic (similar to how a virtual machine operates), You should use the ARP protocol to notify the network about the new IP address, and then process the incoming SMB traffic using SMBLibrary, good luck!

Using SMBLibrary:

Any directory / filesystem / object you wish to share must implement the IFileSystem interface (or the lower-level INTFileStore interface).
You can share anything from actual directories to custom objects, as long as they expose a directory structure.

Client code examples can be found here.

NuGet Packages:

SMBLibrary - Cross-platform server and client implementation.
SMBLibrary.Win32 - Allows utilizing Integrated Windows Authentication and/or the Windows storage subsystem on a Windows host.
SMBLibrary.Adapters - IFileSystem to INTFileStore adapter for SMBLibrary.

Licensing:

A commercial license of SMBLibrary is available for a fee.
This is intended for companies who are unable to use the LGPL version.
Please contact me for additional details.

Contact:

If you have any question, feel free to contact me.
Tal Aloni tal.aloni.il@gmail.com