mirror of
https://github.com/hybula/lookingglass.git
synced 2024-09-21 05:20:06 +00:00
commit
6f5395a092
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,4 +1,3 @@
|
|||
|
||||
.idea
|
||||
config.php
|
||||
www.bat
|
||||
|
|
20
CHANGELOG.md
Normal file
20
CHANGELOG.md
Normal file
|
@ -0,0 +1,20 @@
|
|||
# Changelog
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [1.0.0] - 14-04-2022
|
||||
### Fixed
|
||||
- Undefined warning when refreshing a page after execution.
|
||||
- Traceroute error when there is no PID found.
|
||||
|
||||
### Added
|
||||
- Added Docker support.
|
||||
- This CHANGELOG.md to track changes.
|
||||
|
||||
## [0.1.0] - 17-01-2022
|
||||
### Changed
|
||||
- First release.
|
|
@ -311,16 +311,18 @@ class LookingGlass
|
|||
foreach ($pipes as $pipe) {
|
||||
fclose($pipe);
|
||||
}
|
||||
if ($status['pid']) {
|
||||
// retrieve parent pid
|
||||
$ppid = $status['pid'];
|
||||
//$ppid = $status['pid'];
|
||||
// use ps to get all the children of this process
|
||||
$pids = preg_split('/\s+/', `ps -o pid --no-heading --ppid $ppid`);
|
||||
$pids = preg_split('/\s+/', 'ps -o pid --no-heading --ppid '.$status['pid']);
|
||||
// kill remaining processes
|
||||
foreach($pids as $pid) {
|
||||
foreach ($pids as $pid) {
|
||||
if (is_numeric($pid)) {
|
||||
posix_kill($pid, 9);
|
||||
}
|
||||
}
|
||||
}
|
||||
proc_close($process);
|
||||
}
|
||||
return true;
|
||||
|
|
18
docker-compose.yml
Normal file
18
docker-compose.yml
Normal file
|
@ -0,0 +1,18 @@
|
|||
version: "3.8"
|
||||
|
||||
services:
|
||||
nginx:
|
||||
image: hybula/lookingglass-nginx:1
|
||||
build:
|
||||
context: docker/nginx
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "80:80"
|
||||
restart: unless-stopped
|
||||
|
||||
php-fpm:
|
||||
image: hybula/lookingglass-php:1
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/php-fpm/Dockerfile
|
||||
restart: unless-stopped
|
3
docker/nginx/Dockerfile
Normal file
3
docker/nginx/Dockerfile
Normal file
|
@ -0,0 +1,3 @@
|
|||
FROM nginx:mainline-alpine
|
||||
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
2
docker/nginx/Dockerfile.dockerignore
Normal file
2
docker/nginx/Dockerfile.dockerignore
Normal file
|
@ -0,0 +1,2 @@
|
|||
Dockerfile
|
||||
Dockerfile.dockerignore
|
49
docker/nginx/nginx.conf
Normal file
49
docker/nginx/nginx.conf
Normal file
|
@ -0,0 +1,49 @@
|
|||
user nginx;
|
||||
worker_processes 1;
|
||||
|
||||
error_log /dev/stderr warn;
|
||||
pid /run/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
multi_accept on;
|
||||
use epoll;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
access_log /dev/stdout combined;
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 65;
|
||||
types_hash_max_size 2048;
|
||||
client_max_body_size 100m;
|
||||
server_tokens off;
|
||||
gzip on;
|
||||
open_file_cache max=100;
|
||||
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
server_name _;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php$is_args$args;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
root /var/www/html;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
fastcgi_pass php-fpm:9000;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi.conf;
|
||||
fastcgi_buffering on;
|
||||
fastcgi_buffer_size 1k;
|
||||
fastcgi_buffers 128 1k;
|
||||
fastcgi_max_temp_file_size 0;
|
||||
gzip off;
|
||||
}
|
||||
}
|
||||
}
|
8
docker/php-fpm/Dockerfile
Normal file
8
docker/php-fpm/Dockerfile
Normal file
|
@ -0,0 +1,8 @@
|
|||
FROM php:8.1-fpm-bullseye
|
||||
|
||||
RUN apt update && apt install iputils-ping mtr traceroute -y
|
||||
|
||||
WORKDIR /var/www/html
|
||||
|
||||
COPY . .
|
||||
COPY docker/php-fpm/src/config.php config.php
|
3
docker/php-fpm/Dockerfile.dockerignore
Normal file
3
docker/php-fpm/Dockerfile.dockerignore
Normal file
|
@ -0,0 +1,3 @@
|
|||
Dockerfile
|
||||
Dockerfile.dockerignore
|
||||
.git
|
|
@ -24,7 +24,7 @@ $detectIpAddress = LookingGlass::detectIpAddress();
|
|||
|
||||
if (!empty($_POST)) {
|
||||
do {
|
||||
if (!isset($_POST['csrfToken']) || ($_POST['csrfToken'] != $_SESSION['CSRF'])) {
|
||||
if (!isset($_POST['csrfToken']) || !isset($_SESSION['CSRF']) || ($_POST['csrfToken'] != $_SESSION['CSRF'])) {
|
||||
$errorMessage = 'Missing or incorrect CSRF token.';
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue