From 3aa13a9909b735b8a186a3711fc4bee4f741e710 Mon Sep 17 00:00:00 2001 From: Mateo Date: Tue, 6 Aug 2024 10:39:02 +0200 Subject: [PATCH] Implements virtual threads --- .idea/git_toolbox_prj.xml | 15 +++++++++++++++ .idea/remote-targets.xml | 19 +++++++++++++++++++ .../usertwist/exploit/tools/Parser.java | 10 +++++++--- 3 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 .idea/git_toolbox_prj.xml create mode 100644 .idea/remote-targets.xml diff --git a/.idea/git_toolbox_prj.xml b/.idea/git_toolbox_prj.xml new file mode 100644 index 0000000..02b915b --- /dev/null +++ b/.idea/git_toolbox_prj.xml @@ -0,0 +1,15 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/remote-targets.xml b/.idea/remote-targets.xml new file mode 100644 index 0000000..92372d3 --- /dev/null +++ b/.idea/remote-targets.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/fr/motysten/usertwist/exploit/tools/Parser.java b/src/fr/motysten/usertwist/exploit/tools/Parser.java index 2ce115f..79a525e 100644 --- a/src/fr/motysten/usertwist/exploit/tools/Parser.java +++ b/src/fr/motysten/usertwist/exploit/tools/Parser.java @@ -15,18 +15,22 @@ public class Parser { } } - public static void asyncGetPass(JSONArray usersArray, int rotation) { + public static void asyncGetPass(JSONArray usersArray, int rotation) throws InterruptedException { for (int i = 0; i < usersArray.length(); i++) { int finalI = i; - new Thread(() -> { + + Runnable r = () -> { JSONObject user = usersArray.getJSONObject(finalI); String login = user.getString("username"); String password = Cesar.rotate(user.getString("data"), rotation); System.out.println((finalI + 1) + ". " + login + " => " + password); - }).start(); + }; + + Thread t = Thread.startVirtualThread(r); + t.join(); } }