-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
executable file
·161 lines (147 loc) · 6.94 KB
/
index.html
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="assets/css/index.css">
<script src="
https://cdn.jsdelivr.net/npm/[email protected]/dist/index.min.js
"></script>
<title>Fword SSH</title>
</head>
<body>
<div class="big-container">
<div class="left-content">
<img src="assets/img/data.gif" alt="prompt gif">
</div>
<div class="list">
<div id="terminal"></div>
<h2>
My Super Vps List
</h2>
<div class="listVps">
</div>
</div>
</div>
</body>
<script>
const seeIcon = '<svg onclick="ipInformations(this, true)" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>eye-outline</title><path d="M12,9A3,3 0 0,1 15,12A3,3 0 0,1 12,15A3,3 0 0,1 9,12A3,3 0 0,1 12,9M12,4.5C17,4.5 21.27,7.61 23,12C21.27,16.39 17,19.5 12,19.5C7,19.5 2.73,16.39 1,12C2.73,7.61 7,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C15.76,17.5 19.17,15.36 20.82,12C19.17,8.64 15.76,6.5 12,6.5C8.24,6.5 4.83,8.64 3.18,12Z" /></svg>'
const seeOfIcon = '<svg onclick="ipInformations(this, false)" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>eye-off-outline</title><path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" /></svg>'
const {
Buffer,
createECDH,
createCipheriv,
createDecipheriv,
pbkdf2,
pbkdf2Sync,
} = window.browserCrypto;
let sshList;
async function getData() {
const response = await fetch('assets/json/content.json');
sshList = await response.json();
generateListVps(sshList);
}
const ipInformations = (element, status) => {
const index = element?.parentElement?.getAttribute('id')?.split('-')[1];
if (status) {
document.getElementById(`ip-${index}`).innerHTML = sshList[Number(index)]?.ip
document.getElementById(`server-${index}`).innerHTML = `<div>${sshList[Number(index)]?.server}</div>` + seeOfIcon
} else {
document.getElementById(`ip-${index}`).innerHTML = "*.*.*.*"
document.getElementById(`server-${index}`).innerHTML = `<div>${sshList[Number(index)]?.server}</div>` + seeIcon
}
}
function generateListVps(list) {
for (let index = 0; index < list.length; index++) {
const element = list[index];
const vpsDiv = document.createElement('div');
vpsDiv.setAttribute('class', 'vps');
const imageDiv = document.createElement('div');
const image = document.createElement('img');
image.src = "assets/img/robot.png";
imageDiv.appendChild(image);
const detailsDiv = document.createElement('div');
detailsDiv.setAttribute('class', 'details');
const serverName = document.createElement('div');
serverName.innerHTML = `<div>${element?.server}</div>`;
serverName.setAttribute('class', 'serverName')
serverName.setAttribute('id', `server-${index}`)
const serverIp = document.createElement('div');
serverIp.setAttribute('id', `ip-${index}`)
serverIp.innerText = "*.*.*.*";
serverName.innerHTML = serverName.innerHTML + seeIcon
detailsDiv.appendChild(serverName);
detailsDiv.appendChild(serverIp);
const buttonsDiv = document.createElement('div');
buttonsDiv.setAttribute('class', 'actions');
const commandBtn = document.createElement('button');
commandBtn.innerText = "Command";
commandBtn.addEventListener('click', () => {
copyCommandToClipboard(element);
})
const passwordBtn = document.createElement('button');
passwordBtn.innerText = "Password";
passwordBtn.addEventListener('click', () => {
copyPasswordToClipboard(element);
})
buttonsDiv.appendChild(commandBtn);
buttonsDiv.appendChild(passwordBtn);
detailsDiv.appendChild(buttonsDiv);
vpsDiv.appendChild(imageDiv);
vpsDiv.appendChild(detailsDiv);
document.querySelector('.listVps').appendChild(vpsDiv);
}
}
async function copyCommandToClipboard(data) {
try {
const response = await fetch('http://localhost:5556/start-terminal', {
method: 'POST',
body: JSON.stringify({
os: navigator.platform,
command: `ssh ${data?.user}@${data?.ip}`
}),
headers: {
'Content-Type': 'application/json'
}
});
const message = await response.json();
showToast(message?.message, 5000);
} catch (error) {
showToast("Server not found! please run command 'fwordssh app'", 10000);
}
}
function decrypt(encryptedText, password, salt) {
const [iv, encrypted] = encryptedText.split(':').map((part) => Buffer.from(part, 'hex'));
const key = pbkdf2Sync(password, salt, 10000, 32, 'sha256');
const decipher = createDecipheriv('aes-256-cbc', key, iv);
let decrypted = decipher.update(encrypted, 'hex', 'utf-8');
decrypted += decipher.final('utf-8');
return decrypted;
}
function copyPasswordToClipboard(data) {
try {
const salt = prompt('Enter this vps salt (you can use same salt for all vps!');
navigator.clipboard.writeText(
decrypt(data?.pwd, 'your_password_here', String(salt))
);
showToast("Decrypted Password copied to clipboard! Have a good time hacking!", 5000);
} catch (error) {
showToast("Incorrect magic salt!", 5000);
}
}
const showToast = (message, duration) => {
const toastWrapper = document.createElement('div');
toastWrapper.setAttribute('class', 'ToastWrapper')
const messageContent = document.createElement('div');
messageContent.setAttribute('class', 'messageContent')
messageContent.innerHTML = message;
toastWrapper.appendChild(messageContent);
const body = document.querySelector('body');
body.appendChild(toastWrapper);
setTimeout(() => {
toastWrapper.remove();
}, duration);
}
getData();
</script>
</html>