UNPKG

ya-express-ntlm

Version:
193 lines (168 loc) 4.65 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Create / Decode NTLM messages</title> <style> .container { width: 800px; margin: 0 auto; text-align: center; display: flex; flex-direction: column; align-items: center; font-family: Arial, 'Lucida Grande', 'Lucida Sans Unicode', sans-serif; } .tab-control { margin-bottom: 20px; } .tab { display: inline-block; height: 30px; width: 240px; line-height: 30px; cursor: pointer; background-color: white; border: 1px solid #ccc; } .tab.active { background-color: #f0f0f0; font-weight: bold; } .tab-content { display: none; max-width: 800px; min-width: 800px; flex-direction: column; } .tab-content.active { display: flex; } .create-fields-container { display: flex; flex-direction: row; justify-content: space-between; } .form-row { display: flex; margin-bottom: 10px; flex-direction: column; align-items: flex-start; } .form-row label { margin-right: 10px; } h4 { margin-top: 10px; margin-bottom: 10px; } .message { width: 100%; height: 150px; box-sizing: border-box; } .btn { width: 100%; padding: 5px 25px; margin-top: 10px; } #decodedMessage, #createdMessages { background-color: aliceblue; padding: 5px; margin-top: 15px; overflow-wrap: anywhere; /*noinspection CssInvalidPropertyValue*/ text-wrap: balance; text-align: left; } </style> </head> <body onload="showTab('decode')"> <div class="container"> <div class="tab-control"> <div class="tab" id="createTabLbl" onclick="showTab('create')">Create NTLM messages</div> <div class="tab" id="decodeTabLbl" onclick="showTab('decode')">Decode NTLM messages</div> </div> <div id="createTab" class="tab-content"> <div class="create-fields-container"> <div class="form-row"> <label for="domain">Domain:</label> <input type="text" id="domain"> </div> <div class="form-row"> <label for="workstation">Workstation:</label> <input type="text" id="workstation"> </div> <div class="form-row"> <label for="username">Username:</label> <input type="text" id="username"> </div> <div class="form-row"> <label for="password">Password:</label> <input type="text" id="password"> </div> </div> <button onclick="create()">Create</button> <pre id="createdMessages"></pre> </div> <div id="decodeTab" class="tab-content"> <h4>NTLM message base64 encoded</h4> <textarea class="message" id="message" rows="5" cols="80"></textarea> <button class="btn" onclick="decodeMessage()">Decode</button> <pre id="decodedMessage"></pre> </div> </div> <script> function showTab (tabName) { const tabs = document.querySelectorAll('.tab'); const tabContents = document.querySelectorAll('.tab-content'); tabs.forEach(function (tab) { tab.classList.remove('active'); }); tabContents.forEach(function (tabContent) { tabContent.classList.remove('active'); }); document.getElementById(tabName + 'Tab').classList.add('active'); document.getElementById(tabName + 'TabLbl').classList.add('active'); } const create = () => { const data = ['domain', 'workstation', 'username', 'password' ].reduce((accum, p) => { accum[p] = document.getElementById(p).value || ''; return accum }, {}); fetch('http://{{host}}:{{port}}/create', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify(data), }) .then(response => response.json()) .then(data => { document.getElementById('createdMessages').innerText = JSON.stringify(data, null, 2); }) .catch(error => { console.error('Error:', error); }); } const decodeMessage = () => { const message = document.getElementById('message').value; fetch('http://{{host}}:{{port}}/decode', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ 'message': message }), }) .then(response => response.json()) .then(data => { document.getElementById('decodedMessage').innerText = JSON.stringify(data, null, 2); }) .catch(error => { console.error('Error:', error); }); }; </script> </body> </html>