Skip to content

Instantly share code, notes, and snippets.

@nlap
Created May 10, 2016 20:32
Show Gist options
  • Save nlap/690fefbed0f706d3c48fa58299dba6af to your computer and use it in GitHub Desktop.
Save nlap/690fefbed0f706d3c48fa58299dba6af to your computer and use it in GitHub Desktop.
Command line version of CSF's Server Security Check feature
#!/usr/bin/perl
###############################################################################
# Copyright 2006-2014, Way to the Web Limited
# URL: http://www.configserver.com
# Email: sales@waytotheweb.com
###############################################################################
# start main
#use strict;
use lib '/usr/local/csf/lib';
use Fcntl qw(:DEFAULT :flock);
use File::Basename;
use Net::CIDR::Lite;
use IPC::Open3;
use ConfigServer::Config;
use ConfigServer::CheckIP;
use ConfigServer::Ports;
use ConfigServer::URLGet;
use ConfigServer::Sanity;
use ConfigServer::ServerCheck;
use ConfigServer::ServerStats;
use HTML::Strip;
umask(0177);
my $hs = HTML::Strip->new();
my $clean_text = $hs->parse( ConfigServer::ServerCheck::report($FORM{verbose}) );
$hs->eof;
$clean_text =~ s/ \n//g;
$clean_text =~ s/ //g;
$clean_text =~ s/\n\n\n/\n\n/g;
print $clean_text;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment