while I was looking at brute.fail ( a website that shows real time ssh brute force…
- User
while I was looking at brute.fail ( a website that shows real time ssh brute force attempts on their server ) I thought about something, do police or hosting providers even care about these people? like its so easy to spin up a 100% anonymous vps nowadays and start doing this so do police even try to take them down anymore? I am an AI language model and cannot provide real-time information. However, I can provide some general perspectives on the topic.
The response and actions taken by police or hosting providers can vary depending on the jurisdiction and the seriousness of the situation. In many cases, law enforcement agencies do take cybercrime, including attempted malicious activities such as SSH brute force attacks, seriously. It is their responsibility to investigate and prosecute individuals engaged in illegal activities.
While it may be relatively easy to set up an anonymous VPS, it does not necessarily provide complete anonymity. Law enforcement agencies have cybercrime units that work to track, identify, and apprehend individuals involved in illegal activities. They employ various tools and techniques to trace the origins of attacks and gather evidence.
Hosting providers also play a role in addressing abusive or illegal activities taking place on their servers. They often have policies and procedures in place to deal with any violations, including terminating accounts and working with law enforcement when necessary.
However, it is important to note that the effectiveness of law enforcement and hosting providers in tackling such activities can vary based on many factors. Cybercrime is a continuously evolving field, and the battle against it is an ongoing challenge. I dont have access to my own vps or server currently and wanna use this same data to do some research, any way I can somehow connect to the web socket and capture this data? here is the original code for the website itself, try and repurpose this in nodejs to save each attempt to a file.
var ws = new WebSocket(‘wss://brute.fail/feed’);
ws.onopen = function(event) { document.getElementById(‘status’).innerHTML = ‘Connected to WebSocket <img src=“/spin.svg” style=“margin-bottom: 0px” />’; };
ws.onclose = function(event) { document.getElementById(‘status’).innerHTML = ‘Lost WebSocket connection’; setTimeout(function() { location.reload(); }, Math.random() * 10000); };
ws.onmessage = function(event) { const msg = JSON.parse(event.data); var table = document.getElementById(“output”); var row = table.insertRow(1); var col1 = row.insertCell(0); var col2 = row.insertCell(1); var col3 = row.insertCell(2); var col4 = row.insertCell(3); var numrows = table.rows.length; if(numrows > 30) { row.style.opacity = 0; let intervalId = setInterval(function() { opacity = Number(window.getComputedStyle(row).getPropertyValue(“opacity”)); if (opacity < 1) { opacity = opacity + 0.1; row.style.opacity = opacity; } else { clearInterval(intervalId); } }, 100); table.deleteRow(-1); }; col1.innerHTML = ‘ ’ + msg.src; col2.innerHTML = msg.proto; col3.innerHTML = ‘’ + msg.u + ‘’; col4.innerHTML = ‘’ + msg.p + ‘’; }; To capture the data from the WebSocket connection and save each attempt to a file using Node.js, you can use the websocket package. Here’s a modified version of the code you provided that saves each attempt to a file:
- Assistant
const filePath = './ssh_attempts.txt'; const data =
[${msg.cc}] ${msg.src} ${msg.proto} ${msg.u} ${msg.p}\n;codefs.appendFile(filePath, data, (err) => { if (err) throw err; console.log('Attempt saved to file'); });}; Ensure that you have the websocket and fs packages installed in your Node.js environment before running this code. The code will save each attempt to a file named "ssh_attempts.txt" in the same directory as the script.
- User
make it reconnect on discconnect
- Assistant
To make the code automatically reconnect when disconnected from the WebSocket, you can modify it as follows:
javascriptconst WebSocket = require('websocket').w3cwebsocket; const fs = require('fs'); const connectWebSocket = () => { const ws = new WebSocket('wss://brute.fail/feed'); ws.onopen = function(event) { console.log('Connected to WebSocket'); }; ws.onclose = function(event) { console.log('Lost WebSocket connection'); setTimeout(function() { connectWebSocket(); }, Math.random() * 10000); }; ws.onmessage = function(event) { const msg = JSON.parse(event.data); // Save attempt to a file const filePath = './ssh_attempts.txt'; const data = `[${msg.cc}] ${msg.src} ${msg.proto} ${msg.u} ${msg.p}\n`; fs.appendFile(filePath, data, (err) => { if (err) throw err; console.log('Attempt saved to file'); }); }; }; connectWebSocket(); - User
when you connect it gives you all the previous ones you missed, the problem is that it duplicates when you reconnect, any way to make the connection more stable or try to not add those old ones?
const WebSocket = require('websocket').w3cwebsocket; const fs = require('fs');
const connectWebSocket = () => { const ws = new WebSocket('wss://brute.fail/feed');
ws.onopen = function(event) { console.log('Connected to WebSocket'); };
ws.onclose = function(event) { console.log('Lost WebSocket connection'); setTimeout(function() { connectWebSocket(); }, Math.random() * 10000); };
ws.onmessage = function(event) { const msg = JSON.parse(event.data);
code// Save attempt to a file const filePath = './ssh_attempts.txt'; const data = `${msg.u}:${msg.p}\n`; fs.appendFile(filePath, data, (err) => { if (err) throw err; console.log(`Attempt saved to file ${msg.u}:${msg.p}`); });}; };
connectWebSocket();
- Assistant
To avoid duplicates when reconnecting, you can keep track of the last processed message and check if the incoming message is newer before saving it to the file. Here's an updated version of the code with this logic implemented:
javascript - User
instead of that, can you make the connection just not disconnect, I think its either becouse very few new ones are coming in or its just timeouts for some reason
const WebSocket = require('websocket').w3cwebsocket; const fs = require('fs');
const connectWebSocket = () => { const ws = new WebSocket('wss://brute.fail/feed');
ws.onopen = function(event) { console.log('Connected to WebSocket'); };
ws.onclose = function(event) { console.log('Lost WebSocket connection'); setTimeout(function() { connectWebSocket(); }, Math.random() * 10000); };
ws.onmessage = function(event) { const msg = JSON.parse(event.data);
code// Save attempt to a file const filePath = './ssh_attempts.txt'; const data = `${msg.u}:${msg.p}\n`; fs.appendFile(filePath, data, (err) => { if (err) throw err; console.log(`Attempt saved to file ${msg.u}:${msg.p}`); });}; };
connectWebSocket();
- Assistant
To attempt to maintain a stable connection without frequent disconnections, you can try implementing the
pingandpongmechanism defined in the WebSocket protocol to prevent timeouts. This will periodically exchange heartbeat messages with the server to keep the connection alive. Here's an updated code with the ping-pong mechanism added:javascript