-
Notifications
You must be signed in to change notification settings - Fork 0
/
WSPentest.js
64 lines (45 loc) · 1.04 KB
/
WSPentest.js
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
var WebSocket = require('ws');
var cookie = require('cookie');
var standard_input = process.stdin;
const readline = require('readline').createInterface({
input: process.stdin,
output: process.stdout
})
var ws = new WebSocket(
'wss://',
[],
{
'headers': {
'Cookie': cookie.serialize('seesion_ID=lol'),
'origin':'lol.com'
}
}
);
ws.on('open', function open() {
console.log("Client is connected");
});
ws.on('close', function close() {
console.log('disconnected');
});
function lol()
{
console.log("\nPlease input text in command line.");
readline.question(`Enter your data:- `, (userinput) => {
//console.log(`Hi !`)
//connection.sendUTF(`${userinput}`);
if(userinput=="exit")
{ console.log('Terminating websocket connecton');
ws.terminate();
}
else
{
ws.send(`${userinput}`);
//setTimeout(lol, 1000);
}
})
}
lol();
ws.on('message', function incoming(data) {
console.log(`\n\n Output:- `+data+`\n\n`);
lol();
});