mirror of
https://github.com/CodePhiliaX/Chat2DB.git
synced 2025-09-21 12:03:20 +08:00
If the database name contains the name of the current database, the current database is placed in the first place
This commit is contained in:
@ -36,6 +36,11 @@
|
|||||||
<artifactId>jsch</artifactId>
|
<artifactId>jsch</artifactId>
|
||||||
<version>0.2.9</version>
|
<version>0.2.9</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bouncycastle</groupId>
|
||||||
|
<artifactId>bcprov-jdk18on</artifactId>
|
||||||
|
<version>1.71</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.oracle.ojdbc</groupId>
|
<groupId>com.oracle.ojdbc</groupId>
|
||||||
<artifactId>orai18n</artifactId>
|
<artifactId>orai18n</artifactId>
|
||||||
|
@ -1,13 +1,17 @@
|
|||||||
|
|
||||||
package ai.chat2db.spi.ssh;
|
package ai.chat2db.spi.ssh;
|
||||||
|
|
||||||
|
import java.security.Security;
|
||||||
|
|
||||||
import ai.chat2db.server.tools.common.exception.ConnectionException;
|
import ai.chat2db.server.tools.common.exception.ConnectionException;
|
||||||
import ai.chat2db.spi.model.SSHInfo;
|
import ai.chat2db.spi.model.SSHInfo;
|
||||||
import cn.hutool.core.net.NetUtil;
|
import cn.hutool.core.net.NetUtil;
|
||||||
import cn.hutool.extra.ssh.JschUtil;
|
import cn.hutool.extra.ssh.JschUtil;
|
||||||
|
import com.jcraft.jsch.JSch;
|
||||||
import com.jcraft.jsch.Session;
|
import com.jcraft.jsch.Session;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jipengfei
|
* @author jipengfei
|
||||||
@ -16,6 +20,16 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class SSHManager {
|
public class SSHManager {
|
||||||
|
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
Security.insertProviderAt(new BouncyCastleProvider(), 1);
|
||||||
|
JSch.setConfig("kex", JSch.getConfig("kex") + ",diffie-hellman-group1-sha1");
|
||||||
|
JSch.setConfig("server_host_key", JSch.getConfig("server_host_key") + ",ssh-rsa,ssh-dss");
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("SSHManager init error",e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static Session getSSHSession(SSHInfo ssh) {
|
public static Session getSSHSession(SSHInfo ssh) {
|
||||||
Session session = null;
|
Session session = null;
|
||||||
try {
|
try {
|
||||||
|
Reference in New Issue
Block a user