开发者

Easiest way to implement a SMB redirector for Windows?

I would like to implement a little tool that lets me do on Windows what I can already do easily on any other OS - specify a remote SMB server by both IP address and port. Natively, Windows will not do SMB over any ports othe开发者_C百科r than 445 or 139 (its choice), and I'm sick of playing whack-a-mole with workarounds for the various Bad Things that Microsoft keeps adding to Windows to fsck up tunnelling SMB over SSH port forwarding.

What I have in mind is a little command line app that would let me do something like

netsubst servername -i IP -p PORT

This would work hand in hand with a driver? dll? that hooks into Windows as an SMB redirector, but scans a table of server names set up by netsubst instead of looking them up on the network in order to find out what to connect to. So I'd be able to do

net use X: //servername/sharename /user:username *

in the usual way, except that instead of Windows looking for //servername on ports 445 or 139 of whatever machines it could find, it would go straight to address IP, port PORT; and if IP happened to be 127.0.0.1 and PORT happened to be something forwarded to somewhere else via ssh, it would All Just Work and I would no longer need to deal with the walls of stupid that Windows puts around access to localhost ports 139 and 445.

I figure what I need is something akin to the //vboxsvr guest addition that VirtualBox uses to do host file sharing, but probably rather simpler since it wouldn't need a full back end - in my ideal world, the only Windows functionality I'd need to replace is the part that establishes the initial connection to the remote SMB server. But before I start tearing into the VirtualBox source code, can somebody suggest an easier way to get this done, or perhaps point me to Microsoft documentation on implementing SMB redirectors?


\\server@port\share is a valid syntax for WebDAV. The moment you put the @port in the UNC path notation, net use changes from SMB to WebDAV. You cannot change the port SMB is using.

--Ben


Writing a driver is not easy; it requires a lot of domain specific knowledge. Here are some links to get started:

How to Write a Windows Driver
Develop a Windows Driver
WDK Documentation on MSDN

Good luck.

You might also find this (PDF) helpful.


You may need to implement a network redirector by yourself.

Looking TalAloni's SMBLibrary note and PcapDotNet , that can make some help.


net use * \\servername@XXXX\ where XXXX is a port number. I've jast checked it on Windows 7. So it works perfect

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜