import java.util.*;
import java.util.zip.*;
import java.util.List;
import java.util.regex.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.*;
import java.util.concurrent.locks.*;
import java.util.function.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.*;
import javax.swing.table.*;
import java.io.*;
import java.net.*;
import java.lang.reflect.*;
import java.lang.ref.*;
import java.lang.management.*;
import java.security.*;
import java.security.spec.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.awt.geom.*;
import javax.imageio.*;
import java.math.*;
import java.time.Duration;
import java.lang.invoke.VarHandle;
import java.lang.invoke.MethodHandles;
import net.schmizz.sshj.xfer.InMemorySourceFile;
import net.schmizz.sshj.xfer.scp.SCPFileTransfer;
import net.schmizz.sshj.sftp.RemoteResourceInfo;
import net.schmizz.sshj.sftp.FileMode;
import net.schmizz.sshj.SSHClient;
import net.schmizz.sshj.common.IOUtils;
import net.schmizz.sshj.transport.verification.PromiscuousVerifier;
import static x30_pkg.x30_util.DynamicObject;
import java.text.*;
import java.text.NumberFormat;
import java.util.TimeZone;
import java.awt.geom.*;
class main {
public static void main(final String[] args) throws Exception {
pnl(scpLS("root", "butter.botcompany.de", "/root/JavaX-Data/#1010745"));
}
static A pnl(A l) { return pnl("", l); }
static A pnl(String prefix, A l) {
printNumberedLines(prefix, l);
return l;
}
static A[] pnl(A[] l) { return pnl("", l); }
static A[] pnl(String prefix, A[] l) {
printNumberedLines(prefix, l);
return l;
}
static A pnl(A map) {
printNumberedLines(map);
return map;
}
static A pnl(String prefix, A map) {
printNumberedLines(prefix, map);
return map;
}
static String pnl(String s) {
printNumberedLines(lines(s));
return s;
}
static MultiMap pnl(MultiMap mm) {
pnl(mm == null ? null : mm.asMap());
return mm;
}
// allow any host ID and search for pw in JavaX-Secret
static List scpLS(String user, String host, String remoteDir) { try {
final SSHClient client = sshLogin(user, host);
try {
return client.newSFTPClient().ls(remoteDir);
} finally {
sshDisconnect(client);
}
} catch (Exception __e) { throw rethrow(__e); } }
/*static L printNumberedLines(L l) {
printNumberedLines((Collection) l);
ret l;
}
static L printNumberedLines(S prefix, L l) {
printNumberedLines(prefix, (Collection) l);
ret l;
}*/
static void printNumberedLines(Map map) {
printNumberedLines(mapToLines(map));
}
static void printNumberedLines(String prefix, Map map) {
printNumberedLines(prefix, mapToLines(map));
}
static A printNumberedLines(A l) {
int i = 0;
if (l != null) for (Object a : cloneList(l)) print((++i) + ". " + str(a));
return l;
}
static A printNumberedLines(String prefix, A l) {
int i = 0;
if (l != null) for (Object a : cloneList(l)) print(prefix + (++i) + ". " + str(a));
return l;
}
static void printNumberedLines(Object[] l) { printNumberedLines("", l); }
static void printNumberedLines(String prefix, Object[] l) {
printNumberedLines(prefix, wrapAsList(l));
}
static void printNumberedLines(Object o) {
printNumberedLines(lines(str(o)));
}
static String lines(Iterable lines) { return fromLines(lines); }
static String lines(Object[] lines) { return fromLines(asList(lines)); }
static List lines(String s) { return toLines(s); }
// convenience map call
static String lines(Iterable l, IF1 f) {
return mapToLines(l, f);
}
// lib 1000308 // sshj.jar OLD
// eddsa
// bouncycastle
// 1011967 // sshj
//lib 1011966 lib 1011965 // slf4j
// slf4j api
// slf4j simple
// jzlib
//import net.schmizz.sshj.connection.channel.direct.Session;
static boolean sshLogin_keepOpen = false;
static String sshLogin_openUser;
static String sshLogin_openHost;
static SSHClient sshLogin_client;
static Lock sshLogin_lock = lock();
// quickest version - allow any host ID and search for pw in JavaX-Secret
static SSHClient sshLogin(String user, String host) { try {
{
Lock __0 = sshLogin_lock; lock(__0); try {
if (sshLogin_client != null && eq(sshLogin_openUser, user)
&& eq(sshLogin_openHost, host))
return sshLogin_client;
} finally { unlock(__0); } }
String pass = findSSHPassword(user, host);
final SSHClient client = new SSHClient();
client.addHostKeyVerifier(new PromiscuousVerifier());
client.connect(host);
try {
client.authPassword(user, pass);
} catch (Throwable e) {
client.disconnect();
rethrow(e);
}
Lock __1 = sshLogin_lock; lock(__1); try {
if (sshLogin_keepOpen && sshLogin_client == null) {
sshLogin_openUser = user;
sshLogin_openHost = host;
sshLogin_client = client;
}
return client;
} finally { unlock(__1); } } catch (Exception __e) { throw rethrow(__e); } }
static void cleanMeUp_sshLogin() {
Lock __2 = sshLogin_lock; lock(__2); try {
if (sshLogin_client != null) {
try { sshLogin_client.disconnect(); } catch (Throwable __e) { printStackTrace(__e); }
sshLogin_client = null;
}
} finally { unlock(__2); } }
static void sshDisconnect(SSHClient client) { try {
if (client == null) return;
{
Lock __0 = sshLogin_lock; lock(__0); try {
if (client == sshLogin_client) return;
} finally { unlock(__0); } }
client.disconnect();
} catch (Exception __e) { throw rethrow(__e); } }
static RuntimeException rethrow(Throwable t) {
if (t instanceof Error)
_handleError((Error) t);
throw t instanceof RuntimeException ? (RuntimeException) t : new RuntimeException(t);
}
static RuntimeException rethrow(String msg, Throwable t) {
throw new RuntimeException(msg, t);
}
static List mapToLines(Map map) {
List l = new ArrayList();
for (Object key : keys(map))
l.add(str(key) + " = " + str(map.get(key)));
return l;
}
static String mapToLines(Map map, Object f) {
return lines(map(map, f));
}
static String mapToLines(Object f, Map map) {
return lines(map(map, f));
}
static String mapToLines(Object f, Iterable l) {
return lines(map(f, l));
}
static String mapToLines(Iterable l, IF1 f) {
return mapToLines((Object) f, l);
}
static String mapToLines(IF1 f, Iterable l) {
return mapToLines((Object) f, l);
}
static String mapToLines(Map map, IF2 f) {
return lines(map(map, f));
}
static String mapToLines(IF1 f, A data1, A... moreData) {
return lines(map(f, data1, moreData));
}
static ArrayList cloneList(Iterable l) {
return l instanceof Collection ? cloneList((Collection) l) : asList(l);
}
static ArrayList cloneList(Collection l) {
if (l == null) return new ArrayList();
synchronized(collectionMutex(l)) {
return new ArrayList(l);
}
}
static volatile StringBuffer local_log = new StringBuffer(); // not redirected
static boolean printAlsoToSystemOut = true;
static volatile Appendable print_log = local_log; // might be redirected, e.g. to main bot
// in bytes - will cut to half that
static volatile int print_log_max = 1024*1024;
static volatile int local_log_max = 100*1024;
static boolean print_silent = false; // total mute if set
static Object print_byThread_lock = new Object();
static volatile ThreadLocal