Fix rc4 dumper race condition

This commit is contained in:
UnfamiliarLegacy 2024-06-27 06:08:21 +02:00
parent be074171dc
commit 2fc372bce5

View File

@ -30,6 +30,7 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
public class Rc4Obtainer { public class Rc4Obtainer {
@ -70,9 +71,17 @@ public class Rc4Obtainer {
for (EncryptedPacketHandler handler : flashPacketHandlers) { for (EncryptedPacketHandler handler : flashPacketHandlers) {
BufferChangeListener bufferChangeListener = new BufferChangeListener() { BufferChangeListener bufferChangeListener = new BufferChangeListener() {
private final AtomicInteger counter = new AtomicInteger(0);
@Override @Override
public void onPacket() { public void onPacket() {
if (handler.isEncryptedStream()) { if (handler.isEncryptedStream()) {
final boolean isShockwave = handler instanceof ShockwavePacketOutgoingHandler;
if (isShockwave && counter.incrementAndGet() != 3) {
return;
}
onSendFirstEncryptedMessage(handler); onSendFirstEncryptedMessage(handler);
handler.getPacketReceivedObservable().removeListener(this); handler.getPacketReceivedObservable().removeListener(this);
} }
@ -99,7 +108,6 @@ public class Rc4Obtainer {
new Thread(() -> { new Thread(() -> {
final long startTime = System.currentTimeMillis(); final long startTime = System.currentTimeMillis();
boolean worked = false; boolean worked = false;
int i = 0; int i = 0;
while (!worked && i < 4) { while (!worked && i < 4) {