Advertisement
Guest User

Untitled

a guest
Feb 6th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. string ip = project.Variables["ip"].Value;
  2. string user = project.Variables["user"].Value;
  3. string passadmin = project.Variables["passadmin"].Value;
  4. string cnt_akk = project.Variables["cnt_akk"].Value;
  5. string token = project.Variables["token"].Value;
  6. string title = project.Variables["title"].Value;
  7.  
  8. SshClient sshClient = new SshClient(ip, 22, user, passadmin);
  9. sshClient.Connect();
  10.  
  11. project.SendInfoToLog("Соединились с сервером", true);
  12. var cmd = sshClient.CreateCommand("cd /root/upload/");
  13. cmd.Execute();
  14. project.SendInfoToLog("Зашли в папку", true);
  15. project.SendInfoToLog("Начинаем танцы с бубмном после execute", true);
  16.  
  17. IDictionary<Renci.SshNet.Common.TerminalModes, uint> termkvp = new Dictionary<Renci.SshNet.Common.TerminalModes, uint>();
  18. termkvp.Add(Renci.SshNet.Common.TerminalModes.ECHO, 53);
  19. ShellStream shellStream = sshClient.CreateShellStream("xterm", 80,24, 800, 600, 1024, termkvp);
  20. shellStream.WriteLine("drive -c /root/upload/account"+cnt_akk+"/ upload -f keygen.pdf -t "+title);
  21. project.SendInfoToLog("Отправили drive", true);
  22. shellStream.WriteLine(token);
  23. project.SendInfoToLog("Отправили токен", true);
  24. shellStream.Expect(new Regex(@"enter"), new TimeSpan(0, 15, 0));
  25.  
  26.  
  27. sshClient.Disconnect();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement