console
const express = require('express');
const fs = require('fs');
const router = express.Router();
const flag = q;
router.post('/login', async(req, res) => {
let username =admin;
let password = admin;
let message = 'login fail!!';
if (username !== 'admin' && username == 'admin' && password == "admin") {
message = 'login success!! flag is ' + flag;
}
return res.render('index.html', { message: message });
});
module.exports = router;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>easy login</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0-2/js/all.min.js"></script>
<style>
@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,300;1,300&display=swap");
body {
transform: translateY(50%);
background-color: hsl(216, 50%, 38%);
color: white;
font-family: "IBM Plex Mono", monospace;
text-align: center;
display: flex;
width: 50%;
height: 50%;
flex-direction: column;
margin: 0 auto;
}
h1,
p {
margin: 5px;
}
h1 {
cursor: pointer;
}
.container {
align-self: center;
width: 750px;
}
h1{
font-size: 2em;
margin: 0.67em 0;
}
#login{
position: absolute;
margin: -150px 0 0 -150px;
width: 100%;
height: 100%;
}
input{
width: 50%;
height: 18px;
margin-bottom: 10px;
outline: none;
padding: 10px;
font-size: 13px;
color: #fff;
text-shadow:1px 1px 1px;
border-top: 1px solid #312E3D;
border-left: 1px solid #312E3D;
border-right: 1px solid #312E3D;
border-bottom: 1px solid #56536A;
border-radius: 4px;
background-color: #2D2D3F;
}
.but{
width: 50%;
min-height: 20px;
height: 38px;
background-color: #4a77d4;
border: 1px solid #3762bc;
color: #fff;
padding: 9px 14px;
font-size: 15px;
line-height: normal;
border-radius: 5px;
margin: 0;
}
</style>
</head>
<body>
<h1>easy login</h1>
<p>login as admin to get the flag</p>
<br />
<div class="login">
<form action='/login' method="post">
<input name="username" placeholder="input username(admin)"/>
<input type="password" name="password" placeholder="input password"/>
<input class="but" type="submit" value="submit">
</form>
</div>
</body>
</html>