Ir para conteúdo
Facebook Whatsapp Twitter Youtube

Pesquisar na Comunidade

Mostrando resultados para as tags ''firewall''.

  • Pesquisar por Tags

    Digite tags separadas por vírgulas
  • Pesquisar por Autor

Tipo de Conteúdo


Fórum

  • Perfect World
    • Arquivos
    • Editores
    • Web
    • Mapas
    • Scripts
    • Customs
    • Segurança
    • Desenvolvimento
    • VIP
    • Tutorial
    • Perguntas
    • Soluções de Problema
    • Solicitações
    • Projetos
    • Diversos
  • Plus
    • Outros Jogos
    • Yokebone
    • Off-Topic
    • Histórico de Doações
    • Outro Idioma
  • Mercado
    • Vender
    • Comprar
    • Serviços
    • Indicação
    • Parcerias
  • Membros
    • Lista Negra
    • Banidos

Encontrar resultados em...

Encontrar resultados que...


Data de Criação

  • Início

    FIM


Data de Atualização

  • Início

    FIM


Filtrar pelo número de...

Data de Registro

  • Início

    FIM


Grupo


Sobre min

Encontrado 2 registros

  1. deprox

    Firewall C++ D-Proxy

    Base Firewall usado no D-Proxy Sistema Operacional: Alma Linux 8 Módulos Ativos + Proteção contra ataques SYN Flood + Proteção contra ataques UDP Flood + Gerenciamento automático de bloqueios + Filtragem baseada em portas + Registro de logs + Execução automática de regras de firewall + Módulos como Fail2Ban, slowloris ou iptables com rate limiting podem ser implementados opcionalmente. como copilar? sudo dnf install -y gcc-c++ libpcap-devel firewalld g++ -o firewall_monitor firewall_monitor.cpp -lpcap -lpthread para deixar rodando 24 Hrs sudo dnf install -y screen screen -S firewall_monitor sudo ./firewall_monitor Ctrl + A, depois solte e aperte D config.txt ports=29000,3306,80,39000,22 firewall_monitor.cpp #include <iostream> #include <pcap.h> #include <unordered_map> #include <ctime> #include <cstring> #include <fstream> #include <sstream> #include <chrono> #include <thread> #include <vector> #include <algorithm> #include <cstdint> #include <arpa/inet.h> #include <netinet/ip.h> #include <netinet/tcp.h> #include <netinet/udp.h> #include <netinet/ip_icmp.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> // Ayarlar const std::string device = "eth0"; // Ağ arayüzü const int max_conn_per_sec = 200; // Saniye başına bağlantı limiti const int block_time = 86400; // Engelleme süresi (saniye cinsinden) (24 saat) const std::string log_file = "logs.txt"; // Günlük dosyası const std::string config_file = "config.txt"; // Yapılandırma dosyası // Bağlantı sayım yapıları struct ConnInfo { int count; std::time_t last_seen; }; std::unordered_map<std::string, ConnInfo> conn_count; // IP başına bağlantı sayacı std::unordered_map<std::string, ConnInfo> syn_count; // IP başına SYN sayacı std::unordered_map<std::string, ConnInfo> udp_count; // IP başına UDP sayacı std::unordered_map<std::string, std::time_t> blocked_ips; // Engellenen IP'ler ve süresi std::vector<uint16_t> ports; // Korumaya alınacak bağlantı noktaları (yapılandırma dosyasından yüklenir) // Günlük kaydı işlevi void log_message(const std::string& message) { std::ofstream log_stream(log_file, std::ios::app); if (log_stream.is_open()) { auto now = std::chrono::system_clock::now(); std::time_t now_time = std::chrono::system_clock::to_time_t(now); log_stream << "[" << std::ctime(&now_time) << "] " << message << std::endl; } } // IP engelleme işlevi void block_ip(const std::string& ip) { std::string command = "sudo firewall-cmd --permanent --add-rich-rule='rule family=\"ipv4\" source address=\"" + ip + "\" reject'"; system(command.c_str()); system("sudo firewall-cmd --reload"); blocked_ips[ip] = std::time(nullptr) + block_time; // Engelleme süresi belirlenir log_message("IP " + ip + " 24 saat boyunca engellendi."); } // Süresi dolmuş IP engellerini kaldıran işlev void unblock_expired_ips() { auto now = std::time(nullptr); for (auto it = blocked_ips.begin(); it != blocked_ips.end(); ) { if (now >= it->second) { std::string command = "sudo firewall-cmd --permanent --remove-rich-rule='rule family=\"ipv4\" source address=\"" + it->first + "\" reject'"; system(command.c_str()); system("sudo firewall-cmd --reload"); log_message("IP " + it->first + " engeli kaldırıldı."); it = blocked_ips.erase(it); } else { ++it; } } } // Paket işleme işlevi void process_packet(u_char* user, const struct pcap_pkthdr* pkthdr, const u_char* packet) { struct ip* ip_header = (struct ip*)(packet + 14); // Ethernet başlığını (14 bayt) atlar struct tcphdr* tcp_header = (struct tcphdr*)(packet + 14 + (ip_header->ip_hl << 2)); struct udphdr* udp_header = (struct udphdr*)(packet + 14 + (ip_header->ip_hl << 2)); struct icmp* icmp_header = (struct icmp*)(packet + 14 + (ip_header->ip_hl << 2)); char src_ip[INET_ADDRSTRLEN]; inet_ntop(AF_INET, &(ip_header->ip_src), src_ip, INET_ADDRSTRLEN); uint16_t dst_port = 0; if (ip_header->ip_p == IPPROTO_TCP) { dst_port = ntohs(tcp_header->th_dport); } else if (ip_header->ip_p == IPPROTO_UDP) { dst_port = ntohs(udp_header->uh_dport); } // IP engellenmiş mi kontrol et if (blocked_ips.find(src_ip) != blocked_ips.end()) { return; // Engellenmiş IP'den gelen paketleri yok say } // Bağlantı noktası koruma listesinde mi kontrol et if (std::find(ports.begin(), ports.end(), dst_port) != ports.end()) { auto now = std::time(nullptr); // Eski bağlantıları temizle for (auto it = conn_count.begin(); it != conn_count.end(); ) { if (now - it->second.last_seen > 1) { it = conn_count.erase(it); } else { ++it; } } // SYN paketlerini say ve limit aşılırsa IP'yi engelle if (ip_header->ip_p == IPPROTO_TCP && (tcp_header->th_flags & TH_SYN)) { syn_count[src_ip].count++; syn_count[src_ip].last_seen = now; if (syn_count[src_ip].count > max_conn_per_sec) { block_ip(src_ip); syn_count.erase(src_ip); return; } } // UDP paketlerini say ve limit aşılırsa IP'yi engelle if (ip_header->ip_p == IPPROTO_UDP) { udp_count[src_ip].count++; udp_count[src_ip].last_seen = now; if (udp_count[src_ip].count > max_conn_per_sec) { block_ip(src_ip); udp_count.erase(src_ip); return; } } } } int main() { // Başlatma mesajı std::cout << "Anti-DDoS başlatılıyor..." << std::endl; log_message("Anti-DDoS başarıyla başlatıldı."); char errbuf[PCAP_ERRBUF_SIZE]; pcap_t* handle = pcap_open_live(device.c_str(), BUFSIZ, 1, 1000, errbuf); if (handle == nullptr) { std::cerr << "Aygıt açılırken hata: " << errbuf << std::endl; log_message("Aygıt açılırken hata: " + std::string(errbuf)); return 1; } // Ana döngü while (true) { pcap_loop(handle, -1, process_packet, nullptr); unblock_expired_ips(); // Süresi dolmuş IP engellerini kaldır std::this_thread::sleep_for(std::chrono::seconds(1)); } pcap_close(handle); return 0; }
  2. Master

    script Instalação firewall ufw

    script instalar firewall ufw também vendo um mais avançado entra contato comigo discord master9028 ufw.sh

Suporte GM

Comunidade de Perfect World do Brasil

Copyright © 2023-2024 SuporteGM Powered by Invision Community
Поддержка Invision Community в России

Links

×
×
  • Criar Novo...