Exemplo n.º 1
0
 public static void UploadContent(string computer, string content, string destination, string auth = "ntlm", string scheme = "http")
 {
     if (auth != "kerberos")
     {
         auth = "Negotiate";
     }
     try
     {
         string data = Compress(Encoding.ASCII.GetBytes(content));
         (Collection <PSObject> result, Collection <ErrorRecord> errors) = InvokeCommand(computer, PsFunction.UploadFile(data, destination), false, auth, scheme, true);
         foreach (PSObject obj in result)
         {
             if (obj.ToString().Length == 0)
             {
                 Console.WriteLine("  [-] Upload Failed");
             }
         }
     }
     catch (Exception e) // Connecting to remote server 192.168.1.10 failed with the following error message : Access is denied. For more information, see the about_Remote_Troubleshooting Help topic
     {
         Console.WriteLine(e.Message);
     }
 }
Exemplo n.º 2
0
 public static void UploadFile(string computer, string path, string destination, string auth = "ntlm", string scheme = "http")
 {
     if (auth != "kerberos")
     {
         auth = "Negotiate";
     }
     try
     {
         byte[] binary = File.ReadAllBytes(path);
         string data   = Compress(binary);
         (Collection <PSObject> result, Collection <ErrorRecord> errors) = InvokeCommand(computer, PsFunction.UploadFile(data, destination), false, auth, scheme, true);
         foreach (PSObject obj in result)
         {
             if (obj.ToString().Length == 0)
             {
                 Console.WriteLine("  [-] Upload Failed");
                 return;
             }
         }
         Console.WriteLine(String.Format("  [+] Copied {0}kb to {1}", binary.ToArray().Length, destination));
     }
     catch (Exception e) // Connecting to remote server 192.168.1.10 failed with the following error message : Access is denied. For more information, see the about_Remote_Troubleshooting Help topic
     {
         Console.WriteLine(e.Message);
     }
 }