File: edit_bus_send_exploit.bsh

package info (click to toggle)
jedit 5.5.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 14,720 kB
  • sloc: java: 103,377; xml: 96,521; makefile: 43; sh: 42; cpp: 6; python: 6
file content (42 lines) | stat: -rw-r--r-- 931 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import java.util.concurrent.CountDownLatch;

signalStart = new CountDownLatch(1);
signalSent = new CountDownLatch(1);

class Handler implements EBComponent
{
  public void handleMessage(EBMessage message)
  {
    System.err.println("handling starts");
    signalSent.countDown();
    Thread.sleep(200);
    // System.err.println(message.getClass().getName());
    System.err.println("handling ends");
  }
}

h = new Handler();
EditBus.addToBus(h);

th1 = new Thread(new Runnable() {
  public void run()
  {
    signalStart.await();
    System.err.println("th1 will send");
    EditBus.send(new PropertiesChanged(null));
    System.err.println("th1 after send");
  }
});
th1.start();

th2 = new Thread(new Runnable() {
    public void run() {
      signalSent.await();
      th1.interrupt();
      Thread.sleep(1000);
      EditBus.removeFromBus(h);
    }
});
th2.start();
System.err.println("macro done");
signalStart.countDown();