Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SshClient sshClient = new SshClient(host, 22, login, password);
- sshClient.Connect();
- /*1 этап
- shellStream.WriteLine("yum install httpd");
- System.Threading.Thread.Sleep(1000 * 4);
- shellStream.WriteLine("y");
- shellStream.Expect(new Regex(@"Complete!"), new TimeSpan(0, 15, 0));*/
- //2 этап
- var cmd = sshClient.CreateCommand("chkconfig iptables off && service iptables stop");
- cmd.Execute();
- cmd = sshClient.CreateCommand("chkconfig ip6tables off && service ip6tables stop");
- cmd.Execute();
- //3 этап
- cmd = sshClient.CreateCommand("echo 'NETWORKING_IPV6=yes' >> /etc/sysconfig/network");
- cmd.Execute();
- //4 этап
- cmd = sshClient.CreateCommand("echo"+" "+ "> /etc/sysconfig/network-scripts/ifcfg-sit1");
- cmd.Execute();
- cmd = sshClient.CreateCommand("echo 'DEVICE=sit1' >> /etc/sysconfig/network-scripts/ifcfg-sit1");
- cmd.Execute();
- cmd = sshClient.CreateCommand("echo 'BOOTPROTO=none' >> /etc/sysconfig/network-scripts/ifcfg-sit1");
- cmd.Execute();
- cmd = sshClient.CreateCommand("echo 'ONBOOT=yes' >> /etc/sysconfig/network-scripts/ifcfg-sit1");
- cmd.Execute();
- cmd = sshClient.CreateCommand("echo 'IPV6INIT=yes' >> /etc/sysconfig/network-scripts/ifcfg-sit1");
- cmd.Execute();
- cmd = sshClient.CreateCommand("echo IPV6TUNNELIPV4="+REMOTE_IPV4+">> /etc/sysconfig/network-scripts/ifcfg-sit1");
- cmd.Execute();
- cmd = sshClient.CreateCommand("echo IPV6TUNNELIPV4LOCAL="+LOCAL_IPV4+">> /etc/sysconfig/network-scripts/ifcfg-sit1");
- cmd.Execute();
- cmd = sshClient.CreateCommand("echo IPV6ADDR="+LOCAL_IPV6+"::2/48"+">> /etc/sysconfig/network-scripts/ifcfg-sit1");
- cmd.Execute();
- //5 этап
- cmd = sshClient.CreateCommand("echo sit1 ::/0 > /etc/sysconfig/static-routes-ipv6");
- cmd.Execute();
- //6 этап
- cmd = sshClient.CreateCommand("echo -A INPUT -p 41 -j ACCEPT >> /etc/sysconfig/iptables");
- cmd.Execute();
- //7 этап
- cmd = sshClient.CreateCommand("echo nameserver 2001:4860:4860::8888 >> /etc/resolv.conf");
- cmd.Execute();
- cmd = sshClient.CreateCommand("echo nameserver 2001:4860:4860::8844 >> /etc/resolv.conf");
- cmd.Execute();
- //8 этап
- cmd = sshClient.CreateCommand("wget http://3proxy.ru/0.8.6/3proxy-0.8.6.tgz");
- System.Threading.Thread.Sleep(1000 * 8);
- cmd.Execute();
- cmd = sshClient.CreateCommand("tar -xvf 3proxy-0.8.6.tgz");
- cmd.Execute();
- System.Threading.Thread.Sleep(1000 * 8);
- cmd = sshClient.CreateCommand("cd 3proxy");
- cmd.Execute();
- cmd = sshClient.CreateCommand("ln -s /usr/lib64/libcrypto.so.10 /usr/lib/libcrypto.so");
- cmd.Execute();
- System.Threading.Thread.Sleep(1000 * 1);
- cmd = sshClient.CreateCommand("ln -s /usr/lib64/libssl.so.10 /usr/lib/libssl.so");
- cmd.Execute();
- System.Threading.Thread.Sleep(1000 * 1);
- //9 этап
- IDictionary<Renci.SshNet.Common.TerminalModes, uint> termkvp = new Dictionary<Renci.SshNet.Common.TerminalModes, uint>();
- termkvp.Add(Renci.SshNet.Common.TerminalModes.ECHO, 53);
- ShellStream shellStream = sshClient.CreateShellStream("xterm", 80,24, 800, 600, 1024, termkvp);
- shellStream.WriteLine("make -f /root/3proxy/Makefile.Linux");
- System.Threading.Thread.Sleep(1000 * 50);
- //12 этап
- sshClient.Disconnect();
- return "ok";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement