mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2024-11-23 08:50:52 +01:00
Fix rc4 dumper race condition
This commit is contained in:
parent
be074171dc
commit
2fc372bce5
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user