mirror of
https://codeberg.org/vlw/honeypot.git
synced 2025-09-14 02:43:41 +02:00
feat: add initial code
This commit is contained in:
parent
2dc6160a7f
commit
d0005f3854
16 changed files with 368 additions and 0 deletions
2
.env.example.ini
Normal file
2
.env.example.ini
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
; Save request details in a SQLite database at this location
|
||||||
|
DB_POT=""
|
51
.gitignore
vendored
Normal file
51
.gitignore
vendored
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
# Bootstrapping #
|
||||||
|
#################
|
||||||
|
/node_modules
|
||||||
|
/public/hot
|
||||||
|
/public/storage
|
||||||
|
/storage/*.key
|
||||||
|
/vendor
|
||||||
|
.env
|
||||||
|
.env.ini
|
||||||
|
.env.backup
|
||||||
|
.phpunit.result.cache
|
||||||
|
Homestead.json
|
||||||
|
Homestead.yaml
|
||||||
|
npm-debug.log
|
||||||
|
yarn-error.log
|
||||||
|
public/robots.txt
|
||||||
|
|
||||||
|
|
||||||
|
# OS generated files #
|
||||||
|
######################
|
||||||
|
.DS_Store
|
||||||
|
.DS_Store?
|
||||||
|
._*
|
||||||
|
.Spotlight-V100
|
||||||
|
.Trashes
|
||||||
|
Icon?
|
||||||
|
ehthumbs.db
|
||||||
|
Thumbs.db
|
||||||
|
.directory
|
||||||
|
|
||||||
|
# Tool specific files #
|
||||||
|
#######################
|
||||||
|
# vim
|
||||||
|
*~
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
# sublime text & textmate
|
||||||
|
*.sublime-*
|
||||||
|
*.stTheme.cache
|
||||||
|
*.tmlanguage.cache
|
||||||
|
*.tmPreferences.cache
|
||||||
|
# Eclipse
|
||||||
|
.settings/*
|
||||||
|
# JetBrains, aka PHPStorm, IntelliJ IDEA
|
||||||
|
.idea/*
|
||||||
|
# NetBeans
|
||||||
|
nbproject/*
|
||||||
|
# Visual Studio Code
|
||||||
|
.vscode
|
||||||
|
# Sass preprocessor
|
||||||
|
.sass-cache/
|
104
assets/css/pages/document.css
Normal file
104
assets/css/pages/document.css
Normal file
|
@ -0,0 +1,104 @@
|
||||||
|
:root {
|
||||||
|
--padding: 20px;
|
||||||
|
--color-accent: #00b0d0;
|
||||||
|
}
|
||||||
|
|
||||||
|
* {
|
||||||
|
font-family: "Verdana", "Arial", sans-serif;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
background: url("/assets/media/Inner-page_cut_02.png") repeat-x right top;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- */
|
||||||
|
|
||||||
|
header,
|
||||||
|
section {
|
||||||
|
width: 100%;
|
||||||
|
display: grid;
|
||||||
|
align-items: center;
|
||||||
|
justify-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
header {
|
||||||
|
height: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 1000px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- */
|
||||||
|
|
||||||
|
header .container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
header nav {
|
||||||
|
margin-left: auto;
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
header nav p {
|
||||||
|
position: relative;
|
||||||
|
margin: 0;
|
||||||
|
padding: 5px 10px;
|
||||||
|
border-radius: 10px;
|
||||||
|
color: var(--color-accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --- */
|
||||||
|
|
||||||
|
#title h1 {
|
||||||
|
color: white;
|
||||||
|
font-size: 17px;
|
||||||
|
margin-left: var(--padding);
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
background-color: white;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: var(--padding);
|
||||||
|
border-radius: 6px;
|
||||||
|
border: solid 1px #eee;
|
||||||
|
min-height: 450px;
|
||||||
|
box-shadow: 0 0 10px 5px #00000017;
|
||||||
|
border: solid 1px #e6e6e6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content * {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (hover: hover) {
|
||||||
|
header nav p:hover {
|
||||||
|
background-color: var(--color-accent);
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
header nav p:hover::after {
|
||||||
|
--size: 7px;
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
top: 100%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
border-left: var(--size) solid transparent;
|
||||||
|
border-right: var(--size) solid transparent;
|
||||||
|
|
||||||
|
border-top: var(--size) solid var(--color-accent);
|
||||||
|
}
|
||||||
|
}
|
48
assets/css/pages/index.css
Normal file
48
assets/css/pages/index.css
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
.content#login {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content#login aside {
|
||||||
|
background-color: #f7f7f7;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: var(--padding);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: var(--padding);
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content#login aside h2 {
|
||||||
|
color: var(--color-accent);
|
||||||
|
font-size: 17px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content#login form {
|
||||||
|
max-width: 400px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: var(--padding);
|
||||||
|
}
|
||||||
|
|
||||||
|
.content#login .error {
|
||||||
|
background-color: #ff000010;
|
||||||
|
color: red;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content#login input[type="submit"] {
|
||||||
|
width: 100px;
|
||||||
|
padding: 7px;
|
||||||
|
background: linear-gradient(0deg, rgba(0,134,167,1) 0%, rgba(0,176,208,1) 100%);
|
||||||
|
border-radius: 3px;
|
||||||
|
border: none;
|
||||||
|
color: white;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (hover: hover) {
|
||||||
|
.content#login input[type="submit"]:hover {
|
||||||
|
background: rgba(0,134,167,1);
|
||||||
|
}
|
||||||
|
}
|
25
assets/css/pages/partials/footer.css
Normal file
25
assets/css/pages/partials/footer.css
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
footer {
|
||||||
|
margin-top: var(--padding);
|
||||||
|
}
|
||||||
|
|
||||||
|
footer #footer_list {
|
||||||
|
--color: #888;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(4, 1fr);
|
||||||
|
color: var(--color);
|
||||||
|
}
|
||||||
|
|
||||||
|
footer #footer_list > div {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding-left: var(--padding);
|
||||||
|
color: var(--color);
|
||||||
|
}
|
||||||
|
|
||||||
|
footer #footer_list > div p {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer #footer_list > div:not(:first-child) {
|
||||||
|
border-left: solid 1px var(--color);
|
||||||
|
}
|
1
assets/js/pages/document.js
Normal file
1
assets/js/pages/document.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
globalThis.pragma.Interactions("document", {});
|
BIN
assets/media/Inner-page_cut_02.png
Normal file
BIN
assets/media/Inner-page_cut_02.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 166 KiB |
BIN
assets/media/favicon.ico
Normal file
BIN
assets/media/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
BIN
assets/media/loading.gif
Normal file
BIN
assets/media/loading.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 79 KiB |
BIN
assets/media/logo.gif
Normal file
BIN
assets/media/logo.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
33
database/Pot.php
Normal file
33
database/Pot.php
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once Path::root("database/SQLite/SQLite.php");
|
||||||
|
|
||||||
|
class PotDB extends SQLiteDriver {
|
||||||
|
public function __construct() {
|
||||||
|
// Check that we have a location to pot our catch
|
||||||
|
if (empty($_ENV["DB_POT"])) {
|
||||||
|
die("Where do you want it? Set DB_POT to a path on disk where the SQLite database will be created.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize the SQLite interface
|
||||||
|
parent::__construct($_ENV["DB_POT"], Path::root("database/init/POT.sql"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gottem
|
||||||
|
public function yoink(): bool {
|
||||||
|
// Stringiy all POST and SERVER fields into JSON
|
||||||
|
$data = json_encode([
|
||||||
|
"POST" => $_POST,
|
||||||
|
"SERVER" => $_SERVER
|
||||||
|
]);
|
||||||
|
|
||||||
|
// And save it!
|
||||||
|
$sql = "INSERT OR IGNORE INTO pot (id, data, version, created) VALUES (?, ?, ?, ?)";
|
||||||
|
return $this->return_bool($sql, [
|
||||||
|
crc32(uniqid($data, true)),
|
||||||
|
$data,
|
||||||
|
1,
|
||||||
|
time()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
1
database/SQLite
Submodule
1
database/SQLite
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 6ded7c0c2fc457ac5abe8c49f802918fdf005a16
|
6
database/init/POT.sql
Normal file
6
database/init/POT.sql
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
CREATE TABLE pot (
|
||||||
|
id TEXT PRIMARY KEY NOT NULL,
|
||||||
|
data TEXT,
|
||||||
|
version INT NOT NULL,
|
||||||
|
created INT NOT NULL
|
||||||
|
);
|
31
pages/EN_EN/document.php
Normal file
31
pages/EN_EN/document.php
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<title>mydlink</title>
|
||||||
|
<link rel="shortcut icon" href="/assets/media/favicon.ico"/>
|
||||||
|
<style><?= Page::css("pages/document") ?></style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<header>
|
||||||
|
<div class="container">
|
||||||
|
<img src="/assets/media/logo.gif"/>
|
||||||
|
<nav>
|
||||||
|
<a href="/" data-trigger="document" data-action="nav"><p>Home</p></a>
|
||||||
|
<a href="/" data-trigger="document" data-action="nav"><p>Products</p></a>
|
||||||
|
<a href="/" data-trigger="document" data-action="nav"><p>Mobile App</p></a>
|
||||||
|
<a href="/" data-trigger="document" data-action="nav"><p>Help</p></a>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<main>
|
||||||
|
<?= Page::include("index") ?>
|
||||||
|
</main>
|
||||||
|
<footer>
|
||||||
|
<?= Page::include("partials/footer") ?>
|
||||||
|
</footer>
|
||||||
|
<script><?= Page::include("pragma") ?></script>
|
||||||
|
<script>{<?= Page::js("pages/document") ?>}</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
38
pages/EN_EN/index.php
Normal file
38
pages/EN_EN/index.php
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// I'll have that tyvm
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||||
|
require_once Path::root("database/Pot.php");
|
||||||
|
(new PotDB())->yoink();
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<style><?= Page::css("pages/index") ?></style>
|
||||||
|
<section>
|
||||||
|
<div id="title" class="container">
|
||||||
|
<h1>Sign In to mydlink</h1>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<div id="login" class="content container">
|
||||||
|
<form method="POST">
|
||||||
|
<?php if ($_SERVER["REQUEST_METHOD"] === "POST"): ?>
|
||||||
|
<p class="error">Invalid username or password. Please try again.</p>
|
||||||
|
<?php endif; ?>
|
||||||
|
<div>
|
||||||
|
<label>Username</label>
|
||||||
|
<input type="text" name="username">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label>Password</label>
|
||||||
|
<input type="password" name="password">
|
||||||
|
</div>
|
||||||
|
<input type="submit" value="Log in">
|
||||||
|
</form>
|
||||||
|
<aside>
|
||||||
|
<h2>Not Registered yet?</h2>
|
||||||
|
<p>To get started with mydlink cloud services, you need to have a mydlink-enabled product. Learn more about supported products <a href="https://se.mydlink.com/content/productfamily">here</a>.</p>
|
||||||
|
<p>Please follow the steps in order to register your mydlink-enabled product and get access to both mydlink.com and our mobile apps. Learn more details <a href="https://se.mydlink.com/content/notreg">here</a>.</p>
|
||||||
|
</aside>
|
||||||
|
</div>
|
||||||
|
</section>
|
28
pages/EN_EN/partials/footer.php
Normal file
28
pages/EN_EN/partials/footer.php
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<style><?= Page::css("pages/partials/footer") ?></style>
|
||||||
|
<section>
|
||||||
|
<div id="footer_list" class="container">
|
||||||
|
<div>
|
||||||
|
<p>Official Information</p>
|
||||||
|
<a href="http://www.dlink.com/">Global D-Link</a>
|
||||||
|
<a href="https://se.mydlink.com/content/productfamily">About mydlink</a>
|
||||||
|
<a href="https://se.mydlink.com/termsOfUse">Terms of Use</a>
|
||||||
|
<a href="https://se.mydlink.com/privacyPolicy">Privacy Policy</a>
|
||||||
|
<a href="https://sso.dlink.com/privacy-pledge">Privacy Pledge</a>
|
||||||
|
<a href="">Cookie Preferences</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p>Product</p>
|
||||||
|
<a href="">Cloud Cameras</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p>Mobile App</p>
|
||||||
|
<a href="https://se.mydlink.com/apps">Download Apps</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p>Help</p>
|
||||||
|
<a href="https://se.mydlink.com/faq">Download Apps</a>
|
||||||
|
<a href="https://se.mydlink.com/download">Download</a>
|
||||||
|
<a href="https://www.dlink.com/support">Support</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
Loading…
Add table
Reference in a new issue