Skip to main content

Turkce API'li guvenlik duvari kutuphanesi

Project description

Siper — Türkçe API'li Güvenlik Duvarı Kütüphanesi

Modern, genişletilebilir ve performans odaklı bir güvenlik duvarı kütüphanesi. Türkçe ve ASCII dostu API. JSON konfig, kural önceliği, karar önbelleği, olay aboneliği (audit), gelişmiş filtreler, CLI ve middleware desteği.

Kurulum

Kaynak koddan (yerel):

python -m pip install .

CLI komutu: siper (eski alias: guvenlik)

Hızlı Başlangıç

from siper import GuvenlikDuvari, Kural
from siper.filters import IPFiltre
from siper.guard import komut_gecir

komut_gecir("cyhperinios")
fw = GuvenlikDuvari(varsayilan="blok")
fw.kural_ekle(Kural([IPFiltre(izinli=["127.0.0.1"])], eylem="izin", ad="lokal"))

sonuc = fw.degerlendir(ip="127.0.0.1", port=80, protokol="TCP", yol="/", ek={"yontem": "GET"})
print(sonuc.eylem)  # izin

JSON Konfig ile Kullanım

ayar.json

{
  "varsayilan": "blok",
  "kurallar": [
    {
      "ad": "lokal",
      "eylem": "izin",
      "oncelik": 10,
      "durdur": true,
      "filtreler": [
        {"tip": "CIDRIPFiltre", "izinli": ["127.0.0.0/8"]}
      ]
    }
  ]
}

CLI:

siper cyhperinios --json-dosya ayar.json --test
# alias: guvenlik cyhperinios --json-dosya ayar.json --test

Başlıca Özellikler

  • Kural motoru: öncelik, durdur, ad, ayrıntılı Sonuc açıklamaları
  • Filtreler: IP/CIDR, port/port aralığı, protokol, HTTP yöntem/yol glob
  • Regex tabanlı denetimler: başlık/param/gövde (WAF için temel yapıtaşları)
  • Hız sınırlandırma: sliding window ve Token Bucket (burst destekli)
  • Bileşik filtreler: Ve/YaDa/Değil
  • Karar önbelleği (TTL + LRU)
  • Olay aboneliği (audit + JSON log)
  • Middleware: FastAPI ve Flask
  • CLI: JSON’dan yükle, test et

Middleware Örnekleri

FastAPI:

from fastapi import FastAPI
from siper.middleware.fastapi import GuvenlikFastAPIMiddleware
from siper import GuvenlikDuvari
from siper.guard import komut_gecir

komut_gecir("cyhperinios")
fw = GuvenlikDuvari(varsayilan="blok")
app = FastAPI()
app.add_middleware(GuvenlikFastAPIMiddleware, guard=fw)

Flask:

from flask import Flask
from siper.middleware.flask import guvenlik_flask_middleware
from siper import GuvenlikDuvari
from siper.guard import komut_gecir

komut_gecir("cyhperinios")
fw = GuvenlikDuvari(varsayilan="blok")
app = Flask(__name__)
guvenlik_flask_middleware(app, fw)

Gelişmiş Log ve Metrikler

from siper.logging_conf import kur_json_logger, olay_gunluk_abonesi
from siper.utils.metrics import PrometheusAbone

logger = kur_json_logger()
fw.abone_ekle(olay_gunluk_abonesi(logger))
fw.abone_ekle(PrometheusAbone(prefix="siper"))

Prometheus desteği opsiyoneldir: pip install prometheus-client

Güvenlik Notu — Komut Kapısı

Kütüphane, çalışmadan önce gizli komut ister:

from siper.guard import komut_gecir
komut_gecir("cyhperinios")

config.yukle* fonksiyonlarında da doğrulama zorunludur.

Lisans

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

siper-0.1.0.tar.gz (18.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

siper-0.1.0-py3-none-any.whl (25.9 kB view details)

Uploaded Python 3

File details

Details for the file siper-0.1.0.tar.gz.

File metadata

  • Download URL: siper-0.1.0.tar.gz
  • Upload date:
  • Size: 18.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0

File hashes

Hashes for siper-0.1.0.tar.gz
Algorithm Hash digest
SHA256 aaa6ba3a9c378a6d8491a63e806545ccff564139ce787a8d228c4683ff5282d7
MD5 aa92754f5017f795e89346c462b5653e
BLAKE2b-256 9b50735f8ba07bba3a1fa41f9008f8bb50f4a32a244bba095d29392bf93f2ba8

See more details on using hashes here.

File details

Details for the file siper-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: siper-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 25.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0

File hashes

Hashes for siper-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f8e337a2d82bd4cad55e6dd1baad0765ef4adbe058268572afe775d939cf09a6
MD5 6f723d4dfeaa26c6c2b84526bafdec57
BLAKE2b-256 7fb1a8b0ca7a3cc9419c2607f20c49cee181472996f1eca5e5b54c82cf2d5613

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page