예제 #1
0
        public virtual void RecurseShares(string host)
        {
            this.ShareDetails = new List <ShareDetails>();

            foreach (string share in _shares)
            {
                ProcessStartInfo si = new ProcessStartInfo();
                si.RedirectStandardOutput = true;
                si.UseShellExecute        = false;
                si.RedirectStandardError  = false;

                Process proc = new Process();

                proc.StartInfo           = si;
                proc.EnableRaisingEvents = false;
                proc.StartInfo.FileName  = "smbclient";

                string cmd = @"'\\\\" + host + @"\\" + share + @"' -U Administrator -N -c 'recurse;ls'";

                proc.StartInfo.Arguments = cmd;
                proc.Start();

                string output = proc.StandardOutput.ReadToEnd();

                proc.WaitForExit();

                ShareDetails details = new ShareDetails();

                details.ParentResults = this;
                details.ShareName     = share;
                details.FilesOnShare  = output;

                this.ShareDetails.Add(details);
            }
        }
예제 #2
0
        public virtual void RecurseShares(string host)
        {
            this.ShareDetails = new List<ShareDetails>();

            foreach (string share in _shares)
            {
                ProcessStartInfo si = new ProcessStartInfo();
                si.RedirectStandardOutput = true;
                si.UseShellExecute = false;
                si.RedirectStandardError = false;

                Process proc = new Process();

                proc.StartInfo = si;
                proc.EnableRaisingEvents = false;
                proc.StartInfo.FileName = "smbclient";

                string cmd = @"'\\\\" + host + @"\\" + share + @"' -U Administrator -N -c 'recurse;ls'";

                proc.StartInfo.Arguments = cmd;
                proc.Start();

                string output = proc.StandardOutput.ReadToEnd();

                proc.WaitForExit();

                ShareDetails details = new ShareDetails();

                details.ParentResults = this;
                details.ShareName = share;
                details.FilesOnShare = output;

                this.ShareDetails.Add(details);
            }
        }