all: init

This commit is contained in:
Lopinosaurus 2026-03-02 12:37:37 +01:00
commit 51c2ac521e
10 changed files with 1839 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules/

BIN
alert.mp3 Normal file

Binary file not shown.

54
alert.sh Executable file
View File

@ -0,0 +1,54 @@
#!/bin/bash
# Usage: ./alert.sh "MESSAGE" [-i image_file] [-f html_file]
set -euo pipefail
PORT="${DASHBOARD_PORT:-3000}"
MESSAGE=""
HTML_FILE=""
IMAGE_FILE=""
while [[ $# -gt 0 ]]; do
case "$1" in
-i|--image) IMAGE_FILE="$2"; shift 2 ;;
-f|--html) HTML_FILE="$2"; shift 2 ;;
-h|--help) echo "Usage: $0 [\"MESSAGE\"] [-i image_file] [-f html_file]" >&2; exit 0 ;;
-*) echo "Option inconnue : $1" >&2; exit 1 ;;
*) MESSAGE="$1"; shift ;;
esac
done
if [ -z "$MESSAGE" ] && [ -z "$HTML_FILE" ] && [ -z "$IMAGE_FILE" ]; then
echo "Usage: $0 [\"MESSAGE\"] [-i image_file] [-f html_file]" >&2
exit 1
fi
# Build jq args
JQARGS=(--arg msg "$MESSAGE")
HTML=""
if [ -n "$HTML_FILE" ] && [ -f "$HTML_FILE" ]; then
HTML=$(cat "$HTML_FILE")
fi
JQARGS+=(--arg html "$HTML")
IMAGE=""
if [ -n "$IMAGE_FILE" ] && [ -f "$IMAGE_FILE" ]; then
case "${IMAGE_FILE##*.}" in
jpg|jpeg) MIME="image/jpeg" ;;
png) MIME="image/png" ;;
gif) MIME="image/gif" ;;
webp) MIME="image/webp" ;;
*) MIME="image/png" ;;
esac
IMAGE="data:${MIME};base64,$(base64 "$IMAGE_FILE" | tr -d '\n')"
fi
JQARGS+=(--arg image "$IMAGE")
PAYLOAD=$(jq -n "${JQARGS[@]}" '{"message":$msg,"html":$html,"image":$image}')
curl -sf -X POST "http://localhost:${PORT}/api/alert" \
-H "Content-Type: application/json" \
-d "$PAYLOAD" \
&& echo "✓ Alerte déclenchée : $MESSAGE" \
|| echo "✗ Serveur non disponible sur le port ${PORT}"

9
dismiss.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
# Usage: ./dismiss.sh
set -euo pipefail
PORT="${DASHBOARD_PORT:-3000}"
curl -sf -X DELETE "http://localhost:${PORT}/api/alert" \
&& echo "✓ Alerte révoquée" \
|| echo "✗ Serveur non disponible sur le port ${PORT}"

923
package-lock.json generated Normal file
View File

@ -0,0 +1,923 @@
{
"name": "cyber-dashboard",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "cyber-dashboard",
"version": "1.0.0",
"dependencies": {
"express": "^4.18.2",
"fast-xml-parser": "^4.3.2",
"node-fetch": "^2.7.0",
"ws": "^8.16.0"
}
},
"node_modules/accepts": {
"version": "1.3.8",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
"integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
"license": "MIT",
"dependencies": {
"mime-types": "~2.1.34",
"negotiator": "0.6.3"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/array-flatten": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==",
"license": "MIT"
},
"node_modules/body-parser": {
"version": "1.20.4",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.4.tgz",
"integrity": "sha512-ZTgYYLMOXY9qKU/57FAo8F+HA2dGX7bqGc71txDRC1rS4frdFI5R7NhluHxH6M0YItAP0sHB4uqAOcYKxO6uGA==",
"license": "MIT",
"dependencies": {
"bytes": "~3.1.2",
"content-type": "~1.0.5",
"debug": "2.6.9",
"depd": "2.0.0",
"destroy": "~1.2.0",
"http-errors": "~2.0.1",
"iconv-lite": "~0.4.24",
"on-finished": "~2.4.1",
"qs": "~6.14.0",
"raw-body": "~2.5.3",
"type-is": "~1.6.18",
"unpipe": "~1.0.0"
},
"engines": {
"node": ">= 0.8",
"npm": "1.2.8000 || >= 1.4.16"
}
},
"node_modules/bytes": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
"integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/call-bind-apply-helpers": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
"function-bind": "^1.1.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/call-bound": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",
"integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
"license": "MIT",
"dependencies": {
"call-bind-apply-helpers": "^1.0.2",
"get-intrinsic": "^1.3.0"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/content-disposition": {
"version": "0.5.4",
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
"integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
"license": "MIT",
"dependencies": {
"safe-buffer": "5.2.1"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/content-type": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
"integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/cookie": {
"version": "0.7.2",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",
"integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/cookie-signature": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz",
"integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==",
"license": "MIT"
},
"node_modules/debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"license": "MIT",
"dependencies": {
"ms": "2.0.0"
}
},
"node_modules/depd": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/destroy": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
"integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
"license": "MIT",
"engines": {
"node": ">= 0.8",
"npm": "1.2.8000 || >= 1.4.16"
}
},
"node_modules/dunder-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
"license": "MIT",
"dependencies": {
"call-bind-apply-helpers": "^1.0.1",
"es-errors": "^1.3.0",
"gopd": "^1.2.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/ee-first": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
"license": "MIT"
},
"node_modules/encodeurl": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
"integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/es-define-property": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/es-errors": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/es-object-atoms": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
"integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
"license": "MIT"
},
"node_modules/etag": {
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
"integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/express": {
"version": "4.22.1",
"resolved": "https://registry.npmjs.org/express/-/express-4.22.1.tgz",
"integrity": "sha512-F2X8g9P1X7uCPZMA3MVf9wcTqlyNp7IhH5qPCI0izhaOIYXaW9L535tGA3qmjRzpH+bZczqq7hVKxTR4NWnu+g==",
"license": "MIT",
"dependencies": {
"accepts": "~1.3.8",
"array-flatten": "1.1.1",
"body-parser": "~1.20.3",
"content-disposition": "~0.5.4",
"content-type": "~1.0.4",
"cookie": "~0.7.1",
"cookie-signature": "~1.0.6",
"debug": "2.6.9",
"depd": "2.0.0",
"encodeurl": "~2.0.0",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"finalhandler": "~1.3.1",
"fresh": "~0.5.2",
"http-errors": "~2.0.0",
"merge-descriptors": "1.0.3",
"methods": "~1.1.2",
"on-finished": "~2.4.1",
"parseurl": "~1.3.3",
"path-to-regexp": "~0.1.12",
"proxy-addr": "~2.0.7",
"qs": "~6.14.0",
"range-parser": "~1.2.1",
"safe-buffer": "5.2.1",
"send": "~0.19.0",
"serve-static": "~1.16.2",
"setprototypeof": "1.2.0",
"statuses": "~2.0.1",
"type-is": "~1.6.18",
"utils-merge": "1.0.1",
"vary": "~1.1.2"
},
"engines": {
"node": ">= 0.10.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/fast-xml-parser": {
"version": "4.5.4",
"resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.5.4.tgz",
"integrity": "sha512-jE8ugADnYOBsu1uaoayVl1tVKAMNOXyjwvv2U6udEA2ORBhDooJDWoGxTkhd4Qn4yh59JVVt/pKXtjPwx9OguQ==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/NaturalIntelligence"
}
],
"license": "MIT",
"dependencies": {
"strnum": "^1.0.5"
},
"bin": {
"fxparser": "src/cli/cli.js"
}
},
"node_modules/finalhandler": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz",
"integrity": "sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==",
"license": "MIT",
"dependencies": {
"debug": "2.6.9",
"encodeurl": "~2.0.0",
"escape-html": "~1.0.3",
"on-finished": "~2.4.1",
"parseurl": "~1.3.3",
"statuses": "~2.0.2",
"unpipe": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/forwarded": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
"integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/fresh": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
"integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/function-bind": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/get-intrinsic": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
"license": "MIT",
"dependencies": {
"call-bind-apply-helpers": "^1.0.2",
"es-define-property": "^1.0.1",
"es-errors": "^1.3.0",
"es-object-atoms": "^1.1.1",
"function-bind": "^1.1.2",
"get-proto": "^1.0.1",
"gopd": "^1.2.0",
"has-symbols": "^1.1.0",
"hasown": "^2.0.2",
"math-intrinsics": "^1.1.0"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/get-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
"license": "MIT",
"dependencies": {
"dunder-proto": "^1.0.1",
"es-object-atoms": "^1.0.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/gopd": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-symbols": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/hasown": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
"license": "MIT",
"dependencies": {
"function-bind": "^1.1.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/http-errors": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",
"integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",
"license": "MIT",
"dependencies": {
"depd": "~2.0.0",
"inherits": "~2.0.4",
"setprototypeof": "~1.2.0",
"statuses": "~2.0.2",
"toidentifier": "~1.0.1"
},
"engines": {
"node": ">= 0.8"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/iconv-lite": {
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
"license": "MIT",
"dependencies": {
"safer-buffer": ">= 2.1.2 < 3"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"license": "ISC"
},
"node_modules/ipaddr.js": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
"license": "MIT",
"engines": {
"node": ">= 0.10"
}
},
"node_modules/math-intrinsics": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
"integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/merge-descriptors": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz",
"integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/methods": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
"integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
"license": "MIT",
"bin": {
"mime": "cli.js"
},
"engines": {
"node": ">=4"
}
},
"node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime-types": {
"version": "2.1.35",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"license": "MIT",
"dependencies": {
"mime-db": "1.52.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
"license": "MIT"
},
"node_modules/negotiator": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
"integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/node-fetch": {
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
"integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
"license": "MIT",
"dependencies": {
"whatwg-url": "^5.0.0"
},
"engines": {
"node": "4.x || >=6.0.0"
},
"peerDependencies": {
"encoding": "^0.1.0"
},
"peerDependenciesMeta": {
"encoding": {
"optional": true
}
}
},
"node_modules/object-inspect": {
"version": "1.13.4",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
"integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/on-finished": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
"integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
"license": "MIT",
"dependencies": {
"ee-first": "1.1.1"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/parseurl": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/path-to-regexp": {
"version": "0.1.12",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz",
"integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==",
"license": "MIT"
},
"node_modules/proxy-addr": {
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
"integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
"license": "MIT",
"dependencies": {
"forwarded": "0.2.0",
"ipaddr.js": "1.9.1"
},
"engines": {
"node": ">= 0.10"
}
},
"node_modules/qs": {
"version": "6.14.2",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.14.2.tgz",
"integrity": "sha512-V/yCWTTF7VJ9hIh18Ugr2zhJMP01MY7c5kh4J870L7imm6/DIzBsNLTXzMwUA3yZ5b/KBqLx8Kp3uRvd7xSe3Q==",
"license": "BSD-3-Clause",
"dependencies": {
"side-channel": "^1.1.0"
},
"engines": {
"node": ">=0.6"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/range-parser": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/raw-body": {
"version": "2.5.3",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.3.tgz",
"integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==",
"license": "MIT",
"dependencies": {
"bytes": "~3.1.2",
"http-errors": "~2.0.1",
"iconv-lite": "~0.4.24",
"unpipe": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT"
},
"node_modules/safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
"license": "MIT"
},
"node_modules/send": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/send/-/send-0.19.2.tgz",
"integrity": "sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg==",
"license": "MIT",
"dependencies": {
"debug": "2.6.9",
"depd": "2.0.0",
"destroy": "1.2.0",
"encodeurl": "~2.0.0",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"fresh": "~0.5.2",
"http-errors": "~2.0.1",
"mime": "1.6.0",
"ms": "2.1.3",
"on-finished": "~2.4.1",
"range-parser": "~1.2.1",
"statuses": "~2.0.2"
},
"engines": {
"node": ">= 0.8.0"
}
},
"node_modules/send/node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"license": "MIT"
},
"node_modules/serve-static": {
"version": "1.16.3",
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.3.tgz",
"integrity": "sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA==",
"license": "MIT",
"dependencies": {
"encodeurl": "~2.0.0",
"escape-html": "~1.0.3",
"parseurl": "~1.3.3",
"send": "~0.19.1"
},
"engines": {
"node": ">= 0.8.0"
}
},
"node_modules/setprototypeof": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
"license": "ISC"
},
"node_modules/side-channel": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz",
"integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==",
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
"object-inspect": "^1.13.3",
"side-channel-list": "^1.0.0",
"side-channel-map": "^1.0.1",
"side-channel-weakmap": "^1.0.2"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/side-channel-list": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz",
"integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==",
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
"object-inspect": "^1.13.3"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/side-channel-map": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",
"integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
"license": "MIT",
"dependencies": {
"call-bound": "^1.0.2",
"es-errors": "^1.3.0",
"get-intrinsic": "^1.2.5",
"object-inspect": "^1.13.3"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/side-channel-weakmap": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
"integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
"license": "MIT",
"dependencies": {
"call-bound": "^1.0.2",
"es-errors": "^1.3.0",
"get-intrinsic": "^1.2.5",
"object-inspect": "^1.13.3",
"side-channel-map": "^1.0.1"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/statuses": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
"integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/strnum": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/strnum/-/strnum-1.1.2.tgz",
"integrity": "sha512-vrN+B7DBIoTTZjnPNewwhx6cBA/H+IS7rfW68n7XxC1y7uoiGQBxaKzqucGUgavX15dJgiGztLJ8vxuEzwqBdA==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/NaturalIntelligence"
}
],
"license": "MIT"
},
"node_modules/toidentifier": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
"license": "MIT",
"engines": {
"node": ">=0.6"
}
},
"node_modules/tr46": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",
"license": "MIT"
},
"node_modules/type-is": {
"version": "1.6.18",
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
"integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
"license": "MIT",
"dependencies": {
"media-typer": "0.3.0",
"mime-types": "~2.1.24"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/unpipe": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
"integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/utils-merge": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
"integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
"license": "MIT",
"engines": {
"node": ">= 0.4.0"
}
},
"node_modules/vary": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/webidl-conversions": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==",
"license": "BSD-2-Clause"
},
"node_modules/whatwg-url": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
"license": "MIT",
"dependencies": {
"tr46": "~0.0.3",
"webidl-conversions": "^3.0.0"
}
},
"node_modules/ws": {
"version": "8.19.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.19.0.tgz",
"integrity": "sha512-blAT2mjOEIi0ZzruJfIhb3nps74PRWTCz1IjglWEEpQl5XS/UNama6u2/rjFkDDouqr4L67ry+1aGIALViWjDg==",
"license": "MIT",
"engines": {
"node": ">=10.0.0"
},
"peerDependencies": {
"bufferutil": "^4.0.1",
"utf-8-validate": ">=5.0.2"
},
"peerDependenciesMeta": {
"bufferutil": {
"optional": true
},
"utf-8-validate": {
"optional": true
}
}
}
}
}

15
package.json Normal file
View File

@ -0,0 +1,15 @@
{
"name": "cyber-dashboard",
"version": "1.0.0",
"description": "Cyber analyst personal dashboard",
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"dependencies": {
"express": "^4.18.2",
"fast-xml-parser": "^4.3.2",
"node-fetch": "^2.7.0",
"ws": "^8.16.0"
}
}

275
public/app.js Normal file
View File

@ -0,0 +1,275 @@
'use strict';
// ── WebSocket ────────────────────────────────────────────────────────────────
let ws;
let wsReconnectTimer;
function connectWS() {
const proto = location.protocol === 'https:' ? 'wss:' : 'ws:';
ws = new WebSocket(`${proto}//${location.host}`);
ws.addEventListener('open', () => {
setWsStatus('CONNECTÉ', 'ok');
updateInfoWS('CONNECTÉ');
if (wsReconnectTimer) { clearTimeout(wsReconnectTimer); wsReconnectTimer = null; }
});
ws.addEventListener('message', evt => {
let msg;
try { msg = JSON.parse(evt.data); } catch { return; }
if (msg.type === 'alert') {
showAlert(msg.message, msg.html, msg.image);
} else if (msg.type === 'dismiss') {
hideAlert();
}
});
ws.addEventListener('close', () => {
setWsStatus('DÉCONNECTÉ', 'err');
updateInfoWS('DÉCONNECTÉ');
wsReconnectTimer = setTimeout(connectWS, 3000);
});
ws.addEventListener('error', () => {
ws.close();
});
}
function setWsStatus(text, cls) {
const el = document.getElementById('ws-status');
el.textContent = text;
el.className = 'widget-status ' + (cls || '');
}
function updateInfoWS(text) {
document.getElementById('info-ws').textContent = text;
}
// ── Alert overlay ────────────────────────────────────────────────────────────
const overlay = document.getElementById('alert-overlay');
const alertMessageEl = document.getElementById('alert-message');
const alertHtmlEl = document.getElementById('alert-html');
const alertIconEl = document.getElementById('alert-icon');
const alertImageEl = document.getElementById('alert-image');
const infoAlert = document.getElementById('info-alert');
// ── Alarm sound ───────────────────────────────────────────────────────────────
const alarmAudio = new Audio('/alert.mp3');
function playAlertSound() {
alarmAudio.currentTime = 0;
alarmAudio.play().catch(err => console.error('Audio play failed:', err));
}
function stopAlertSound() {
alarmAudio.pause();
alarmAudio.currentTime = 0;
}
// ── Alert overlay ─────────────────────────────────────────────────────────────
let autoDismissTimer = null;
function showAlert(message, html, image) {
// Image
if (image && image.trim()) {
alertImageEl.innerHTML = `<img src="${escapeAttr(image)}" alt="">`;
alertIconEl.style.display = 'none';
} else {
alertImageEl.innerHTML = '';
alertIconEl.style.display = '';
}
// Text / HTML
alertMessageEl.textContent = message || '';
alertMessageEl.style.display = (message && !image) ? '' : (message ? '' : 'none');
alertHtmlEl.innerHTML = (html && html.trim()) ? html : '';
// Show overlay
overlay.classList.remove('hidden');
overlay.style.animation = 'none';
void overlay.offsetWidth;
overlay.style.animation = '';
infoAlert.textContent = 'ACTIVE';
infoAlert.style.color = 'var(--red)';
playAlertSound();
if (autoDismissTimer) clearTimeout(autoDismissTimer);
autoDismissTimer = setTimeout(hideAlert, 60_000);
}
function hideAlert() {
if (autoDismissTimer) { clearTimeout(autoDismissTimer); autoDismissTimer = null; }
overlay.classList.add('hidden');
stopAlertSound();
infoAlert.textContent = 'INACTIVE';
infoAlert.style.color = '';
}
// ── Clock ────────────────────────────────────────────────────────────────────
const clockTime = document.getElementById('clock-time');
const clockDate = document.getElementById('clock-date');
const headerClock = document.getElementById('header-clock');
const infoHost = document.getElementById('info-host');
const DAYS = ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'];
const MONTHS = ['Jan','Fév','Mar','Avr','Mai','Jun','Jul','Aoû','Sep','Oct','Nov','Déc'];
function pad(n) { return String(n).padStart(2, '0'); }
function updateClock() {
const now = new Date();
const h = pad(now.getHours());
const m = pad(now.getMinutes());
const s = pad(now.getSeconds());
const timeStr = `${h}:${m}:${s}`;
const dateStr = `${DAYS[now.getDay()]} ${pad(now.getDate())} ${MONTHS[now.getMonth()]} ${now.getFullYear()}`;
clockTime.textContent = timeStr;
clockDate.textContent = dateStr;
headerClock.textContent = `${dateStr} ${timeStr}`;
}
// ── ANSSI / CERT-FR feed ─────────────────────────────────────────────────────
const anssiList = document.getElementById('anssi-list');
const anssiStatus = document.getElementById('anssi-status');
async function loadAnssi() {
anssiStatus.textContent = '...';
anssiStatus.className = 'widget-status';
try {
const resp = await fetch('/api/feeds/anssi');
if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
const items = await resp.json();
anssiList.innerHTML = '';
if (!items.length) {
anssiList.innerHTML = '<li class="feed-loading">Aucun bulletin</li>';
return;
}
items.forEach(item => {
const li = document.createElement('li');
li.className = 'anssi-item';
const date = item.pubDate
? new Date(item.pubDate).toLocaleDateString('fr-FR', { day: '2-digit', month: 'short', year: 'numeric' })
: '';
li.innerHTML = `
<a href="${escapeAttr(item.link)}" target="_blank" rel="noopener noreferrer">${escapeHtml(item.title)}</a>
${date ? `<span class="anssi-date">${escapeHtml(date)}</span>` : ''}
`;
anssiList.appendChild(li);
});
anssiStatus.textContent = `${items.length} bulletins`;
anssiStatus.className = 'widget-status ok';
} catch (err) {
anssiStatus.textContent = 'ERREUR';
anssiStatus.className = 'widget-status err';
anssiList.innerHTML = `<li class="feed-loading">Erreur : ${escapeHtml(err.message)}</li>`;
}
}
// ── CVE feed ──────────────────────────────────────────────────────────────────
const cveList = document.getElementById('cve-list');
const cveStatus = document.getElementById('cve-status');
function severityClass(cvss) {
if (cvss === undefined || cvss === null) return 'unknown';
const score = parseFloat(cvss);
if (isNaN(score)) return 'unknown';
if (score >= 9.0) return 'critical';
if (score >= 7.0) return 'high';
if (score >= 4.0) return 'medium';
return 'low';
}
function severityLabel(cvss) {
const cls = severityClass(cvss);
const map = { critical: 'CRITIQUE', high: 'ÉLEVÉ', medium: 'MOYEN', low: 'FAIBLE', unknown: '???' };
return map[cls];
}
async function loadCve() {
cveStatus.textContent = '...';
cveStatus.className = 'widget-status';
try {
const resp = await fetch('/api/feeds/cve');
if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
const items = await resp.json();
cveList.innerHTML = '';
if (!items.length) {
cveList.innerHTML = '<li class="feed-loading">Aucune CVE</li>';
return;
}
items.forEach(item => {
const cvss = item.cvss ?? item['cvss-score'] ?? null;
const cls = severityClass(cvss);
const label = severityLabel(cvss);
const desc = item.summary || item.description || '';
const cveId = item.id || item['cve-id'] || 'CVE-????-????';
const li = document.createElement('li');
li.className = 'cve-item';
li.innerHTML = `
<span class="cve-badge badge-${cls}">${escapeHtml(label)}</span>
<div class="cve-info">
<div class="cve-id">${escapeHtml(cveId)}</div>
<div class="cve-desc" title="${escapeAttr(desc)}">${escapeHtml(desc)}</div>
</div>
`;
cveList.appendChild(li);
});
cveStatus.textContent = `${items.length} CVEs`;
cveStatus.className = 'widget-status ok';
} catch (err) {
cveStatus.textContent = 'ERREUR';
cveStatus.className = 'widget-status err';
cveList.innerHTML = `<li class="feed-loading">Erreur : ${escapeHtml(err.message)}</li>`;
}
}
// ── Init ─────────────────────────────────────────────────────────────────────
function init() {
infoHost.textContent = location.host;
connectWS();
updateClock();
setInterval(updateClock, 1000);
loadAnssi();
loadCve();
setInterval(loadAnssi, 5 * 60 * 1000);
setInterval(loadCve, 5 * 60 * 1000);
}
// ── Helpers ───────────────────────────────────────────────────────────────────
function escapeHtml(str) {
return String(str)
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;');
}
function escapeAttr(str) {
return String(str).replace(/"/g, '&quot;').replace(/'/g, '&#39;');
}
document.addEventListener('DOMContentLoaded', init);

105
public/index.html Normal file
View File

@ -0,0 +1,105 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cyber Dashboard</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<!-- Alert overlay -->
<div id="alert-overlay" class="hidden">
<div id="alert-content">
<div id="alert-icon">&#9888;</div>
<div id="alert-image"></div>
<div id="alert-message"></div>
<div id="alert-html"></div>
</div>
</div>
<!-- Header -->
<header>
<div class="header-left">
<span class="logo">&#9632; CYBER DASHBOARD</span>
</div>
<div class="header-right">
<span id="header-clock"></span>
</div>
</header>
<!-- Dashboard grid -->
<main class="grid">
<!-- Widget 1: Kaspersky Live Map -->
<section class="widget" id="widget-kaspersky">
<div class="widget-header">
<span class="widget-title">KASPERSKY CYBERMAP</span>
<span class="widget-status ok">LIVE</span>
</div>
<div class="widget-body iframe-container">
<iframe
src="https://cybermap.kaspersky.com/en/widget/dynamic/dark"
frameborder="0"
title="Kaspersky Cybermap"
></iframe>
</div>
</section>
<!-- Widget 2: ANSSI / CERT-FR -->
<section class="widget" id="widget-anssi">
<div class="widget-header">
<span class="widget-title">CERT-FR / ANSSI</span>
<span class="widget-status" id="anssi-status">...</span>
</div>
<div class="widget-body">
<ul id="anssi-list" class="feed-list">
<li class="feed-loading">Chargement...</li>
</ul>
</div>
</section>
<!-- Widget 3: CVEs -->
<section class="widget" id="widget-cve">
<div class="widget-header">
<span class="widget-title">DERNIÈRES CVEs</span>
<span class="widget-status" id="cve-status">...</span>
</div>
<div class="widget-body">
<ul id="cve-list" class="feed-list">
<li class="feed-loading">Chargement...</li>
</ul>
</div>
</section>
<!-- Widget 4: Clock + server info -->
<section class="widget" id="widget-clock">
<div class="widget-header">
<span class="widget-title">SYSTÈME</span>
<span class="widget-status" id="ws-status">WS...</span>
</div>
<div class="widget-body clock-widget">
<div id="clock-time"></div>
<div id="clock-date"></div>
<div class="server-info">
<div class="info-row">
<span class="info-label">SERVEUR</span>
<span class="info-value" id="info-host"></span>
</div>
<div class="info-row">
<span class="info-label">WEBSOCKET</span>
<span class="info-value" id="info-ws"></span>
</div>
<div class="info-row">
<span class="info-label">ALERTE</span>
<span class="info-value" id="info-alert">INACTIVE</span>
</div>
</div>
</div>
</section>
</main>
<script src="app.js"></script>
</body>
</html>

330
public/style.css Normal file
View File

@ -0,0 +1,330 @@
/* ── Reset & base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
--bg: #0a0a0a;
--bg-widget: #0f0f0f;
--bg-header: #111111;
--border: #1a2a1a;
--green: #00ff41;
--green-dim: #00aa2a;
--green-dark:#003310;
--red: #ff0033;
--red-dim: #aa0022;
--orange: #ff7700;
--yellow: #ffcc00;
--text: #c8ffc8;
--text-dim: #5a7a5a;
--font: 'Courier New', Courier, monospace;
}
html, body {
height: 100%;
background: var(--bg);
color: var(--text);
font-family: var(--font);
font-size: 13px;
overflow: hidden;
}
/* ── Header ──────────────────────────────────────────────────────────────── */
header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 16px;
height: 40px;
background: var(--bg-header);
border-bottom: 1px solid var(--border);
}
.logo {
color: var(--green);
font-size: 14px;
font-weight: bold;
letter-spacing: 3px;
text-shadow: 0 0 8px var(--green);
}
#header-clock {
color: var(--green-dim);
font-size: 13px;
letter-spacing: 1px;
}
/* ── Grid ────────────────────────────────────────────────────────────────── */
main.grid {
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-rows: 1fr 1fr;
gap: 8px;
padding: 8px;
height: calc(100vh - 40px);
}
/* ── Widget ──────────────────────────────────────────────────────────────── */
.widget {
display: flex;
flex-direction: column;
background: var(--bg-widget);
border: 1px solid var(--border);
border-radius: 4px;
overflow: hidden;
}
.widget-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 6px 12px;
background: var(--bg-header);
border-bottom: 1px solid var(--border);
flex-shrink: 0;
}
.widget-title {
color: var(--green);
font-size: 11px;
letter-spacing: 2px;
font-weight: bold;
}
.widget-status {
font-size: 10px;
letter-spacing: 1px;
color: var(--green-dim);
}
.widget-status.ok { color: var(--green); }
.widget-status.err { color: var(--red); }
.widget-body {
flex: 1;
overflow: hidden;
padding: 8px;
}
/* ── Iframe widget ───────────────────────────────────────────────────────── */
.iframe-container {
padding: 0;
}
.iframe-container iframe {
width: 100%;
height: 100%;
border: none;
display: block;
}
/* ── Feed list ───────────────────────────────────────────────────────────── */
.feed-list {
list-style: none;
height: 100%;
overflow-y: auto;
display: flex;
flex-direction: column;
gap: 4px;
}
.feed-list::-webkit-scrollbar { width: 4px; }
.feed-list::-webkit-scrollbar-track { background: transparent; }
.feed-list::-webkit-scrollbar-thumb { background: var(--green-dark); border-radius: 2px; }
.feed-loading {
color: var(--text-dim);
font-style: italic;
padding: 8px 0;
}
/* ANSSI items */
.anssi-item {
border-bottom: 1px solid var(--border);
padding: 6px 4px;
}
.anssi-item a {
color: var(--green);
text-decoration: none;
font-size: 12px;
display: block;
margin-bottom: 2px;
line-height: 1.4;
}
.anssi-item a:hover { text-decoration: underline; }
.anssi-date {
color: var(--text-dim);
font-size: 10px;
}
/* CVE items */
.cve-item {
display: flex;
align-items: flex-start;
gap: 8px;
border-bottom: 1px solid var(--border);
padding: 6px 4px;
}
.cve-badge {
flex-shrink: 0;
font-size: 9px;
font-weight: bold;
letter-spacing: 1px;
padding: 2px 6px;
border-radius: 2px;
text-transform: uppercase;
min-width: 60px;
text-align: center;
}
.badge-critical { background: var(--red); color: #fff; }
.badge-high { background: var(--orange); color: #000; }
.badge-medium { background: var(--yellow); color: #000; }
.badge-low { background: var(--green-dim); color: #000; }
.badge-unknown { background: #333; color: var(--text-dim); }
.cve-info { flex: 1; min-width: 0; }
.cve-id {
color: var(--green);
font-size: 12px;
font-weight: bold;
}
.cve-desc {
color: var(--text-dim);
font-size: 11px;
margin-top: 2px;
line-height: 1.3;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/* ── Clock widget ────────────────────────────────────────────────────────── */
.clock-widget {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
gap: 16px;
height: 100%;
}
#clock-time {
font-size: 48px;
color: var(--green);
text-shadow: 0 0 16px var(--green);
letter-spacing: 4px;
}
#clock-date {
font-size: 14px;
color: var(--green-dim);
letter-spacing: 2px;
}
.server-info {
width: 100%;
max-width: 280px;
border: 1px solid var(--border);
border-radius: 2px;
overflow: hidden;
}
.info-row {
display: flex;
border-bottom: 1px solid var(--border);
}
.info-row:last-child { border-bottom: none; }
.info-label {
width: 100px;
padding: 5px 8px;
background: var(--bg-header);
color: var(--text-dim);
font-size: 10px;
letter-spacing: 1px;
flex-shrink: 0;
}
.info-value {
padding: 5px 8px;
color: var(--green-dim);
font-size: 10px;
letter-spacing: 1px;
}
/* ── Alert overlay ───────────────────────────────────────────────────────── */
#alert-overlay {
position: fixed;
inset: 0;
z-index: 9999;
background: rgba(180, 0, 0, 0.92);
display: flex;
align-items: center;
justify-content: center;
animation: flash-bg 1s ease-in-out infinite;
}
#alert-overlay.hidden { display: none; }
@keyframes flash-bg {
0% { background: rgba(200, 0, 0, 0.92); }
50% { background: rgba(80, 0, 0, 0.98); }
100% { background: rgba(200, 0, 0, 0.92); }
}
#alert-content {
text-align: center;
max-width: 80vw;
padding: 48px;
}
#alert-icon {
font-size: 80px;
color: #fff;
animation: pulse 1s ease-in-out infinite alternate;
margin-bottom: 24px;
}
#alert-image {
margin-bottom: 24px;
}
#alert-image img {
max-width: min(600px, 80vw);
max-height: 40vh;
object-fit: contain;
border: 3px solid rgba(255,255,255,0.3);
border-radius: 4px;
box-shadow: 0 0 40px rgba(255,0,0,0.6);
}
@keyframes pulse {
from { opacity: 1; transform: scale(1); }
to { opacity: 0.6; transform: scale(1.05); }
}
#alert-message {
font-size: 36px;
color: #fff;
font-weight: bold;
letter-spacing: 4px;
text-shadow: 0 0 20px rgba(255,255,255,0.5);
text-transform: uppercase;
line-height: 1.3;
}
#alert-html {
margin-top: 24px;
color: #ffcccc;
font-size: 16px;
line-height: 1.6;
}
/* ── Utility ──────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

127
server.js Normal file
View File

@ -0,0 +1,127 @@
'use strict';
const express = require('express');
const http = require('http');
const WebSocket = require('ws');
const fetch = require('node-fetch');
const { XMLParser } = require('fast-xml-parser');
const path = require('path');
const PORT = process.env.DASHBOARD_PORT || 3000;
const app = express();
app.use(express.json({ limit: '10mb' }));
app.use(express.static(path.join(__dirname, 'public')));
const server = http.createServer(app);
const wss = new WebSocket.Server({ server });
// Alert state
let alertState = { active: false, message: '', html: '', image: '' };
// Broadcast to all connected WS clients
function broadcast(data) {
const payload = JSON.stringify(data);
wss.clients.forEach(client => {
if (client.readyState === WebSocket.OPEN) {
client.send(payload);
}
});
}
// Send current state to newly connected client
wss.on('connection', ws => {
if (alertState.active) {
ws.send(JSON.stringify({
type: 'alert',
message: alertState.message,
html: alertState.html,
image: alertState.image
}));
}
});
// ── Routes ──────────────────────────────────────────────────────────────────
app.get('/alert.mp3', (_req, res) => res.sendFile(path.resolve('alert.mp3')));
// Proxy: strip X-Frame-Options and CSP, forward any URL
app.get('/proxy', async (req, res) => {
const { url } = req.query;
if (!url) return res.status(400).json({ error: 'Missing url parameter' });
try {
const upstream = await fetch(url, {
headers: { 'User-Agent': 'CyberDashboard/1.0' },
timeout: 10000
});
const contentType = upstream.headers.get('content-type') || 'text/html';
res.set('Content-Type', contentType);
res.removeHeader('X-Frame-Options');
res.removeHeader('Content-Security-Policy');
upstream.body.pipe(res);
} catch (err) {
res.status(502).json({ error: 'Proxy fetch failed', detail: err.message });
}
});
// Alert: GET state
app.get('/api/alert', (req, res) => {
res.json(alertState);
});
// Alert: POST (trigger)
app.post('/api/alert', (req, res) => {
const { message = '', html = '', image = '' } = req.body;
alertState = { active: true, message, html, image };
broadcast({ type: 'alert', message, html, image });
res.json({ ok: true });
});
// Alert: DELETE (dismiss)
app.delete('/api/alert', (req, res) => {
alertState = { active: false, message: '', html: '', image: '' };
broadcast({ type: 'dismiss' });
res.json({ ok: true });
});
// ANSSI / CERT-FR RSS feed
app.get('/api/feeds/anssi', async (req, res) => {
try {
const response = await fetch('https://www.cert.ssi.gouv.fr/feed/', {
headers: { 'User-Agent': 'CyberDashboard/1.0' },
timeout: 10000
});
const xml = await response.text();
const parser = new XMLParser({ ignoreAttributes: false });
const parsed = parser.parse(xml);
const items = parsed?.rss?.channel?.item || [];
const entries = (Array.isArray(items) ? items : [items]).map(item => ({
title: item.title || '',
link: item.link || '',
pubDate: item.pubDate || '',
description: item.description || ''
}));
res.json(entries);
} catch (err) {
res.status(502).json({ error: 'Feed fetch failed', detail: err.message });
}
});
// Last 10 CVEs from CIRCL
app.get('/api/feeds/cve', async (req, res) => {
try {
const response = await fetch('https://cve.circl.lu/api/last/10', {
headers: { 'User-Agent': 'CyberDashboard/1.0' },
timeout: 10000
});
const data = await response.json();
res.json(data);
} catch (err) {
res.status(502).json({ error: 'CVE fetch failed', detail: err.message });
}
});
server.listen(PORT, () => {
console.log(`Cyber Dashboard running on http://localhost:${PORT}`);
});