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