Skip to content

sirrauf/PySec-Audit-Web-Scanner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

5 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ›ก๏ธ PySec Audit โ€” Advanced Cybersecurity Scanner

Donasi Proyek

Mohon sumbangkan nominal sukarela terbaik anda supaya proyek ini dikembangkan lebih baik. Klik untuk download QR Code AnTS Groups

Live Website

Live Website

Screenshoot Tampilan PySec Audit

SS0 SS1 More Screenshoot

PySec Audit adalah platform keamanan siber berbasis web untuk mendeteksi file backdoor tersembunyi dan script judi online / slot gacor pada website. Dibangun menggunakan Python Flask dan di-deploy menggunakan Gunicorn.

Python Flask Gunicorn License


๐Ÿ“‘ Table of Contents


๐Ÿš€ Fitur Utama

๐Ÿ” Backdoor Scanner

Fitur Deskripsi
Webshell Detection Mendeteksi PHP, ASP, JSP webshell (c99, r57, b374k, WSO, Alfa Shell, dll.)
Image Analysis Scan file PNG, JPG, GIF, ICO, SVG untuk kode PHP/script tersembunyi
Obfuscation Detection Identifikasi base64, hex encoding, high entropy, long-line obfuscation
Signature Matching Cocokkan 100+ signature backdoor dan pola kode berbahaya
Double Extension Deteksi trik double extension (contoh: image.jpg.php)
Hidden Files Deteksi file tersembunyi (dot-prefixed) dan backup sensitif
URL Probing Probe 40+ path webshell umum di server target

๐ŸŽฐ Gambling / Slot Detector

Fitur Deskripsi
Keyword Detection 80+ keyword gambling: slot gacor, judi online, togel, pragmatic play, sbobet
Hidden Content Deteksi iframe tersembunyi, display:none, konten gambling invisible
Redirect Detection Identifikasi JavaScript, meta-refresh, server-side redirect ke situs judi
Cloaking Detection Bandingkan konten bot vs user untuk deteksi gambling cloaking
SEO Spam Deteksi doorway pages, hidden text, dan injeksi SEO spam
Domain Scanning Periksa link ke domain-domain gambling yang dikenal

๐Ÿ“ Arsitektur & Struktur Proyek

PySec-Audit-Website2/
โ”œโ”€โ”€ app.py                      # Entry point aplikasi Flask
โ”œโ”€โ”€ config.py                   # Konfigurasi aplikasi
โ”œโ”€โ”€ requirements.txt            # Dependencies Python
โ”œโ”€โ”€ Procfile                    # Konfigurasi Gunicorn untuk deployment
โ”œโ”€โ”€ README.md                   # Dokumentasi teknikal (file ini)
โ”‚
โ”œโ”€โ”€ scanners/                   # Engine scanner
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ backdoor_scanner.py     # Scanner backdoor file di path lokal
โ”‚   โ”œโ”€โ”€ url_scanner.py          # Scanner backdoor via URL
โ”‚   โ”œโ”€โ”€ gambling_scanner.py     # Scanner gambling/slot di path lokal
โ”‚   โ””โ”€โ”€ gambling_url_scanner.py # Scanner gambling/slot via URL
โ”‚
โ”œโ”€โ”€ routes/                     # Flask routes & API endpoints
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ””โ”€โ”€ main.py                 # Blueprint utama (halaman + API)
โ”‚
โ”œโ”€โ”€ templates/                  # HTML templates (Jinja2)
โ”‚   โ”œโ”€โ”€ base.html               # Base layout (sidebar, navbar, footer)
โ”‚   โ”œโ”€โ”€ dashboard.html          # Halaman dashboard utama
โ”‚   โ”œโ”€โ”€ backdoor_scanner.html   # Halaman backdoor scanner
โ”‚   โ”œโ”€โ”€ gambling_detector.html  # Halaman gambling detector
โ”‚   โ””โ”€โ”€ results.html            # Halaman hasil scan detail
โ”‚
โ””โ”€โ”€ static/                     # Static assets
    โ”œโ”€โ”€ css/
    โ”‚   โ””โ”€โ”€ style.css           # Dark cybersecurity theme CSS
    โ””โ”€โ”€ js/
        โ””โ”€โ”€ main.js             # JavaScript (AJAX, UI interactions)

๐Ÿ› ๏ธ Teknologi yang Digunakan

Teknologi Versi Fungsi
Python 3.10+ Bahasa pemrograman utama
Flask 3.1.0 Web framework
Gunicorn 23.0.0 WSGI HTTP Server (production)
Requests 2.32.3 HTTP client untuk URL scanning
BeautifulSoup4 4.13.3 HTML/XML parser
lxml 5.3.1 XML/HTML parser engine
urllib3 2.3.0 HTTP library

๐Ÿ“‹ Prasyarat (Prerequisites)

Sebelum memulai instalasi, pastikan sistem Anda memiliki:

  • Python 3.10 atau lebih baru โ€” Download Python
  • pip (package manager Python) โ€” biasanya sudah termasuk dalam instalasi Python
  • Git (opsional) โ€” untuk clone repository

Verifikasi instalasi Python dan pip:

python --version
# Output: Python 3.10.x atau lebih baru

pip --version
# Output: pip 2x.x.x from ...

โš ๏ธ Catatan untuk Windows: Gunakan python atau py sesuai konfigurasi sistem Anda.


๐Ÿ’ป Instalasi

1. Clone / Download Repository

# Menggunakan Git
git clone https://github.com/username/PySec-Audit-Website.git
cd PySec-Audit-Website

# Atau download ZIP dan extract, lalu masuk ke direktori
cd PySec-Audit-Website2

2. Membuat Virtual Environment

Virtual environment digunakan untuk mengisolasi dependencies proyek agar tidak bentrok dengan paket Python global.

๐ŸชŸ Windows

# Membuat virtual environment bernama 'venv'
python -m venv venv

๐Ÿง Linux / macOS

# Membuat virtual environment bernama 'venv'
python3 -m venv venv

๐Ÿ’ก Tips: Anda bisa mengganti venv dengan nama lain, misalnya env atau .venv:

python -m venv .venv

3. Mengaktifkan Virtual Environment

๐ŸชŸ Windows (Command Prompt / CMD)

venv\Scripts\activate

๐ŸชŸ Windows (PowerShell)

venv\Scripts\Activate.ps1

โš ๏ธ PowerShell Execution Policy: Jika muncul error, jalankan dulu:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

๐ŸชŸ Windows (Git Bash)

source venv/Scripts/activate

๐Ÿง Linux / macOS (Bash/Zsh)

source venv/bin/activate

โœ… Verifikasi Virtual Environment Aktif

Setelah aktivasi, terminal Anda akan menampilkan prefix (venv):

(venv) C:\Users\NFI\...\PySec-Audit-Website>

Untuk memastikan Python yang digunakan adalah dari virtual environment:

# Windows
where python

# Linux/macOS
which python

Output harus menunjuk ke direktori venv/.

๐Ÿ”ด Menonaktifkan Virtual Environment

deactivate

4. Install Dependencies

Setelah virtual environment aktif, install semua dependencies:

pip install -r requirements.txt

Verifikasi instalasi:

pip list

Output harus menampilkan Flask, Gunicorn, requests, beautifulsoup4, lxml, dan urllib3.


โ–ถ๏ธ Menjalankan Aplikasi

Mode Development (Flask)

Untuk development/testing lokal dengan auto-reload:

python app.py

Aplikasi akan berjalan di:

  • Local: http://127.0.0.1:5000
  • Network: http://[IP-Anda]:5000

๐Ÿ’ก Mode debug aktif secara default di development mode.

Mode Production (Gunicorn)

Untuk production menggunakan Gunicorn (Linux/macOS):

gunicorn app:app --bind 0.0.0.0:5000 --workers 4 --timeout 120

Atau menggunakan Procfile:

# Menggunakan heroku local atau foreman
heroku local web

# Atau langsung
gunicorn app:app --bind 0.0.0.0:${PORT:-5000} --workers 4 --timeout 120

โš ๏ธ Catatan: Gunicorn hanya berjalan di Linux/macOS. Untuk Windows, gunakan waitress sebagai alternatif:

pip install waitress
waitress-serve --port=5000 app:app

๐Ÿ“– Penggunaan

1. Backdoor Scanner

Scan Path Lokal

  1. Buka halaman Backdoor Scanner dari sidebar
  2. Pilih tab Path Scan
  3. Masukkan path direktori website, contoh:
    • Windows: C:\inetpub\wwwroot atau C:\xampp\htdocs
    • Linux: /var/www/html atau /home/user/public_html
  4. Atur Max Depth (kedalaman scan) dan Max Files (batas file)
  5. Klik Start Scan

Scan URL Website

  1. Pilih tab URL Scan
  2. Masukkan URL target, contoh: https://example.com
  3. Atur Timeout (batas waktu koneksi)
  4. Klik Start URL Scan

2. Gambling / Slot Detector

Scan Path Lokal

  1. Buka halaman Gambling Detector dari sidebar
  2. Pilih tab Path Scan
  3. Masukkan path direktori website yang dicurigai
  4. Klik Start Scan

Scan URL Website

  1. Pilih tab URL Scan
  2. Masukkan URL website yang dicurigai terinfeksi script judi
  3. Klik Start URL Scan

Severity Level

Level Warna Deskripsi
๐Ÿ”ด Critical Merah Ancaman kritis, file backdoor/webshell teridentifikasi
๐ŸŸ  High Oranye Ancaman tinggi, kode berbahaya ditemukan
๐ŸŸก Medium Kuning Ancaman sedang, pola mencurigakan terdeteksi
๐Ÿ”ต Low Biru Ancaman rendah, informasi sensitivitas ringan
โšช Info Abu-abu Informasi tambahan, tidak mengancam

๐Ÿ”Œ API Endpoints

Method Endpoint Deskripsi
GET / Dashboard utama
GET /backdoor-scanner Halaman backdoor scanner
GET /gambling-detector Halaman gambling detector
GET /results/<scan_id> Halaman hasil scan
POST /api/scan/backdoor/path Scan backdoor di path lokal
POST /api/scan/backdoor/url Scan backdoor via URL
POST /api/scan/gambling/path Scan gambling di path lokal
POST /api/scan/gambling/url Scan gambling via URL
GET /api/scan/results/<scan_id> Ambil hasil scan (JSON)
GET /api/scan/export/<scan_id> Export hasil scan (download JSON)
GET /api/scans/history Riwayat semua scan

Contoh API Request

Scan Backdoor Path

curl -X POST http://localhost:5000/api/scan/backdoor/path \
  -H "Content-Type: application/json" \
  -d '{"path": "/var/www/html", "max_depth": 10, "max_files": 10000}'

Scan Backdoor URL

curl -X POST http://localhost:5000/api/scan/backdoor/url \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com", "timeout": 10}'

Scan Gambling Path

curl -X POST http://localhost:5000/api/scan/gambling/path \
  -H "Content-Type: application/json" \
  -d '{"path": "/var/www/html", "max_depth": 10, "max_files": 10000}'

Scan Gambling URL

curl -X POST http://localhost:5000/api/scan/gambling/url \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com", "timeout": 10}'

Contoh API Response

{
  "scan_id": "a1b2c3d4",
  "result": {
    "scan_path": "/var/www/html",
    "scan_time": "2026-03-07T06:00:00",
    "total_files_scanned": 1250,
    "total_threats_found": 3,
    "findings": [
      {
        "file": "uploads/image.jpg.php",
        "threat_level": "critical",
        "findings": [
          {
            "type": "double_extension",
            "pattern": "Double extension trick: image.jpg.php",
            "match_count": 1,
            "severity": "critical"
          }
        ]
      }
    ],
    "summary": {
      "critical": 2,
      "high": 1,
      "medium": 0,
      "low": 0,
      "info": 0
    },
    "status": "completed"
  }
}

๐Ÿ”ฌ Scanner Engine Details

Backdoor File Scanner

File: scanners/backdoor_scanner.py

Scanner ini menganalisis file-file di direktori lokal dengan metode:

  1. Extension Check โ€” Memeriksa ekstensi file berbahaya: .php, .phtml, .phar, .asp, .aspx, .jsp, .cgi, .pl, .sh, .bat, dll.
  2. Content Signature Analysis โ€” Mencocokkan 100+ pola regex:
    • Code execution: eval(), assert(), exec(), system(), shell_exec(), passthru()
    • Encoding/Obfuscation: base64_decode(), gzinflate(), str_rot13(), hex2bin()
    • Superglobals: $_GET, $_POST, $_REQUEST, $_FILES
    • File ops: move_uploaded_file(), file_put_contents(), fwrite()
    • Known shells: c99, r57, b374k, WSO, FilesMan, AnonymousFox, Alfa Shell
  3. Image Analysis โ€” Scan file gambar (PNG, JPG, GIF, ICO) untuk kode PHP/script tersembunyi
  4. Entropy Analysis โ€” Hitung Shannon entropy untuk deteksi obfuscation
  5. Known Webshell Filenames โ€” Database 40+ nama file webshell yang diketahui

URL Backdoor Scanner

File: scanners/url_scanner.py

Scanner ini menganalisis website via HTTP:

  1. Header Analysis โ€” Periksa security headers yang hilang dan information disclosure
  2. Content Analysis โ€” Scan HTML untuk form, input, textarea mencurigakan
  3. Link Analysis โ€” Ekstrak semua link dan cocokkan dengan pola URL webshell
  4. Path Probing โ€” Probe 40+ path webshell umum (shell.php, cmd.php, c99.php, dll.)
  5. Hidden Iframe Detection โ€” Deteksi iframe tersembunyi dengan style display:none
  6. Obfuscated JS Detection โ€” Identifikasi JavaScript yang di-obfuscate dengan eval()

Gambling Path Scanner

File: scanners/gambling_scanner.py

Scanner ini mendeteksi script judi online dengan:

  1. 80+ Gambling Keywords โ€” slot gacor, judi online, togel, pragmatic play, sbobet, dll.
  2. Gambling Domain Patterns โ€” slot*.com, judi*.com, togel*.com, dll.
  3. JavaScript Injection โ€” Deteksi injeksi JS gambling (popup, redirect, banner)
  4. SEO Spam Patterns โ€” display:none + gambling content, text-indent:-9999px
  5. Hidden Iframe Analysis โ€” Iframe tersembunyi yang mengarah ke situs gambling
  6. Redirect Detection โ€” window.location, meta refresh, PHP header() ke situs judi
  7. Filename Analysis โ€” File dengan nama mengandung kata gambling

Gambling URL Scanner

File: scanners/gambling_url_scanner.py

Scanner ini menganalisis website untuk konten gambling:

  1. Title & Meta Analysis โ€” Periksa title, description, keywords untuk kata kunci gambling
  2. Body Content Scan โ€” Analisis seluruh konten halaman
  3. Hidden Element Detection โ€” Temukan div/span tersembunyi berisi konten gambling
  4. Iframe Scanning โ€” Deteksi iframe ke domain gambling
  5. Redirect Analysis โ€” JavaScript redirect, meta refresh, server redirect
  6. Link Scanning โ€” Periksa semua link ke domain gambling
  7. Script Inspection โ€” Analisis inline dan external script
  8. Cloaking Detection โ€” Bandingkan konten Googlebot vs user browser

โš™๏ธ Konfigurasi

File konfigurasi: config.py

Parameter Default Deskripsi
SECRET_KEY Auto-generated Secret key Flask untuk session
MAX_CONTENT_LENGTH 16 MB Batas ukuran upload
SCAN_TIMEOUT 300 detik Batas waktu scan
MAX_SCAN_DEPTH 10 Kedalaman rekursi direktori
MAX_FILES_SCAN 10.000 Batas file per sesi scan
URL_CRAWL_DEPTH 3 Kedalaman crawl URL
URL_REQUEST_TIMEOUT 10 detik Timeout per HTTP request

Environment variables yang didukung:

# Set environment ke production
export FLASK_ENV=production

# Set secret key custom
export SECRET_KEY=your-super-secret-key-here

# Set port custom
export PORT=8080

๐Ÿšข Deployment

Deploy ke Heroku

# 1. Login ke Heroku
heroku login

# 2. Buat aplikasi baru
heroku create pysec-audit

# 3. Push ke Heroku
git init
git add .
git commit -m "Initial commit"
git push heroku main

# 4. Buka aplikasi
heroku open

Procfile sudah dikonfigurasi:

web: gunicorn app:app --bind 0.0.0.0:$PORT --workers 4 --timeout 120

Deploy ke VPS / Server

# 1. SSH ke server
ssh user@your-server-ip

# 2. Clone repository
git clone https://github.com/username/PySec-Audit-Website2.git
cd PySec-Audit-Website2

# 3. Setup virtual environment
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

# 4. Jalankan dengan Gunicorn
gunicorn app:app --bind 0.0.0.0:5000 --workers 4 --timeout 120 --daemon

# 5. (Opsional) Setup Nginx reverse proxy
# Buat file /etc/nginx/sites-available/pysec-audit:
#
# server {
#     listen 80;
#     server_name yourdomain.com;
#
#     location / {
#         proxy_pass http://127.0.0.1:5000;
#         proxy_set_header Host $host;
#         proxy_set_header X-Real-IP $remote_addr;
#     }
# }

โ“ Troubleshooting

1. Error: ModuleNotFoundError

# Pastikan virtual environment aktif
venv\Scripts\activate   # Windows
source venv/bin/activate # Linux/macOS

# Reinstall dependencies
pip install -r requirements.txt

2. Error: Permission denied saat scan path

Jalankan aplikasi dengan hak akses yang sesuai, atau pastikan user memiliki akses baca ke direktori target.

3. Error: PowerShell Execution Policy

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

4. Port sudah digunakan

# Ganti port
python app.py  # Edit PORT di environment variable
# Atau
export PORT=8080
python app.py

5. Gunicorn tidak jalan di Windows

Gunicorn tidak support Windows secara native. Gunakan alternatif:

pip install waitress
waitress-serve --port=5000 app:app

๐Ÿ“„ Lisensi

Proyek ini dilisensikan di bawah Apache Version 2 License.


๐Ÿ›ก๏ธ PySec Audit โ€” Dibuat untuk keamanan website Indonesia ๐Ÿ‡ฎ๐Ÿ‡ฉ

```

About

PySec Audit Web Scanner adalah website untuk audit dan scan website file backdoor tersembunyi dan file script judi online tersembunyi

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors