PHPackages                             lhdev/li-csf-parser - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. lhdev/li-csf-parser

AbandonedArchivedProject[Parsing &amp; Serialization](/categories/parsing)

lhdev/li-csf-parser
===================

PHP Class for parsing CSF csf.deny file into an array

129PHP

Since Dec 13Pushed 10y ago1 watchersCompare

[ Source](https://github.com/lhdev/li-csf-parser)[ Packagist](https://packagist.org/packages/lhdev/li-csf-parser)[ RSS](/packages/lhdev-li-csf-parser/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

[![](https://camo.githubusercontent.com/0c9d6c071c06ea29828dd4f0f7c080feedaffbfc2a95f47f183a565778592589/68747470733a2f2f6c69746869756d686f7374696e672e636f6d2f696d616765732f6c6f676f5f6e65775f626c61636b2e706e67)](https://camo.githubusercontent.com/0c9d6c071c06ea29828dd4f0f7c080feedaffbfc2a95f47f183a565778592589/68747470733a2f2f6c69746869756d686f7374696e672e636f6d2f696d616765732f6c6f676f5f6e65775f626c61636b2e706e67)

PHP CSF Deny Parser
-------------------

[](#php-csf-deny-parser)

**from Lithium Hosting**
We're always open to pull requests, feel free to make this your own or help us make it better.

### Copyright

[](#copyright)

(c) Lithium Hosting, llc

### License

[](#license)

This library is licensed under the MIT license; you can find a full copy of the license itself in the file /LICENSE

### Requirements

[](#requirements)

- PHP 5.5.9 or newer
- [Carbon](http://carbon.nesbot.com) \*installed via composer

### Description

[](#description)

CSF is Config Server Firewall, most commonly used on cPanel servers.
CSF can be obtained [here](http://configserver.com/cp/csf.html).

---

### Usage

[](#usage)

The purpose of this script is to provide an easy way to parse the Deny file and output the important bits to an array.
The initial commit was written in a few hours, so it probably needs some work.

**Installation**
Installation is easy, just add the following to your composer.json and then run composer update

```
"lhdev/li-csf-parser": "dev-master"

```

Example csf.deny file
Path: /etc/csf/csf.deny

```
###############################################################################
# Copyright 2006-2015, Way to the Web Limited
# URL: http://www.configserver.com
# Email: sales@waytotheweb.com
###############################################################################
# The following IP addresses will be blocked in iptables
# One IP address per line
# CIDR addressing allowed with a quaded IP (e.g. 192.168.254.0/24)
# Only list IP addresses, not domain names (they will be ignored)
#
# Note: If you add the text "do not delete" to the comments of an entry then
# DENY_IP_LIMIT will ignore those entries and not remove them
#
# Advanced port+ip filtering allowed with the following format
# tcp/udp|in/out|s/d=port|s/d=ip
#
# See readme.txt for more information regarding advanced port filtering
#
127.0.0.1 # lfd: (ftpd) Failed FTP login from 127.0.0.1 (CN/China/-): 20 in the last 300 secs - Sat Oct 31 18:05:33 2015
127.0.0.1 # lfd: (sshd) Failed SSH login from 127.0.0.1 (MU/Mauritius/-): 20 in the last 300 secs - Sat Oct 31 18:37:08 2015
127.0.0.1 # lfd: (cpanel) Failed cPanel login from 127.0.0.1 (PL/Poland/-): 20 in the last 300 secs - Sat Oct 31 18:45:36 2015

```

**Standard Usage**

```
