承接 hypothermic/phpxssblock 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

hypothermic/phpxssblock

Composer 安装命令:

composer require hypothermic/phpxssblock

包简介

Block the dirty script kiddies who are trying to use XSS on your web forms!

关键字:

README 文档

README

Block the IP Addresses of clients who are trying to exploit your website by using XSS.

Screenshot Example

Usage

See the form.php example to get a better view of how to implement this library.

At the top of each page, put:

<?php
use HypothermicIT\XSSBlock\XBlock;

if (XBlock::isBlocked($_SERVER['REMOTE_ADDR'])) {
    include 'my-error-page.html';
    exit();
}
?>

And, when handling user input, validate each $_GET and $_POST through the XBlock Sanitize Method:

$username = XBlock::Sanitize($_GET["username"], $_SERVER['REMOTE_ADDR']);

// For example, show it as a HTML paragraph.
echo("<p>Hello " . $username . "</p>");

Database

This library requires a database to store the list of blocked IP's. It is very simple to set up the database, and an implementation for MySQL/MariaDB is included by default. You will only need to create the database user and you're set.

CREATE USER IF NOT EXISTS `xssblock-user`@`localhost` IDENTIFIED BY "change_me!";
CREATE DATABASE IF NOT EXISTS `XSSBlock`; USE `XSSBlock`;
CREATE TABLE IF NOT EXISTS `XSSBlock`.`Registry`
        (`ip_addr` varchar(48) NOT NULL PRIMARY KEY)
        ENGINE=InnoDB DEFAULT CHARSET=utf8;
GRANT SELECT, INSERT ON `XSSBlock`.`Registry` TO `xssblock-user`@`localhost`;

By default, the MySQL implementation will try to connect to localhost:3306 with user xssblock-user. You may change the settings in config.php

Weaknesses

Of course, this project is more to scare off attackers than to provide security. The red screen surely looks scary and discouraging.

Keep in mind that a smart attacker could "change" his IP address by using a proxy/vpn or by connecting to the Tor network.

统计信息

  • 总下载量: 47
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-10-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固