Coder Social home page Coder Social logo

smb2's Introduction

@stifani/smb2

A SMB2 implementation in TypeScript.

Github Version NPM Version NPM Downloads License

Installation

$ npm i @stifani/smb2

Usage

import smb2 from "@stifani/smb2";

const client = new smb2.Client(host);
const session = await client.authenticate({
  domain,
  username,
  password
});
const tree = await session.connectTree(share);

const entries = await tree.readDirectory("/");
console.log(entries);

Features

Client

  • watch shares for file and directory changes
  • create, read & remove & rename files
  • create, list & remove & rename directories
  • check directory/file exists

WIP

  • SMB
  • Server

License

MIT

smb2's People

Contributors

ardean avatar bulentv avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

bulentv awo00

smb2's Issues

Unable to connect to Window's network attached storage share

Hi,
I'm trying to connect to Network attached storage(NAS share)

const smb2 =  require("@stifani/smb2");
const client = new smb2.Client(config.host);
const session = await client.authenticate({
  domain:config.domain
  username:config.username
  password : config.password
});
const tree = await session.connectTree(config.sharepath);

but its throwing me an error object -


Response {
    header:{
        protocolId:'fe53d42',
        structureSize:64,
        creditCharge:0,
        status:3221225676,
        type:3,
        credit:1,
        flags:1,
        nextCommand:0,
        messageId:3n,
        clientId:'00000000',
        treeId:0,
        sessionId:'0ca0530000000abe',
        signature:0
    },
    body:{
        structureSize:9,
        shareType:0,
        reserved:0,
        shareFlags:0,
        capabilities:0,
        maximalAccess:0
    },
    typeName: 'TreeConnect',
    request: Request {
        header:{
            messageId :3n,
            clientId: 'ea45b4b7',
            sessionId: '0ca0530000000abe',
            treeId: undefined,
            type: 3
        },
        body:{
            buffer: <Buffer 5c 00 5c 00 6e 00 61 00 73 00 76 00 30 00 36 00 30 00 31 00 3a 00 34 00 34 00 35 00 5c 00 5c 00 62 00 63 00 6d 00 5f 00 64 00 61 00 74 00 61 00 5f 00 ... 28 more bytes>
        },
        typeName: 'TreeConnect'
    }
}

Can someone please confirm me where is the issue, if its in my code then please help me to fix it.

Thanks

TypeError: buffer.readBigInt64LE is not a function

at Object.exports.parseNumber (/node_modules/@stifani/smb2/dist/protocol/structureUtil.js:52:20)
at Socket.Client.onData (/node_modules/@stifani/smb2/dist/client/Client.js:46:53)
Can you help me?
This occurs when the authenticate function is called.

const client = new smb2.Client(host);
const session = await client.authenticate({
domain,
username,
password
});

Suggestion: discovery support

It would be great if there was a way to discover the shares on a local network without knowing the IP/Domain. Some OS do this, like some Linux distributions, macOS,... And I find it a must.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.