mirror of
https://github.com/github/codeql.git
synced 2025-12-20 10:46:30 +01:00
28 lines
992 B
Java
28 lines
992 B
Java
// package test.cwe079.cwe.examples;
|
|
|
|
// import java.net.http.HttpClient;
|
|
// import java.net.http.WebSocket;
|
|
// import java.net.URI;
|
|
// import java.util.*;
|
|
// import java.util.concurrent.*;
|
|
|
|
// public class WebsocketXss {
|
|
// public static void main(String[] args) throws Exception {
|
|
// WebSocket.Listener listener = new WebSocket.Listener() {
|
|
// public CompletionStage<?> onText(WebSocket webSocket, CharSequence message, boolean last) {
|
|
// try {
|
|
// HttpClient client = HttpClient.newBuilder().build();
|
|
// CompletableFuture<WebSocket> ws = client.newWebSocketBuilder()
|
|
// .buildAsync(URI.create("ws://websocket.example.com"), null);
|
|
// ws.get().sendText(message, false);
|
|
// } catch (Exception e) {
|
|
// // TODO: handle exception
|
|
// }
|
|
|
|
// return null;
|
|
// };
|
|
// };
|
|
|
|
// }
|
|
// }
|