X-plore v4.37.09版本的 MD5 值为:1ac588cd7c13e9578c2d4266387e2f4f
以下内容为反编译后的 o.java 源代码,内容仅作参考
package o6;
import F7.C1160d;
import F7.w;
import F7.x;
import W6.hV.wLxQBPugaQkCAi;
import Y5.QIb.FKYtKvr;
import com.google.android.gms.dynamite.descriptors.com.google.android.gms.measurement.dynamite.ModuleDescriptor;
import h7.AbstractC6736y;
import h7.C6709J;
import i7.AbstractC6821C;
import i7.AbstractC6838o;
import i7.AbstractC6843u;
import i7.S;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
import java.io.OutputStream;
import java.math.BigInteger;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.security.GeneralSecurityException;
import java.security.MessageDigest;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import o6.AbstractC7116e;
import o6.AbstractC7118g;
import o6.n;
import o6.p;
import r.aa.pWhGPktqxGVuO;
import v7.InterfaceC7625a;
import w7.AbstractC7771k;
import w7.AbstractC7777q;
import w7.AbstractC7780t;
public abstract class o implements Runnable {
public static final e f52555Y = new e(null);
private static final Map f52556Z;
private byte[] f52558F;
private int f52559G;
private int f52560H;
private byte[] f52561I;
private byte[] f52562J;
private final List f52565M;
private final Map f52566N;
private String f52567O;
private h f52568P;
private Socket f52569Q;
private int f52570R;
private final o6.q f52571S;
private String f52572T;
private boolean f52573U;
private Thread f52574V;
private final ArrayList f52575W;
private int f52576X;
private o6.n f52577a;
private o6.n f52578b;
private InterfaceC7120i f52579c;
private InterfaceC7120i f52580d;
private int f52581e = 8;
private int f52557E = 8;
private final Object f52563K = new Object();
private final g f52564L = new g();
class a extends AbstractC7777q implements InterfaceC7625a {
public static final a f52582I = new a();
a() {
super(0, AbstractC7116e.a.class, "<init>", "<init>()V", 0);
}
@Override
public final AbstractC7116e.a c() {
return new AbstractC7116e.a();
}
}
class b extends AbstractC7777q implements InterfaceC7625a {
public static final b f52583I = new b();
b() {
super(0, AbstractC7116e.b.class, "<init>", "<init>()V", 0);
}
@Override
public final AbstractC7116e.b c() {
return new AbstractC7116e.b();
}
}
class c extends AbstractC7777q implements InterfaceC7625a {
public static final c f52584I = new c();
c() {
super(0, AbstractC7116e.c.class, "<init>", "<init>()V", 0);
}
@Override
public final AbstractC7116e.c c() {
return new AbstractC7116e.c();
}
}
class d extends AbstractC7777q implements InterfaceC7625a {
public static final d f52585I = new d();
d() {
super(0, AbstractC7116e.d.class, "<init>", "<init>()V", 0);
}
@Override
public final AbstractC7116e.d c() {
return new AbstractC7116e.d();
}
}
public static final class e {
private e() {
}
public e(AbstractC7771k abstractC7771k) {
this();
}
private final void d(byte[] bArr) {
AbstractC6838o.y(bArr, (byte) 0, 0, 0, 6, null);
}
public final byte[] e(o6.q qVar, BigInteger bigInteger, byte[] bArr, byte[] bArr2, MessageDigest messageDigest, int i9) {
int digestLength = messageDigest.getDigestLength();
while (bArr2.length < i9) {
qVar.K();
o6.q.H(o6.q.H(qVar.x(bigInteger), bArr, 0, 0, 6, null), bArr2, 0, 0, 6, null);
messageDigest.update(qVar.a(), 0, qVar.v());
byte[] bArr3 = new byte[bArr2.length + digestLength];
System.arraycopy(bArr2, 0, bArr3, 0, bArr2.length);
System.arraycopy(messageDigest.digest(), 0, bArr3, bArr2.length, digestLength);
d(bArr2);
bArr2 = bArr3;
}
return bArr2;
}
public final String f() {
List n9;
String c02;
n9 = AbstractC6843u.n("diffie-hellman-group1-sha1", "diffie-hellman-group-exchange-sha1", "diffie-hellman-group-exchange-sha256");
c02 = AbstractC6821C.c0(n9, ",", null, null, 0, null, null, 62, null);
return c02;
}
public final String g() {
String c02;
c02 = AbstractC6821C.c0(o.f52556Z.keySet(), ",", null, null, 0, null, null, 62, null);
return c02;
}
}
public static final class f extends IOException {
public f(String str) {
super(str);
AbstractC7780t.f(str, "msg");
}
}
public static final class g {
private final SecureRandom f52586a = new SecureRandom();
private byte[] f52587b = new byte[16];
public final void a(byte[] bArr, int i9, int i10) {
AbstractC7780t.f(bArr, "b");
if (i10 > this.f52587b.length) {
this.f52587b = new byte[i10];
}
this.f52586a.nextBytes(this.f52587b);
System.arraycopy(this.f52587b, 0, bArr, i9, i10);
}
}
public static final class h extends AbstractC7117f {
public final void g(byte[] bArr, int i9, int i10) {
AbstractC7780t.f(bArr, "array");
InputStream b9 = b();
if (b9 == null) {
throw new IOException("Closed");
}
while (i10 > 0) {
int read = b9.read(bArr, i9, i10);
if (read < 0) {
throw new EOFException("End of IO Stream Read");
}
i9 += read;
i10 -= read;
}
}
public final void h(o6.q qVar) {
AbstractC7780t.f(qVar, "b");
OutputStream c9 = c();
if (c9 == null) {
throw new IOException("Closed");
}
c9.write(qVar.a(), 0, qVar.v());
c9.flush();
}
}
class i extends AbstractC7777q implements InterfaceC7625a {
public static final i f52588I = new i();
i() {
super(0, n.a.f.class, "<init>", "<init>()V", 0);
}
@Override
public final n.a.f c() {
return new n.a.f();
}
}
class j extends AbstractC7777q implements InterfaceC7625a {
public static final j f52589I = new j();
j() {
super(0, n.a.d.class, "<init>", "<init>()V", 0);
}
@Override
public final n.a.d c() {
return new n.a.d();
}
}
class k extends AbstractC7777q implements InterfaceC7625a {
public static final k f52590I = new k();
k() {
super(0, n.a.b.class, "<init>", "<init>()V", 0);
}
@Override
public final n.a.b c() {
return new n.a.b();
}
}
class l extends AbstractC7777q implements InterfaceC7625a {
public static final l f52591I = new l();
l() {
super(0, n.a.e.class, "<init>", "<init>()V", 0);
}
@Override
public final n.a.e c() {
return new n.a.e();
}
}
class m extends AbstractC7777q implements InterfaceC7625a {
public static final m f52592I = new m();
m() {
super(0, n.a.c.class, "<init>", "<init>()V", 0);
}
@Override
public final n.a.c c() {
return new n.a.c();
}
}
class n extends AbstractC7777q implements InterfaceC7625a {
public static final n f52593I = new n();
n() {
super(0, n.a.C0800a.class, "<init>", "<init>()V", 0);
}
@Override
public final n.a.C0800a c() {
return new n.a.C0800a();
}
}
class C0801o extends AbstractC7777q implements InterfaceC7625a {
public static final C0801o f52594I = new C0801o();
C0801o() {
super(0, n.e.b.class, "<init>", "<init>()V", 0);
}
@Override
public final n.e.b c() {
return new n.e.b();
}
}
class p extends AbstractC7777q implements InterfaceC7625a {
public static final p f52595I = new p();
p() {
super(0, n.e.a.class, "<init>", "<init>()V", 0);
}
@Override
public final n.e.a c() {
return new n.e.a();
}
}
class q extends AbstractC7777q implements InterfaceC7625a {
public static final q f52596I = new q();
q() {
super(0, n.b.class, "<init>", "<init>()V", 0);
}
@Override
public final n.b c() {
return new n.b();
}
}
public class r extends AbstractC7777q implements v7.q {
public static final r f52597I = new r();
r() {
super(3, AbstractC7118g.h.class, pWhGPktqxGVuO.YNbLssPoCkwpS, "<init>(Lcom/lcg/ssh/SshSession;[B[B)V", 0);
}
@Override
public final AbstractC7118g.h f(o oVar, byte[] bArr, byte[] bArr2) {
return new AbstractC7118g.h(oVar, bArr, bArr2);
}
}
public class s extends AbstractC7777q implements v7.q {
public static final s f52598I = new s();
s() {
super(3, AbstractC7118g.f.class, "<init>", "<init>(Lcom/lcg/ssh/SshSession;[B[B)V", 0);
}
@Override
public final AbstractC7118g.f f(o oVar, byte[] bArr, byte[] bArr2) {
return new AbstractC7118g.f(oVar, bArr, bArr2);
}
}
public class t extends AbstractC7777q implements v7.q {
public static final t f52599I = new t();
t() {
super(3, AbstractC7118g.C0799g.class, "<init>", "<init>(Lcom/lcg/ssh/SshSession;[B[B)V", 0);
}
@Override
public final AbstractC7118g.C0799g f(o oVar, byte[] bArr, byte[] bArr2) {
return new AbstractC7118g.C0799g(oVar, bArr, bArr2);
}
}
public class u extends AbstractC7777q implements v7.q {
public static final u f52600I = new u();
u() {
super(3, AbstractC7118g.d.class, "<init>", FKYtKvr.tFzBykYIEDBT, 0);
}
@Override
public final AbstractC7118g.d f(o oVar, byte[] bArr, byte[] bArr2) {
return new AbstractC7118g.d(oVar, bArr, bArr2);
}
}
public class v extends AbstractC7777q implements v7.q {
public static final v f52601I = new v();
v() {
super(3, AbstractC7118g.e.class, "<init>", "<init>(Lcom/lcg/ssh/SshSession;[B[B)V", 0);
}
@Override
public final AbstractC7118g.e f(o oVar, byte[] bArr, byte[] bArr2) {
return new AbstractC7118g.e(oVar, bArr, bArr2);
}
}
static {
Map j9;
j9 = S.j(AbstractC6736y.a("hmac-md5", a.f52582I), AbstractC6736y.a(pWhGPktqxGVuO.rheBuEn, b.f52583I), AbstractC6736y.a("hmac-sha2-256", c.f52584I), AbstractC6736y.a("hmac-sha2-512", d.f52585I));
f52556Z = j9;
}
public o() {
Map j9;
ArrayList arrayList = new ArrayList(8);
for (int i9 = 0; i9 < 8; i9++) {
arrayList.add("");
}
this.f52565M = arrayList;
j9 = S.j(AbstractC6736y.a("aes256-ctr", i.f52588I), AbstractC6736y.a("aes192-ctr", j.f52589I), AbstractC6736y.a("aes128-ctr", k.f52590I), AbstractC6736y.a("aes256-cbc", l.f52591I), AbstractC6736y.a("aes192-cbc", m.f52592I), AbstractC6736y.a("aes128-cbc", n.f52593I), AbstractC6736y.a("3des-ctr", C0801o.f52594I), AbstractC6736y.a("3des-cbc", p.f52595I), AbstractC6736y.a("blowfish-cbc", q.f52596I));
this.f52566N = j9;
this.f52571S = new o6.q(0, 1, null);
this.f52575W = new ArrayList();
}
private final void A() {
this.f52571S.r();
this.f52571S.i();
if (this.f52571S.f()) {
P(this.f52571S.O(82));
}
}
private final void C() {
this.f52571S.r();
AbstractC7113b v8 = v(this.f52571S.j());
if (v8 == null) {
return;
}
v8.u(this.f52571S.j(), this.f52571S.j() & 4294967295L, this.f52571S.j());
}
private final AbstractC7118g E(C7121j c7121j, byte[] bArr) {
v7.q qVar;
byte[] l9 = c7121j.l((c7121j.j() - 1) - c7121j.h());
if (bArr == null) {
bArr = J();
}
H(l9, bArr);
if (!this.f52573U) {
int i9 = 6 | 2;
String str = (String) this.f52565M.get(2);
String str2 = (String) this.f52565M.get(3);
if (AbstractC7780t.a(str, "none") || AbstractC7780t.a(str2, "none")) {
throw new IOException("NONE Cipher should not be chosen before authentification is successed.");
}
}
try {
String str3 = (String) this.f52565M.get(0);
switch (str3.hashCode()) {
case -1358554204:
if (str3.equals("diffie-hellman-group1-sha1")) {
qVar = r.f52597I;
return (AbstractC7118g) qVar.f(this, l9, bArr);
}
throw new IOException("Unexpected key exchange: " + str3);
case 725426094:
if (str3.equals("diffie-hellman-group14-sha256")) {
qVar = t.f52599I;
return (AbstractC7118g) qVar.f(this, l9, bArr);
}
throw new IOException("Unexpected key exchange: " + str3);
case 970586188:
if (str3.equals("diffie-hellman-group14-sha1")) {
qVar = s.f52598I;
return (AbstractC7118g) qVar.f(this, l9, bArr);
}
throw new IOException("Unexpected key exchange: " + str3);
case 1437046791:
if (str3.equals("diffie-hellman-group-exchange-sha256")) {
qVar = v.f52601I;
return (AbstractC7118g) qVar.f(this, l9, bArr);
}
throw new IOException("Unexpected key exchange: " + str3);
case 1963504357:
if (str3.equals("diffie-hellman-group-exchange-sha1")) {
qVar = u.f52600I;
return (AbstractC7118g) qVar.f(this, l9, bArr);
}
throw new IOException("Unexpected key exchange: " + str3);
default:
throw new IOException("Unexpected key exchange: " + str3);
}
} catch (GeneralSecurityException e9) {
throw new IOException(e9.getMessage());
}
}
private final void F(o6.q qVar, AbstractC7118g abstractC7118g) {
BigInteger bigInteger = abstractC7118g.f52495h;
byte[] bArr = abstractC7118g.f52496i;
MessageDigest messageDigest = abstractC7118g.f52488a;
if (this.f52558F == null) {
this.f52558F = bArr;
}
byte[] bArr2 = this.f52558F;
if (bArr2 == null) {
return;
}
qVar.K();
AbstractC7780t.c(bigInteger);
o6.q x8 = qVar.x(bigInteger);
AbstractC7780t.c(bArr);
o6.q.H(o6.q.H(x8, bArr, 0, 0, 6, null).A(65), bArr2, 0, 0, 6, null);
messageDigest.update(qVar.a(), 0, qVar.v());
byte[] digest = messageDigest.digest();
int v8 = (qVar.v() - bArr2.length) - 1;
byte[] a9 = qVar.a();
a9[v8] = (byte) (a9[v8] + 1);
messageDigest.update(qVar.a(), 0, qVar.v());
byte[] digest2 = messageDigest.digest();
byte[] a10 = qVar.a();
a10[v8] = (byte) (a10[v8] + 1);
messageDigest.update(qVar.a(), 0, qVar.v());
byte[] digest3 = messageDigest.digest();
byte[] a11 = qVar.a();
a11[v8] = (byte) (a11[v8] + 1);
messageDigest.update(qVar.a(), 0, qVar.v());
byte[] digest4 = messageDigest.digest();
byte[] a12 = qVar.a();
a12[v8] = (byte) (a12[v8] + 1);
messageDigest.update(qVar.a(), 0, qVar.v());
byte[] digest5 = messageDigest.digest();
byte[] a13 = qVar.a();
a13[v8] = (byte) (a13[v8] + 1);
messageDigest.update(qVar.a(), 0, qVar.v());
byte[] digest6 = messageDigest.digest();
try {
String str = (String) this.f52565M.get(3);
o6.n m9 = m(str);
if (m9 == null) {
throw new IOException("Unsupported cipher: " + str);
}
this.f52577a = m9;
byte[] bArr3 = digest4;
while (m9.c() > bArr3.length) {
qVar.K();
qVar.x(bigInteger);
byte[] bArr4 = bArr3;
o6.q.H(qVar, bArr, 0, 0, 6, null);
AbstractC7780t.e(bArr4, "element");
o6.q.H(qVar, bArr4, 0, 0, 6, null);
messageDigest.update(qVar.a(), 0, qVar.v());
byte[] digest7 = messageDigest.digest();
bArr3 = new byte[bArr4.length + digest7.length];
System.arraycopy(bArr4, 0, bArr3, 0, bArr4.length);
System.arraycopy(digest7, 0, bArr3, bArr4.length, digest7.length);
digest5 = digest5;
digest3 = digest3;
m9 = m9;
digest6 = digest6;
}
byte[] bArr5 = bArr3;
o6.n nVar = m9;
byte[] bArr6 = digest6;
byte[] bArr7 = digest3;
byte[] bArr8 = digest5;
AbstractC7780t.e(bArr5, "element");
AbstractC7780t.c(digest2);
nVar.g(2, bArr5, digest2);
this.f52581e = nVar.f();
String str2 = (String) this.f52565M.get(5);
InterfaceC7120i n9 = n(str2);
if (n9 == null) {
throw new IOException("Unsupported MAC: " + str2);
}
this.f52579c = n9;
e eVar = f52555Y;
AbstractC7780t.e(bArr6, "element");
AbstractC7780t.c(messageDigest);
byte[] e9 = eVar.e(qVar, bigInteger, bArr, bArr6, messageDigest, n9.d());
AbstractC7780t.e(e9, "element");
n9.e(e9);
this.f52561I = new byte[n9.d()];
this.f52562J = new byte[n9.d()];
o6.n m10 = m((String) this.f52565M.get(2));
if (m10 == null) {
return;
}
this.f52578b = m10;
byte[] bArr9 = bArr7;
while (m10.c() > bArr9.length) {
qVar.K();
qVar.x(bigInteger);
o6.q.H(qVar, bArr, 0, 0, 6, null);
AbstractC7780t.e(bArr9, "element");
o6.q.H(qVar, bArr9, 0, 0, 6, null);
messageDigest.update(qVar.a(), 0, qVar.v());
byte[] digest8 = messageDigest.digest();
byte[] bArr10 = new byte[bArr9.length + digest8.length];
System.arraycopy(bArr9, 0, bArr10, 0, bArr9.length);
System.arraycopy(digest8, 0, bArr10, bArr9.length, digest8.length);
bArr9 = bArr10;
}
AbstractC7780t.e(bArr9, "element");
AbstractC7780t.c(digest);
m10.g(1, bArr9, digest);
this.f52557E = m10.f();
InterfaceC7120i n10 = n((String) this.f52565M.get(4));
if (n10 == null) {
return;
}
this.f52580d = n10;
e eVar2 = f52555Y;
AbstractC7780t.e(bArr8, "element");
byte[] e10 = eVar2.e(qVar, bigInteger, bArr, bArr8, messageDigest, n10.d());
AbstractC7780t.e(e10, "element");
n10.e(e10);
} catch (Exception e11) {
e11.printStackTrace();
throw new IOException(e11.getMessage());
}
}
private final void H(byte[] bArr, byte[] bArr2) {
List<String> s02;
List s03;
String str;
String str2;
C7121j c7121j = new C7121j(bArr);
c7121j.p(17);
C7121j c7121j2 = new C7121j(bArr2);
c7121j2.p(17);
for (int i9 = 0; i9 < 8; i9++) {
String m9 = c7121j2.m();
s02 = x.s0(m9, new char[]{','}, false, 0, 6, null);
String m10 = c7121j.m();
s03 = x.s0(m10, new char[]{','}, false, 0, 6, null);
String str3 = null;
for (String str4 : s02) {
Iterator it = s03.iterator();
while (true) {
if (it.hasNext()) {
str2 = it.next();
if (AbstractC7780t.a((String) str2, str4)) {
break;
}
} else {
str2 = 0;
break;
}
}
str3 = str2;
if (str3 != null) {
break;
}
}
List list = this.f52565M;
if (str3 == null) {
switch (i9) {
case 0:
str = "kex";
break;
case 1:
str = "server host key";
break;
case 2:
str = "enc c2s";
break;
case 3:
str = "enc s2c";
break;
case 4:
str = "mac c2s";
break;
case 5:
str = "mac s2c";
break;
case 6:
str = "comp c2s";
break;
case 7:
str = "comp s2c";
break;
default:
str = String.valueOf(i9);
break;
}
throw new IOException("Algorithm negotiation failed (" + str + "; C: [" + m9 + "], S: [" + m10 + "])");
}
list.set(i9, str3);
}
}
private final void I() {
P(new o6.q(200).O(80).J("lcg@lonelycatgames.com").y(true));
}
private final byte[] J() {
String f9 = f52555Y.f();
try {
new AbstractC7118g.f(this, null, null);
new AbstractC7118g.C0799g(this, null, null);
f9 = (f9 + ",diffie-hellman-group14-sha1") + ",diffie-hellman-group14-sha256";
} catch (Exception e9) {
e9.printStackTrace();
}
o6.q qVar = this.f52571S;
qVar.O(20);
this.f52564L.a(qVar.a(), qVar.v(), 16);
qVar.I(16);
qVar.J(f9);
qVar.J("ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256");
String w8 = w();
qVar.J(w8);
qVar.J(w8);
String g9 = f52555Y.g();
qVar.J(g9);
qVar.J(g9);
qVar.J("none");
qVar.J("none");
qVar.J("");
qVar.J("");
qVar.y(false);
qVar.E(0);
qVar.p(5);
byte[] t9 = qVar.t();
P(qVar);
return t9;
}
private final void K() {
P(this.f52571S.O(21));
}
private final void N(o6.q qVar, o6.n nVar, InterfaceC7120i interfaceC7120i, int i9, int i10) {
n.d e9 = nVar.e();
n.d dVar = n.d.f52549a;
String str = pWhGPktqxGVuO.SQIE;
if (e9 != dVar) {
throw new IOException(str);
}
if (i9 == 262144 || interfaceC7120i == null) {
interfaceC7120i = null;
}
int v8 = i10 - qVar.v();
while (v8 > 0) {
qVar.K();
int min = Math.min(v8, qVar.a().length);
h hVar = this.f52568P;
if (hVar != null) {
hVar.g(qVar.a(), 0, min);
}
if (interfaceC7120i != null) {
interfaceC7120i.b(qVar.a(), 0, min);
}
v8 -= min;
}
if (interfaceC7120i != null) {
interfaceC7120i.a(qVar.a(), 0);
}
throw new IOException(str);
}
private final void O() {
this.f52571S.r();
AbstractC7113b v8 = v(this.f52571S.j());
if (v8 != null) {
v8.b(this.f52571S.j());
}
}
private final void c() {
this.f52571S.r();
AbstractC7113b v8 = v(this.f52571S.j());
if (v8 != null) {
v8.d();
}
}
private final void d() {
int g9;
o6.q qVar = this.f52571S;
qVar.r();
AbstractC7113b v8 = v(qVar.j());
if (v8 == null || (g9 = qVar.g()) == 0) {
return;
}
try {
v8.x(qVar.a(), qVar.d(), g9);
v8.n(this.f52571S, g9);
} catch (IOException unused) {
v8.d();
}
}
private final void e() {
this.f52571S.r();
AbstractC7113b v8 = v(this.f52571S.j());
if (v8 != null) {
v8.e();
}
}
private final void f() {
int g9;
o6.q qVar = this.f52571S;
qVar.r();
AbstractC7113b v8 = v(qVar.j());
qVar.j();
if (v8 != null && (g9 = qVar.g()) != 0) {
v8.z(qVar.a(), qVar.d(), g9);
v8.n(qVar, g9);
}
}
private final void g() {
o6.q qVar = this.f52571S;
qVar.r();
AbstractC7113b v8 = v(qVar.j());
if (v8 != null) {
v8.v(0);
}
}
private final void h() {
o6.q qVar = this.f52571S;
qVar.r();
AbstractC7113b v8 = v(qVar.j());
if (v8 == null) {
return;
}
v8.r(qVar.j());
v8.q(false);
v8.t(0);
}
private final void i() {
int i9;
this.f52571S.r();
AbstractC7113b v8 = v(this.f52571S.j());
if (v8 != null) {
String m9 = this.f52571S.m();
boolean f9 = this.f52571S.f();
if (AbstractC7780t.a(m9, "exit-status")) {
v8.r(this.f52571S.j());
i9 = 99;
} else {
i9 = 100;
}
if (f9) {
P(this.f52571S.P(i9, v8.j()));
}
}
}
private final void j() {
this.f52571S.r();
AbstractC7113b v8 = v(this.f52571S.j());
if (v8 == null) {
return;
}
v8.v(1);
}
private final o6.n m(String str) {
o6.n cVar;
D7.d dVar = (D7.d) this.f52566N.get(str);
if (dVar == null || (cVar = (o6.n) ((InterfaceC7625a) dVar).c()) == null) {
cVar = AbstractC7780t.a(str, "none") ? new n.c() : null;
}
return cVar;
}
private final InterfaceC7120i n(String str) {
D7.d dVar = (D7.d) f52556Z.get(str);
if (dVar != null) {
return (InterfaceC7120i) ((InterfaceC7625a) dVar).c();
}
return null;
}
private final void p(String str) {
if (this.f52568P != null) {
try {
P(this.f52571S.O(1).E(3).J(str).J("en"));
o();
} catch (Exception unused) {
} catch (Throwable th) {
this.f52568P = null;
throw th;
}
this.f52568P = null;
}
}
private final void q(o6.q qVar) {
if (this.f52578b != null) {
synchronized (this.f52564L) {
qVar.w(this.f52557E, this.f52564L);
byte b9 = qVar.a()[4];
this.f52564L.a(qVar.a(), qVar.v() - b9, b9);
C6709J c6709j = C6709J.f49946a;
}
} else {
synchronized (this.f52564L) {
try {
qVar.w(8, this.f52564L);
C6709J c6709j2 = C6709J.f49946a;
} catch (Throwable th) {
throw th;
}
}
}
InterfaceC7120i interfaceC7120i = this.f52580d;
if (interfaceC7120i != null) {
interfaceC7120i.c(this.f52560H);
interfaceC7120i.b(qVar.a(), 0, qVar.v());
qVar.s(interfaceC7120i.d());
interfaceC7120i.a(qVar.a(), qVar.v());
}
o6.n nVar = this.f52578b;
if (nVar != null) {
byte[] a9 = qVar.a();
nVar.j(a9, qVar.v(), a9);
}
if (interfaceC7120i != null) {
qVar.I(interfaceC7120i.d());
}
}
private final AbstractC7113b v(int i9) {
Object obj;
AbstractC7113b abstractC7113b;
synchronized (this.f52575W) {
try {
Iterator it = this.f52575W.iterator();
while (true) {
if (!it.hasNext()) {
obj = null;
break;
}
obj = it.next();
if (((AbstractC7113b) obj).g() == i9) {
break;
}
}
abstractC7113b = (AbstractC7113b) obj;
} catch (Throwable th) {
throw th;
}
}
return abstractC7113b;
}
private final String w() {
String c02;
int i9 = 4 << 0;
c02 = AbstractC6821C.c0(this.f52566N.keySet(), ",", null, null, 0, null, null, 62, null);
return c02;
}
public final boolean B() {
return this.f52568P != null;
}
public final void D() {
int i9;
InterfaceC7120i interfaceC7120i;
int b9;
while (true) {
o6.q qVar = this.f52571S;
qVar.K();
h hVar = this.f52568P;
if (hVar != null) {
hVar.g(qVar.a(), 0, this.f52581e);
}
qVar.L(qVar.v() + this.f52581e);
o6.n nVar = this.f52577a;
if (nVar != null && nVar != null) {
try {
nVar.j(qVar.a(), this.f52581e, qVar.a());
} catch (GeneralSecurityException e9) {
throw new IOException(e9.getMessage());
}
}
int j9 = qVar.j();
if (j9 < 5 || j9 > 262144) {
o6.n nVar2 = this.f52577a;
AbstractC7780t.c(nVar2);
N(qVar, nVar2, this.f52579c, j9, 262144);
}
int i10 = (j9 + 4) - this.f52581e;
if (qVar.v() + i10 > qVar.a().length) {
byte[] bArr = new byte[qVar.v() + i10];
System.arraycopy(qVar.a(), 0, bArr, 0, qVar.v());
qVar.o(bArr);
}
if (i10 % this.f52581e != 0) {
o6.n nVar3 = this.f52577a;
AbstractC7780t.c(nVar3);
N(qVar, nVar3, this.f52579c, j9, 262144 - this.f52581e);
}
if (i10 > 0) {
h hVar2 = this.f52568P;
if (hVar2 != null) {
hVar2.g(qVar.a(), qVar.v(), i10);
}
qVar.L(qVar.v() + i10);
o6.n nVar4 = this.f52577a;
if (nVar4 != null && nVar4 != null) {
try {
i9 = i10;
nVar4.i(qVar.a(), this.f52581e, i10, qVar.a(), this.f52581e);
interfaceC7120i = this.f52579c;
if (interfaceC7120i == null) {
interfaceC7120i.c(this.f52559G);
interfaceC7120i.b(qVar.a(), 0, qVar.v());
byte[] bArr2 = this.f52561I;
byte[] bArr3 = null;
if (bArr2 == null) {
AbstractC7780t.r("s2cmacResult1");
bArr2 = null;
}
interfaceC7120i.a(bArr2, 0);
h hVar3 = this.f52568P;
if (hVar3 != null) {
byte[] bArr4 = this.f52562J;
if (bArr4 == null) {
AbstractC7780t.r("s2cmacResult2");
bArr4 = null;
}
byte[] bArr5 = this.f52562J;
if (bArr5 == null) {
AbstractC7780t.r("s2cmacResult2");
bArr5 = null;
}
hVar3.g(bArr4, 0, bArr5.length);
}
byte[] bArr6 = this.f52561I;
if (bArr6 == null) {
AbstractC7780t.r("s2cmacResult1");
bArr6 = null;
}
byte[] bArr7 = this.f52562J;
if (bArr7 == null) {
AbstractC7780t.r("s2cmacResult2");
} else {
bArr3 = bArr7;
}
if (!Arrays.equals(bArr6, bArr3)) {
if (i9 > 262144) {
throw new IOException("MAC Error");
}
o6.n nVar5 = this.f52577a;
AbstractC7780t.c(nVar5);
N(qVar, nVar5, interfaceC7120i, j9, 262144 - i9);
}
}
this.f52559G++;
b9 = qVar.b() & 255;
if (b9 != 1) {
qVar.n();
qVar.r();
throw new IOException("SSH_MSG_DISCONNECT: " + qVar.j() + ' ' + qVar.m() + ' ' + qVar.m());
}
if (b9 == 2) {
continue;
} else if (b9 == 3) {
qVar.n();
qVar.r();
qVar.j();
} else if (b9 == 4) {
qVar.n();
qVar.r();
} else if (b9 == 52) {
this.f52573U = true;
qVar.n();
return;
} else {
if (b9 != 93) {
qVar.n();
return;
}
qVar.n();
qVar.r();
AbstractC7113b v8 = v(qVar.j());
if (v8 != null) {
v8.b(qVar.j());
}
}
} catch (GeneralSecurityException e10) {
throw new IOException(e10.getMessage());
}
}
}
i9 = i10;
interfaceC7120i = this.f52579c;
if (interfaceC7120i == null) {
}
this.f52559G++;
b9 = qVar.b() & 255;
if (b9 != 1) {
}
}
}
public final void G(AbstractC7113b abstractC7113b) {
AbstractC7780t.f(abstractC7113b, "c");
synchronized (this.f52575W) {
try {
this.f52575W.remove(abstractC7113b);
} catch (Throwable th) {
throw th;
}
}
}
public final void L(int i9) {
this.f52570R = i9;
}
public abstract void M(String str);
public final void P(o6.q qVar) {
AbstractC7780t.f(qVar, "buffer");
synchronized (this.f52563K) {
try {
try {
q(qVar);
h hVar = this.f52568P;
if (hVar != null) {
hVar.h(qVar);
this.f52560H++;
}
} catch (GeneralSecurityException e9) {
throw new IOException(e9.getMessage());
}
} catch (Throwable th) {
throw th;
}
}
}
public final void b(AbstractC7113b abstractC7113b) {
AbstractC7780t.f(abstractC7113b, "c");
synchronized (this.f52575W) {
try {
int i9 = this.f52576X;
this.f52576X = i9 + 1;
abstractC7113b.s(i9);
this.f52575W.add(abstractC7113b);
} catch (Throwable th) {
throw th;
}
}
}
protected abstract void k(String str, byte[] bArr, String str2);
public final void l(String str, int i9, String str2, String str3, AbstractC7119h abstractC7119h, String str4) {
boolean z8;
String str5;
boolean D8;
String str6;
o6.p aVar;
boolean z9;
o6.p pVar;
List t02;
AbstractC7780t.f(str, "host");
AbstractC7780t.f(str2, "userName");
AbstractC7780t.f(str4, "clientVersion");
if (this.f52568P != null) {
throw new IOException("already connected");
}
this.f52567O = str4;
h hVar = new h();
this.f52568P = hVar;
try {
Socket socket = new Socket();
socket.connect(new InetSocketAddress(str, i9), this.f52570R);
socket.setTcpNoDelay(true);
hVar.e(socket.getInputStream());
hVar.f(socket.getOutputStream());
int i10 = this.f52570R;
if (i10 > 0) {
socket.setSoTimeout(i10);
}
this.f52569Q = socket;
String str7 = str4 + '\n';
OutputStream c9 = hVar.c();
if (c9 != null) {
byte[] bytes = str7.getBytes(C1160d.f4033b);
AbstractC7780t.e(bytes, "getBytes(...)");
c9.write(bytes);
c9.flush();
}
do {
byte[] a9 = this.f52571S.a();
z8 = false;
int i11 = 0;
while (true) {
if (i11 >= a9.length) {
break;
}
InputStream b9 = hVar.b();
AbstractC7780t.c(b9);
int read = b9.read();
if (read < 0) {
throw new IOException("connection is closed by server");
}
if (read != 10) {
a9[i11] = (byte) read;
i11++;
} else if (i11 > 0 && a9[i11 - 1] == 13) {
i11--;
}
}
str5 = new String(a9, 0, i11, C1160d.f4033b);
D8 = w.D(str5, "SSH-", false, 2, null);
} while (!D8);
if (str5.length() < 7 || (str5.charAt(4) == '1' && str5.charAt(6) != '9')) {
throw new IOException("invalid server's version string");
}
byte[] J8 = J();
this.f52572T = str5;
D();
if (this.f52571S.c() != 20) {
throw new IOException("invalid protocol: " + this.f52571S.c());
}
AbstractC7118g E8 = E(this.f52571S, J8);
do {
D();
if (E8.f52501n != this.f52571S.c()) {
throw new IOException("invalid protocol(kex): " + this.f52571S.c());
}
if (!E8.g(this, this.f52571S, str5, str4)) {
throw new IOException("verify: false");
}
} while (E8.f52501n != 0);
String e9 = E8.e();
String f9 = E8.f();
AbstractC7780t.e(f9, "getKeyType(...)");
k(f9, E8.f52497j, e9);
K();
D();
if (this.f52571S.c() != 21) {
throw new IOException("invalid protocol(newkyes): " + this.f52571S.c());
}
F(this.f52571S, E8);
P(this.f52571S.O(5).J("ssh-userauth"));
D();
if (this.f52571S.c() != 6) {
throw new IOException("Authentication failed");
}
p.b bVar = new p.b(this);
ArrayList arrayList = new ArrayList();
boolean a10 = bVar.a(this, str2);
this.f52573U = a10;
if (!a10) {
if (bVar.f52604b == null) {
bVar.f52604b = "password,publickey";
}
String str8 = bVar.f52604b;
AbstractC7780t.e(str8, "methods");
Locale locale = Locale.US;
AbstractC7780t.e(locale, "US");
String lowerCase = str8.toLowerCase(locale);
AbstractC7780t.e(lowerCase, "toLowerCase(...)");
t02 = x.t0(lowerCase, new String[]{","}, false, 0, 6, null);
String[] strArr = (String[]) t02.toArray(new String[0]);
Collections.addAll(arrayList, Arrays.copyOf(strArr, strArr.length));
}
Iterator it = arrayList.iterator();
boolean z10 = false;
while (true) {
if (!it.hasNext()) {
break;
}
String str9 = (String) it.next();
int hashCode = str9.hashCode();
if (hashCode != 559002108) {
if (hashCode != 1216985755) {
if (hashCode == 1446930262 && str9.equals("publickey") && abstractC7119h != null && !abstractC7119h.m()) {
pVar = new p.d(this, abstractC7119h);
z9 = true;
if (pVar != null && pVar.a(this, str2)) {
this.f52573U = true;
z10 = z9;
break;
}
z10 = z9;
}
} else if (str9.equals("password")) {
if (str3 != null) {
aVar = new p.c(this, str3);
z8 = true;
o6.p pVar2 = aVar;
z9 = z10;
pVar = pVar2;
if (pVar != null) {
}
z10 = z9;
}
aVar = null;
o6.p pVar22 = aVar;
z9 = z10;
pVar = pVar22;
if (pVar != null) {
}
z10 = z9;
}
z9 = z10;
pVar = null;
if (pVar != null) {
}
z10 = z9;
} else {
if (str9.equals("keyboard-interactive")) {
if (str3 != null) {
aVar = new p.a(this, str3);
z8 = true;
o6.p pVar222 = aVar;
z9 = z10;
pVar = pVar222;
if (pVar != null) {
}
z10 = z9;
}
aVar = null;
o6.p pVar2222 = aVar;
z9 = z10;
pVar = pVar2222;
if (pVar != null) {
}
z10 = z9;
}
z9 = z10;
pVar = null;
if (pVar != null) {
}
z10 = z9;
}
}
if (this.f52573U) {
Thread thread = new Thread(this);
thread.setName("Connect thread " + str + " session");
thread.start();
this.f52574V = thread;
return;
}
p("");
if (abstractC7119h == null || abstractC7119h.m()) {
if (str3 == null) {
str6 = "Enter password or private key";
} else if (z8) {
str6 = "Invalid password";
} else {
str6 = "Server doesn't support login by password\nSupported methods: " + bVar.f52604b;
}
} else if (z10) {
str6 = "Invalid private key";
} else {
str6 = "Server doesn't support login by public key\nSupported methods: " + bVar.f52604b;
}
throw new f(str6);
} catch (Exception e10) {
p(e10.toString());
IOException iOException = e10 instanceof IOException ? (IOException) e10 : null;
if (iOException == null) {
throw new IOException(e10.getMessage());
}
}
}
public final void o() {
ArrayList arrayList;
if (this.f52568P == null) {
return;
}
synchronized (this.f52575W) {
try {
arrayList = new ArrayList(this.f52575W);
} catch (Throwable th) {
throw th;
}
}
Iterator it = arrayList.iterator();
while (it.hasNext()) {
((AbstractC7113b) it.next()).d();
}
synchronized (this.f52563K) {
try {
if (this.f52574V != null) {
Thread.yield();
Thread thread = this.f52574V;
if (thread != null) {
thread.interrupt();
}
this.f52574V = null;
}
C6709J c6709j = C6709J.f49946a;
} catch (Throwable th2) {
throw th2;
}
}
try {
h hVar = this.f52568P;
if (hVar != null) {
hVar.a();
}
Socket socket = this.f52569Q;
if (socket != null) {
socket.close();
}
} catch (IOException unused) {
} catch (Throwable th3) {
this.f52568P = null;
this.f52569Q = null;
throw th3;
}
this.f52568P = null;
this.f52569Q = null;
}
public final o6.q r() {
return this.f52571S;
}
@Override
public void run() {
o6.q qVar;
int i9 = 7 << 0;
while (true) {
int i10 = 0;
AbstractC7118g abstractC7118g = null;
while (this.f52568P != null) {
try {
try {
D();
qVar = this.f52571S;
int c9 = qVar.c();
if (abstractC7118g != null && abstractC7118g.f52501n == c9) {
String str = this.f52572T;
AbstractC7780t.c(str);
String str2 = this.f52567O;
AbstractC7780t.c(str2);
if (!abstractC7118g.g(this, qVar, str, str2)) {
throw new IOException(wLxQBPugaQkCAi.ZSTNIExgdsDbQ);
}
} else if (c9 == 20) {
abstractC7118g = E(qVar, null);
} else if (c9 != 21) {
switch (c9) {
case 80:
A();
break;
case 81:
case 82:
break;
default:
switch (c9) {
case 90:
qVar.r();
throw new IOException("SSH_MSG_CHANNEL_OPEN: " + qVar.m());
case 91:
C();
break;
case 92:
h();
break;
case 93:
O();
break;
case 94:
d();
break;
case 95:
f();
break;
case 96:
e();
break;
case 97:
c();
break;
case 98:
i();
break;
case 99:
j();
break;
case ModuleDescriptor.MODULE_VERSION:
g();
break;
default:
System.err.println("Session.run: unsupported type " + c9);
break;
}
}
}
i10 = 0;
} catch (InterruptedIOException e9) {
if (i10 >= 1) {
throw e9;
}
I();
i10++;
}
} catch (Exception e10) {
e10.printStackTrace();
}
}
try {
o();
this.f52568P = null;
return;
} catch (Throwable th) {
this.f52568P = null;
throw th;
}
K();
AbstractC7780t.c(abstractC7118g);
F(qVar, abstractC7118g);
}
}
public final o6.n s() {
return this.f52578b;
}
public final int t() {
return this.f52557E;
}
public final InterfaceC7120i u() {
return this.f52580d;
}
public final List x() {
return this.f52565M;
}
public final byte[] y() {
return this.f52558F;
}
public final int z() {
return this.f52570R;
}
}