403Webshell
Server IP : 138.197.107.151  /  Your IP : 216.73.217.7
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux BloxBy-Builder 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64
User : wpbetasites_mrakzqskir ( 1022)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/bsd-crawler-parser/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/bsd-crawler-parser//verify-viewer.sh
#!/usr/bin/env bash
# Verify the crawler viewer after a restart. Run ON the server:
#   bash /var/www/bsd-crawler-parser/verify-viewer.sh
#
# Touches nothing outside this app: it only reads viewer/.env for the login,
# talks to the app on loopback, and writes one temp cookie file it deletes.
# Safe on the shared box -- no process is started, stopped, or killed here.
set -euo pipefail

APP_DIR="${APP_DIR:-/var/www/bsd-crawler-parser}"
PORT="${PORT:-8765}"   # override with PORT=xxxx if gunicorn binds elsewhere

cd "$APP_DIR"

echo "== waiting for the app on 127.0.0.1:$PORT (up to 2 min) =="
ok=""
for i in $(seq 1 60); do
  if curl -s -o /dev/null "http://127.0.0.1:$PORT/login"; then ok=1; break; fi
  sleep 2
done
[ -n "$ok" ] || { echo "FAIL: nothing answering on :$PORT"; exit 1; }

U=$(grep '^VIEWER_USER' viewer/.env | cut -d= -f2)
P=$(grep '^VIEWER_PASSWORD' viewer/.env | cut -d= -f2)
J=$(mktemp)
trap 'rm -f "$J"' EXIT

code=$(curl -s -c "$J" -o /dev/null -w "%{http_code}" \
  -d "username=$U&password=$P" "http://127.0.0.1:$PORT/login")
echo "login POST: $code (expect 302)"
[ "$code" = "302" ] || { echo "FAIL: login rejected"; exit 1; }

fail=0
for path in "/" "/detail" "/trend"; do
  code=$(curl -s -b "$J" -o /dev/null -w "%{http_code}" "http://127.0.0.1:$PORT$path")
  t=$(curl -s -b "$J" -o /dev/null -w "%{time_total}" "http://127.0.0.1:$PORT$path")
  echo "GET $path -> $code in ${t}s"
  [ "$code" = "200" ] || fail=1
done

# A 200 with an error body must not pass: check the trend page's real markup.
page=$(curl -s -b "$J" "http://127.0.0.1:$PORT/trend")
if echo "$page" | grep -q 'id="trendchart"'; then
  echo "trend page: chart container present"
elif echo "$page" | grep -q 'No hits match\|No data in that range'; then
  echo "trend page: renders (empty state for this range)"
else
  echo "FAIL: trend page missing expected markup"; fail=1
fi
echo "$page" | grep -q '>URL trend<' \
  && echo "nav: URL trend link present" \
  || { echo "FAIL: nav link missing"; fail=1; }

# Second hit shows the warm path (first may be slow while the cache warms).
t=$(curl -s -b "$J" -o /dev/null -w "%{time_total}" \
  "http://127.0.0.1:$PORT/trend?preset=last_90")
echo "GET /trend?preset=last_90 (warm check) -> ${t}s"

[ "$fail" = "0" ] && echo "ALL CHECKS PASSED" || { echo "SOME CHECKS FAILED"; exit 1; }

Youez - 2016 - github.com/yon3zu
LinuXploit