first commit

This commit is contained in:
d4rkr41n
2019-12-02 21:41:45 -06:00
commit 75083cc800
13 changed files with 7460 additions and 0 deletions
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

+30
View File
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('partials/head.ejs') %>
</head>
<body class="body-box-menu">
<div class="wrapper slide-bottom box-menu">
<h2>TinyCTF Submissions</h2>
<p>Enter a flag! Any flag!</p>
<form action="" method="post">
<% if(error != ''){ %>
<span class='form-error'>&nbsp; <%= error %>&nbsp;</span>
<% } %>
<% if(good != ''){ %>
<span class='form-good'>&nbsp; <%= good %>&nbsp;</span>
<% } %>
<div class="form-group">
<label>Guess</label>
<input type="text" name="guess" class="form-control">
</div>
<div class="form-group">
<input type="submit" class="btn btn-primary" value="guess">
</div>
</form>
</div>
</body>
</html>
+1
View File
@@ -0,0 +1 @@
THIS IS A TEST
+8
View File
@@ -0,0 +1,8 @@
<meta charset="UTF-8">
<title><%= title %></title>
<link rel="stylesheet" type="text/css" href="/public/css/style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<style type="text/css">
body{ font: 14px sans-serif; color:#000000; }
.wrapper{ width: 350px; padding: 20px; }
</style>
+59
View File
@@ -0,0 +1,59 @@
module.exports = {
rundashserver: function (bindaddr, bindport, flags, teamname) {
const bodyParser = require('body-parser');
const express = require('express');
const path = require('path');
const fs = require('fs');
const app = express();
app.use(bodyParser.urlencoded({
extended: false
}));
// set the view engine to ejs
app.set('view engine', 'ejs');
app.set('views', path.join('./services/views'));
app.use('/public', express.static(__dirname + '/public'));
const addr = bindaddr;
const port = bindport;
// set the app to listen on the port
app.listen(port, () => {
console.log(`Website running at → ${addr}:${port}`);
});
app.get('/', (req, res) => {
res.render('guess',{title:'TinyCTF', error:'', good:''});
});
app.post('/', (req, res) => {
if(!req.body.guess){
res.render('guess',{title:'TinyCTF', error:'Try harder!', good:''});
} else {
var i = 0;
var goodguess = 0;
do {
if(flags[i].flag.trim() == req.body.guess.trim()){
var towrite = "("+ teamname +") Got flag: " + flags[i].flag.trim() + " (" + Date.now() + ")";
goodguess = 1;
fs.appendFileSync('correctlog.txt', towrite + '\n');
console.log(towrite);
}
i++;
} while (i < flags.length && goodguess != 1);
if(goodguess){
res.render('guess',{title:'TinyCTF', error:'', good:'You got one!'});
} else{
res.render('guess',{title:'TinyCTF', error:'Try harder!', good:''});
}
//res.redirect('/');
}
});
}
};