Untitled

mail@pastecode.io avatar
unknown
csharp
17 days ago
918 B
6
Indexable
Never
using SMBLibrary.Client;
using SMBLibrary;
using System.Net;
class test
{

    static void Main()
    {
        SMB2Client client = new SMB2Client(); // SMB2Client can be used as well
        bool isConnected = client.Connect(IPAddress.Parse("10.10.220.81"), SMBTransportType.DirectTCPTransport);
        if (isConnected)
        {
            NTStatus status = client.Login("lab.enterprise.thm", "bitbucket", "littleredbuckets");
            if (status == NTStatus.STATUS_SUCCESS)
            {
                List<string> shares = client.ListShares(out status);
                foreach (var share in shares)
                {
                    Console.WriteLine(share);
                }
                client.Logoff();
            }
            else
            {
                Console.WriteLine(status.ToString());
            }
            client.Disconnect();
        }
    }
}
Leave a Comment