local commit

This commit is contained in:
root 2020-05-02 15:56:26 +02:00
parent 57e2cba90f
commit 12ae60c6f2
8 changed files with 8232 additions and 8232 deletions

View file

@ -1,188 +1,188 @@
sudo: false
language: perl
matrix:
include:
- addons:
mariadb: "5.5"
name: "MariaDB 5.5/Perl 5.24"
perl: "5.24"
- addons:
mariadb: "10.0"
name: "MariaDB 10.0/Perl 5.24"
perl: "5.24"
- addons:
mariadb: "10.1"
name: "MariaDB 10.1/Perl 5.24"
perl: "5.24"
- addons:
mariadb: "10.2"
name: "MariaDB 10.2/Perl 5.24"
perl: "5.24"
- addons:
mariadb: "10.3"
name: "MariaDB 10.3/Perl 5.24"
perl: "5.24"
- addons:
mariadb: "10.4"
name: "MariaDB 10.4/Perl 5.24"
perl: "5.24"
- addons:
mysql: "5.5"
name: "MySQL 5.5/Perl 5.24"
perl: "5.24"
- addons:
mysql: "5.6"
name: "MySQL 5.6/Perl 5.24"
perl: "5.24"
- addons:
apt:
sources:
- mysql-5.7-trusty
packages:
- mysql-server
- mysql-client
name: "MySQL 5.7/Perl 5.24"
perl: "5.24"
- addons:
apt:
sources:
- mysql-8.0-trusty
packages:
- mysql-server
- mysql-client
name: "MySQL 8/Perl 5.24"
perl: "5.24"
- addons:
mariadb: "5.5"
name: "MariaDB 5.5/Perl 5.16"
perl: "5.16"
- addons:
mariadb: "10.0"
name: "MariaDB 10.0/Perl 5.16"
perl: "5.16"
- addons:
mariadb: "10.1"
name: "MariaDB 10.1/Perl 5.16"
perl: "5.16"
- addons:
mariadb: "10.2"
name: "MariaDB 10.2/Perl 5.16"
perl: "5.16"
- addons:
mariadb: "10.3"
name: "MariaDB 10.3/Perl 5.16"
perl: "5.16"
- addons:
mariadb: "10.4"
name: "MariaDB 10.4/Perl 5.16"
perl: "5.16"
- addons:
mysql: "5.5"
name: "MySQL 5.5/Perl 5.16"
perl: "5.16"
- addons:
mysql: "5.6"
name: "MySQL 5.6/Perl 5.16"
perl: "5.16"
- addons:
apt:
sources:
- mysql-5.7-trusty
packages:
- mysql-server
- mysql-client
name: "MySQL 5.7/Perl 5.16"
perl: "5.16"
- addons:
apt:
sources:
- mysql-8.0-trusty
packages:
- mysql-server
- mysql-client
name: "MySQL 8/Perl 5.16"
perl: "5.16"
- addons:
mariadb: "5.5"
name: "MariaDB 5.5/Perl 5.10"
perl: "5.10"
- addons:
mariadb: "10.0"
name: "MariaDB 10.0/Perl 5.10"
perl: "5.10"
- addons:
mariadb: "10.1"
name: "MariaDB 10.1/Perl 5.10"
perl: "5.10"
- addons:
mariadb: "10.2"
name: "MariaDB 10.2/Perl 5.10"
perl: "5.10"
- addons:
mariadb: "10.3"
name: "MariaDB 10.3/Perl 5.10"
perl: "5.10"
- addons:
mariadb: "10.4"
name: "MariaDB 10.4/Perl 5.10"
perl: "5.10"
- addons:
mysql: "5.5"
name: "MySQL 5.5/Perl 5.10"
perl: "5.10"
- addons:
mysql: "5.6"
name: "MySQL 5.6/Perl 5.10"
perl: "5.10"
- addons:
apt:
sources:
- mysql-5.7-trusty
packages:
- mysql-server
- mysql-client
name: "MySQL 5.7/Perl 5.10"
perl: "5.10"
- addons:
apt:
sources:
- mysql-8.0-trusty
packages:
- mysql-server
- mysql-client
name: "MySQL 8/Perl 5.10"
perl: "5.10"
before_install:
- git clone git://github.com/haarg/perl-travis-helper
- source perl-travis-helper/init
- build-perl
- perl -V
install:
- cpanm --quiet --notest Data::Dumper
- cpanm --quiet --notest JSON
- cpanm --quiet --notest Perl::Critic
- cpanm --quiet --notest Text::Template
before_script:
- echo -e "[client]\nuser=root\npassword=\"\"" > .my.cnf
- chmod 600 .my.cnf
- git clone https://github.com/datacharmer/test_db.git
- cd test_db
- cat employees.sql | grep -v 'storage_engine' | mysql
- cd ..
script:
- perlcritic --exclude InputOutput::ProhibitInteractiveTest mysqltuner.pl
- ./mysqltuner.pl --verbose --tbstat 2>stderr.txt | tee -a "stdout.txt"
after_script:
- echo "Standard Output: $(cat stdout.txt)"
- echo "Standard Error : $(cat stderr.txt)"
- [ "0" = "$(wl -l stderr.txt)" ] || exit 2
sudo: false
language: perl
matrix:
include:
- addons:
mariadb: "5.5"
name: "MariaDB 5.5/Perl 5.24"
perl: "5.24"
- addons:
mariadb: "10.0"
name: "MariaDB 10.0/Perl 5.24"
perl: "5.24"
- addons:
mariadb: "10.1"
name: "MariaDB 10.1/Perl 5.24"
perl: "5.24"
- addons:
mariadb: "10.2"
name: "MariaDB 10.2/Perl 5.24"
perl: "5.24"
- addons:
mariadb: "10.3"
name: "MariaDB 10.3/Perl 5.24"
perl: "5.24"
- addons:
mariadb: "10.4"
name: "MariaDB 10.4/Perl 5.24"
perl: "5.24"
- addons:
mysql: "5.5"
name: "MySQL 5.5/Perl 5.24"
perl: "5.24"
- addons:
mysql: "5.6"
name: "MySQL 5.6/Perl 5.24"
perl: "5.24"
- addons:
apt:
sources:
- mysql-5.7-trusty
packages:
- mysql-server
- mysql-client
name: "MySQL 5.7/Perl 5.24"
perl: "5.24"
- addons:
apt:
sources:
- mysql-8.0-trusty
packages:
- mysql-server
- mysql-client
name: "MySQL 8/Perl 5.24"
perl: "5.24"
- addons:
mariadb: "5.5"
name: "MariaDB 5.5/Perl 5.16"
perl: "5.16"
- addons:
mariadb: "10.0"
name: "MariaDB 10.0/Perl 5.16"
perl: "5.16"
- addons:
mariadb: "10.1"
name: "MariaDB 10.1/Perl 5.16"
perl: "5.16"
- addons:
mariadb: "10.2"
name: "MariaDB 10.2/Perl 5.16"
perl: "5.16"
- addons:
mariadb: "10.3"
name: "MariaDB 10.3/Perl 5.16"
perl: "5.16"
- addons:
mariadb: "10.4"
name: "MariaDB 10.4/Perl 5.16"
perl: "5.16"
- addons:
mysql: "5.5"
name: "MySQL 5.5/Perl 5.16"
perl: "5.16"
- addons:
mysql: "5.6"
name: "MySQL 5.6/Perl 5.16"
perl: "5.16"
- addons:
apt:
sources:
- mysql-5.7-trusty
packages:
- mysql-server
- mysql-client
name: "MySQL 5.7/Perl 5.16"
perl: "5.16"
- addons:
apt:
sources:
- mysql-8.0-trusty
packages:
- mysql-server
- mysql-client
name: "MySQL 8/Perl 5.16"
perl: "5.16"
- addons:
mariadb: "5.5"
name: "MariaDB 5.5/Perl 5.10"
perl: "5.10"
- addons:
mariadb: "10.0"
name: "MariaDB 10.0/Perl 5.10"
perl: "5.10"
- addons:
mariadb: "10.1"
name: "MariaDB 10.1/Perl 5.10"
perl: "5.10"
- addons:
mariadb: "10.2"
name: "MariaDB 10.2/Perl 5.10"
perl: "5.10"
- addons:
mariadb: "10.3"
name: "MariaDB 10.3/Perl 5.10"
perl: "5.10"
- addons:
mariadb: "10.4"
name: "MariaDB 10.4/Perl 5.10"
perl: "5.10"
- addons:
mysql: "5.5"
name: "MySQL 5.5/Perl 5.10"
perl: "5.10"
- addons:
mysql: "5.6"
name: "MySQL 5.6/Perl 5.10"
perl: "5.10"
- addons:
apt:
sources:
- mysql-5.7-trusty
packages:
- mysql-server
- mysql-client
name: "MySQL 5.7/Perl 5.10"
perl: "5.10"
- addons:
apt:
sources:
- mysql-8.0-trusty
packages:
- mysql-server
- mysql-client
name: "MySQL 8/Perl 5.10"
perl: "5.10"
before_install:
- git clone git://github.com/haarg/perl-travis-helper
- source perl-travis-helper/init
- build-perl
- perl -V
install:
- cpanm --quiet --notest Data::Dumper
- cpanm --quiet --notest JSON
- cpanm --quiet --notest Perl::Critic
- cpanm --quiet --notest Text::Template
before_script:
- echo -e "[client]\nuser=root\npassword=\"\"" > .my.cnf
- chmod 600 .my.cnf
- git clone https://github.com/datacharmer/test_db.git
- cd test_db
- cat employees.sql | grep -v 'storage_engine' | mysql
- cd ..
script:
- perlcritic --exclude InputOutput::ProhibitInteractiveTest mysqltuner.pl
- ./mysqltuner.pl --verbose --tbstat 2>stderr.txt | tee -a "stdout.txt"
after_script:
- echo "Standard Output: $(cat stdout.txt)"
- echo "Standard Error : $(cat stderr.txt)"
- [ "0" = "$(wl -l stderr.txt)" ] || exit 2

306
USAGE.md
View file

@ -1,153 +1,153 @@
# NAME
MySQLTuner 1.7.15 - MySQL High Performance Tuning Script
# IMPORTANT USAGE GUIDELINES
To run the script with the default options, run the script without arguments
Allow MySQL server to run for at least 24-48 hours before trusting suggestions
Some routines may require root level privileges (script will provide warnings)
You must provide the remote server's total memory when connecting to other servers
# CONNECTION AND AUTHENTICATION
--host <hostname> Connect to a remote host to perform tests (default: localhost)
--socket <socket> Use a different socket for a local connection
--port <port> Port to use for connection (default: 3306)
--user <username> Username to use for authentication
--userenv <envvar> Name of env variable which contains username to use for authentication
--pass <password> Password to use for authentication
--passenv <envvar> Name of env variable which contains password to use for authentication
--ssl-ca <path> Path to public key
--mysqladmin <path> Path to a custom mysqladmin executable
--mysqlcmd <path> Path to a custom mysql executable
--defaults-file <path> Path to a custom .my.cnf
# PERFORMANCE AND REPORTING OPTIONS
--skipsize Don't enumerate tables and their types/sizes (default: on)
(Recommended for servers with many tables)
--skippassword Don't perform checks on user passwords(default: off)
--checkversion Check for updates to MySQLTuner (default: don't check)
--updateversion Check for updates to MySQLTuner and update when newer version is available (default: don't check)
--forcemem <size> Amount of RAM installed in megabytes
--forceswap <size> Amount of swap memory configured in megabytes
--passwordfile <path> Path to a password file list(one password by line)
# OUTPUT OPTIONS
--silent Don't output anything on screen
--nogood Remove OK responses
--nobad Remove negative/suggestion responses
--noinfo Remove informational responses
--debug Print debug information
--noprocess Consider no other process is running
--dbstat Print database information
--nodbstat Don't Print database information
--tbstat Print table information
--notbstat Don't Print table information
--idxstat Print index information
--noidxstat Don't Print index information
--sysstat Print system information
--nosysstat Don't Print system information
--pfstat Print Performance schema
--nopfstat Don't Print Performance schema
--verbose Prints out all options (default: no verbose, dbstat, idxstat, sysstat, tbstat, pfstat)
--bannedports Ports banned separated by comma(,)
--maxportallowed Number of ports opened allowed on this hosts
--cvefile <path> CVE File for vulnerability checks
--nocolor Don't print output in color
--json Print result as JSON string
--buffers Print global and per-thread buffer values
--outputfile <path> Path to a output txt file
--reportfile <path> Path to a report txt file
--template <path> Path to a template file
# PERLDOC
You can find documentation for this module with the perldoc command.
perldoc mysqltuner
## INTERNALS
[https://github.com/major/MySQLTuner-perl/blob/master/INTERNALS.md](https://github.com/major/MySQLTuner-perl/blob/master/INTERNALS.md)
Internal documentation
# AUTHORS
Major Hayden - major@mhtx.net
# CONTRIBUTORS
- Matthew Montgomery
- Paul Kehrer
- Dave Burgess
- Jonathan Hinds
- Mike Jackson
- Nils Breunese
- Shawn Ashlee
- Luuk Vosslamber
- Ville Skytta
- Trent Hornibrook
- Jason Gill
- Mark Imbriaco
- Greg Eden
- Aubin Galinotti
- Giovanni Bechis
- Bill Bradford
- Ryan Novosielski
- Michael Scheidell
- Blair Christensen
- Hans du Plooy
- Victor Trac
- Everett Barnes
- Tom Krouper
- Gary Barrueto
- Simon Greenaway
- Adam Stein
- Isart Montane
- Baptiste M.
- Cole Turner
- Major Hayden
- Joe Ashcraft
- Jean-Marie Renouard
- Stephan GroBberndt
- Christian Loos
# SUPPORT
Bug reports, feature requests, and downloads at http://mysqltuner.com/
Bug tracker can be found at https://github.com/major/MySQLTuner-perl/issues
Maintained by Major Hayden (major\\@mhtx.net) - Licensed under GPL
# SOURCE CODE
[https://github.com/major/MySQLTuner-perl](https://github.com/major/MySQLTuner-perl)
git clone https://github.com/major/MySQLTuner-perl.git
# COPYRIGHT AND LICENSE
Copyright (C) 2006-2018 Major Hayden - major@mhtx.net
For the latest updates, please visit http://mysqltuner.com/
Git repository available at https://github.com/major/MySQLTuner-perl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see &lt;https://www.gnu.org/licenses/>.
# NAME
MySQLTuner 1.7.15 - MySQL High Performance Tuning Script
# IMPORTANT USAGE GUIDELINES
To run the script with the default options, run the script without arguments
Allow MySQL server to run for at least 24-48 hours before trusting suggestions
Some routines may require root level privileges (script will provide warnings)
You must provide the remote server's total memory when connecting to other servers
# CONNECTION AND AUTHENTICATION
--host <hostname> Connect to a remote host to perform tests (default: localhost)
--socket <socket> Use a different socket for a local connection
--port <port> Port to use for connection (default: 3306)
--user <username> Username to use for authentication
--userenv <envvar> Name of env variable which contains username to use for authentication
--pass <password> Password to use for authentication
--passenv <envvar> Name of env variable which contains password to use for authentication
--ssl-ca <path> Path to public key
--mysqladmin <path> Path to a custom mysqladmin executable
--mysqlcmd <path> Path to a custom mysql executable
--defaults-file <path> Path to a custom .my.cnf
# PERFORMANCE AND REPORTING OPTIONS
--skipsize Don't enumerate tables and their types/sizes (default: on)
(Recommended for servers with many tables)
--skippassword Don't perform checks on user passwords(default: off)
--checkversion Check for updates to MySQLTuner (default: don't check)
--updateversion Check for updates to MySQLTuner and update when newer version is available (default: don't check)
--forcemem <size> Amount of RAM installed in megabytes
--forceswap <size> Amount of swap memory configured in megabytes
--passwordfile <path> Path to a password file list(one password by line)
# OUTPUT OPTIONS
--silent Don't output anything on screen
--nogood Remove OK responses
--nobad Remove negative/suggestion responses
--noinfo Remove informational responses
--debug Print debug information
--noprocess Consider no other process is running
--dbstat Print database information
--nodbstat Don't Print database information
--tbstat Print table information
--notbstat Don't Print table information
--idxstat Print index information
--noidxstat Don't Print index information
--sysstat Print system information
--nosysstat Don't Print system information
--pfstat Print Performance schema
--nopfstat Don't Print Performance schema
--verbose Prints out all options (default: no verbose, dbstat, idxstat, sysstat, tbstat, pfstat)
--bannedports Ports banned separated by comma(,)
--maxportallowed Number of ports opened allowed on this hosts
--cvefile <path> CVE File for vulnerability checks
--nocolor Don't print output in color
--json Print result as JSON string
--buffers Print global and per-thread buffer values
--outputfile <path> Path to a output txt file
--reportfile <path> Path to a report txt file
--template <path> Path to a template file
# PERLDOC
You can find documentation for this module with the perldoc command.
perldoc mysqltuner
## INTERNALS
[https://github.com/major/MySQLTuner-perl/blob/master/INTERNALS.md](https://github.com/major/MySQLTuner-perl/blob/master/INTERNALS.md)
Internal documentation
# AUTHORS
Major Hayden - major@mhtx.net
# CONTRIBUTORS
- Matthew Montgomery
- Paul Kehrer
- Dave Burgess
- Jonathan Hinds
- Mike Jackson
- Nils Breunese
- Shawn Ashlee
- Luuk Vosslamber
- Ville Skytta
- Trent Hornibrook
- Jason Gill
- Mark Imbriaco
- Greg Eden
- Aubin Galinotti
- Giovanni Bechis
- Bill Bradford
- Ryan Novosielski
- Michael Scheidell
- Blair Christensen
- Hans du Plooy
- Victor Trac
- Everett Barnes
- Tom Krouper
- Gary Barrueto
- Simon Greenaway
- Adam Stein
- Isart Montane
- Baptiste M.
- Cole Turner
- Major Hayden
- Joe Ashcraft
- Jean-Marie Renouard
- Stephan GroBberndt
- Christian Loos
# SUPPORT
Bug reports, feature requests, and downloads at http://mysqltuner.com/
Bug tracker can be found at https://github.com/major/MySQLTuner-perl/issues
Maintained by Major Hayden (major\\@mhtx.net) - Licensed under GPL
# SOURCE CODE
[https://github.com/major/MySQLTuner-perl](https://github.com/major/MySQLTuner-perl)
git clone https://github.com/major/MySQLTuner-perl.git
# COPYRIGHT AND LICENSE
Copyright (C) 2006-2018 Major Hayden - major@mhtx.net
For the latest updates, please visit http://mysqltuner.com/
Git repository available at https://github.com/major/MySQLTuner-perl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see &lt;https://www.gnu.org/licenses/>.

View file

@ -1,114 +1,114 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "centos/7"
# config.vm.box_check_update = false
# config.vbguest.auto_update = true
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
if Vagrant.has_plugin?("vagrant-proxyconfx")
config.proxy.http = "http://10.195.50.51:3128/"
config.proxy.https = "http://10.195.50.51:3128/"
config.proxy.no_proxy = "localhost,127.0.0.1,.example.com"
end
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.0.100"
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
config.vm.network "public_network"
config.vm.hostname = 'maria100'
config.hostmanager.aliases = %w(maria100.localdomain maria100.local)
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
config.vm.synced_folder "./data", "/data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = false
#
# # Customize the amount of memory on the VM:
vb.memory = "1024"
end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
config.vm.provision "shell", inline: <<-SHELL
sudo yum -y update
echo "secret" | sudo passwd --stdin root
sudo cp -pr ~vagrant/.ssh /root
sudo chown -R root.root /root/.ssh
sudo yum-config-manager --enable base
echo "[mariadb]" >/tmp/mariadb.repo
echo "name = MariaDB" >>/tmp/mariadb.repo
echo "baseurl = http://yum.mariadb.org/10.0/centos7-amd64" >> /tmp/mariadb.repo
echo "gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB" >> /tmp/mariadb.repo
echo "gpgcheck=1" >> /tmp/mariadb.repo
sudo cp /tmp/mariadb.repo /etc/yum.repos.d/
sudo rpm -Uvh http://mirrors.ircam.fr/pub/fedora/epel/7/x86_64/e/epel-release-latest.noarch.rpm
sudo yum -y install python2-pip git python perl-WWW-Mechanize-GZip perl-App-cpanminus perl-List-MoreUtils MariaDB-server MariaDB-Client wget
sudo pip install --upgrade pip
if [ ! -d "/data/MySQLTuner-perl" ]; then
cd /data
sudo git clone https://github.com/major/MySQLTuner-perl.git
fi
sudo cpanm install File::Util
#sudo systemctl start mariadb.service
sudo service mysql start
mysql -e 'select version();'
cd /data
sudo wget "https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2"
sudo tar xvjf employees_db-full-1.0.6.tar.bz2
cd employees_db
cat employees.sql | mysql
cd ..
cd MySQLTuner-perl
perl mysqltuner.pl --idxstat --dbstat
SHELL
config.vm.provision :hostmanager
end
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "centos/7"
# config.vm.box_check_update = false
# config.vbguest.auto_update = true
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
if Vagrant.has_plugin?("vagrant-proxyconfx")
config.proxy.http = "http://10.195.50.51:3128/"
config.proxy.https = "http://10.195.50.51:3128/"
config.proxy.no_proxy = "localhost,127.0.0.1,.example.com"
end
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.0.100"
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
config.vm.network "public_network"
config.vm.hostname = 'maria100'
config.hostmanager.aliases = %w(maria100.localdomain maria100.local)
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
config.vm.synced_folder "./data", "/data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = false
#
# # Customize the amount of memory on the VM:
vb.memory = "1024"
end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
config.vm.provision "shell", inline: <<-SHELL
sudo yum -y update
echo "secret" | sudo passwd --stdin root
sudo cp -pr ~vagrant/.ssh /root
sudo chown -R root.root /root/.ssh
sudo yum-config-manager --enable base
echo "[mariadb]" >/tmp/mariadb.repo
echo "name = MariaDB" >>/tmp/mariadb.repo
echo "baseurl = http://yum.mariadb.org/10.0/centos7-amd64" >> /tmp/mariadb.repo
echo "gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB" >> /tmp/mariadb.repo
echo "gpgcheck=1" >> /tmp/mariadb.repo
sudo cp /tmp/mariadb.repo /etc/yum.repos.d/
sudo rpm -Uvh http://mirrors.ircam.fr/pub/fedora/epel/7/x86_64/e/epel-release-latest.noarch.rpm
sudo yum -y install python2-pip git python perl-WWW-Mechanize-GZip perl-App-cpanminus perl-List-MoreUtils MariaDB-server MariaDB-Client wget
sudo pip install --upgrade pip
if [ ! -d "/data/MySQLTuner-perl" ]; then
cd /data
sudo git clone https://github.com/major/MySQLTuner-perl.git
fi
sudo cpanm install File::Util
#sudo systemctl start mariadb.service
sudo service mysql start
mysql -e 'select version();'
cd /data
sudo wget "https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2"
sudo tar xvjf employees_db-full-1.0.6.tar.bz2
cd employees_db
cat employees.sql | mysql
cd ..
cd MySQLTuner-perl
perl mysqltuner.pl --idxstat --dbstat
SHELL
config.vm.provision :hostmanager
end

View file

@ -1,107 +1,107 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "fc23-mariadb10-1"
config.vm.box_url = "https://download.fedoraproject.org/pub/fedora/linux/releases/23/Cloud/x86_64/Images/Fedora-Cloud-Base-Vagrant-23-20151030.x86_64.vagrant-virtualbox.box"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
config.vbguest.auto_update = true
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.0.115"
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
config.vm.network "public_network"
config.vm.hostname = 'dev.app'
config.hostmanager.aliases = %w(dev.app.localdomain dev.app.local)
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
config.vm.synced_folder "./data", "/data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = false
#
# # Customize the amount of memory on the VM:
vb.memory = "1024"
end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
config.vm.provision "shell", inline: <<-SHELL
sudo yum -y update
echo "secret" | sudo passwd --stdin root
sudo cp -pr ~vagrant/.ssh /root
sudo chown -R root.root /root/.ssh
sudo yum -y install git python
sudo pip install --upgrade pip
if [ ! -d "/data/MySQLTuner-perl" ]; then
cd /data
sudo git clone https://github.com/major/MySQLTuner-perl.git
fi
echo "# MariaDB 10.1 Fedora repository list - created 2016-01-25 13:11 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.2/fedora23-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1" >> /etc/yum.repos.d/mariadb.repo
sudo yum -y install perl-WWW-Mechanize-GZip perl-App-cpanminus perl-List-MoreUtils
sudo cpanm install File::Util
sudo yum -y install MariaDB-server MariaDB-client wget
sudo systemctl start mariadb.service
mysql -e 'select version();'
cd /data
sudo wget "https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2"
sudo tar xvjf employees_db-full-1.0.6.tar.bz2
cd employees_db
cat employees.sql | mysql
cd ..
cd MySQLTuner-perl
perl mysqltuner.pl --idxstat --dbstat
SHELL
config.vm.provision :hostmanager
end
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "fc23-mariadb10-1"
config.vm.box_url = "https://download.fedoraproject.org/pub/fedora/linux/releases/23/Cloud/x86_64/Images/Fedora-Cloud-Base-Vagrant-23-20151030.x86_64.vagrant-virtualbox.box"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
config.vbguest.auto_update = true
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.0.115"
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
config.vm.network "public_network"
config.vm.hostname = 'dev.app'
config.hostmanager.aliases = %w(dev.app.localdomain dev.app.local)
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
config.vm.synced_folder "./data", "/data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = false
#
# # Customize the amount of memory on the VM:
vb.memory = "1024"
end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
config.vm.provision "shell", inline: <<-SHELL
sudo yum -y update
echo "secret" | sudo passwd --stdin root
sudo cp -pr ~vagrant/.ssh /root
sudo chown -R root.root /root/.ssh
sudo yum -y install git python
sudo pip install --upgrade pip
if [ ! -d "/data/MySQLTuner-perl" ]; then
cd /data
sudo git clone https://github.com/major/MySQLTuner-perl.git
fi
echo "# MariaDB 10.1 Fedora repository list - created 2016-01-25 13:11 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.2/fedora23-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1" >> /etc/yum.repos.d/mariadb.repo
sudo yum -y install perl-WWW-Mechanize-GZip perl-App-cpanminus perl-List-MoreUtils
sudo cpanm install File::Util
sudo yum -y install MariaDB-server MariaDB-client wget
sudo systemctl start mariadb.service
mysql -e 'select version();'
cd /data
sudo wget "https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2"
sudo tar xvjf employees_db-full-1.0.6.tar.bz2
cd employees_db
cat employees.sql | mysql
cd ..
cd MySQLTuner-perl
perl mysqltuner.pl --idxstat --dbstat
SHELL
config.vm.provision :hostmanager
end

View file

@ -1,106 +1,106 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "centos/7"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
config.vbguest.auto_update = true
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.0.115"
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
config.vm.network "public_network"
config.vm.hostname = 'dev.app'
config.hostmanager.aliases = %w(dev.app.localdomain dev.app.local)
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
config.vm.synced_folder "./data", "/data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = false
#
# # Customize the amount of memory on the VM:
vb.memory = "1024"
end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
config.vm.provision "shell", inline: <<-SHELL
sudo yum -y update
echo "secret" | sudo passwd --stdin root
sudo cp -pr ~vagrant/.ssh /root
sudo chown -R root.root /root/.ssh
sudo yum -y install git python
sudo pip install --upgrade pip
if [ ! -d "/data/MySQLTuner-perl" ]; then
cd /data
sudo git clone https://github.com/major/MySQLTuner-perl.git
fi
echo "# MariaDB 10.1 Fedora repository list - created 2016-01-25 13:11 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/fedora23-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1" >> /etc/yum.repos.d/mariadb.repo
sudo yum -y install perl-WWW-Mechanize-GZip perl-App-cpanminus perl-List-MoreUtils
sudo cpanm install File::Util
sudo yum -y install MariaDB-server MariaDB-client wget
sudo systemctl start mariadb.service
mysql -e 'select version();'
cd /data
sudo wget "https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2"
sudo tar xvjf employees_db-full-1.0.6.tar.bz2
cd employees_db
cat employees.sql | mysql
cd ..
cd MySQLTuner-perl
perl mysqltuner.pl --idxstat --dbstat
SHELL
config.vm.provision :hostmanager
end
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "centos/7"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
config.vbguest.auto_update = true
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.0.115"
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
config.vm.network "public_network"
config.vm.hostname = 'dev.app'
config.hostmanager.aliases = %w(dev.app.localdomain dev.app.local)
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
config.vm.synced_folder "./data", "/data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = false
#
# # Customize the amount of memory on the VM:
vb.memory = "1024"
end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
config.vm.provision "shell", inline: <<-SHELL
sudo yum -y update
echo "secret" | sudo passwd --stdin root
sudo cp -pr ~vagrant/.ssh /root
sudo chown -R root.root /root/.ssh
sudo yum -y install git python
sudo pip install --upgrade pip
if [ ! -d "/data/MySQLTuner-perl" ]; then
cd /data
sudo git clone https://github.com/major/MySQLTuner-perl.git
fi
echo "# MariaDB 10.1 Fedora repository list - created 2016-01-25 13:11 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/fedora23-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1" >> /etc/yum.repos.d/mariadb.repo
sudo yum -y install perl-WWW-Mechanize-GZip perl-App-cpanminus perl-List-MoreUtils
sudo cpanm install File::Util
sudo yum -y install MariaDB-server MariaDB-client wget
sudo systemctl start mariadb.service
mysql -e 'select version();'
cd /data
sudo wget "https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2"
sudo tar xvjf employees_db-full-1.0.6.tar.bz2
cd employees_db
cat employees.sql | mysql
cd ..
cd MySQLTuner-perl
perl mysqltuner.pl --idxstat --dbstat
SHELL
config.vm.provision :hostmanager
end

View file

@ -1,79 +1,79 @@
#!/usr/bin/perl
use warnings;
use strict;
use WWW::Mechanize::GZip;
use File::Util;
use Data::Dumper;
use List::MoreUtils qw(uniq);
my $verbose=1;
sub AUTOLOAD {
use vars qw($AUTOLOAD);
my $cmd = $AUTOLOAD;
$cmd=~s/.*:://;
print "\n","*" x 60, "\n* Catching system call : $cmd \n", "*"x60 if defined $verbose;
print "\nExecution : \t", $cmd, " ", join " ", @_ if defined $verbose;
my $outp=`$cmd @_ 2>&1`;
my $rc=$?;
print "\nResult : \t$outp", if defined $verbose;
print "Code : \t", $rc, "\n" if defined $verbose;
return $rc;
}
my $mech = WWW::Mechanize->new();
$mech->agent('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0');
#$mech->proxy( ['http'], 'http://XXX.XXX.XXX.XXX:3128' );
#$mech->proxy( ['https'], 'http://XXX.XXX.XXX.XXX:3128' );
$mech->env_proxy;
$mech->ssl_opts( 'verify_hostname' => 0 );
$mech->requests_redirectable(['GET', 'POST', 'HEAD']);
$mech->add_handler("request_send", sub { print '#'x80,"\nSEND REQUEST:\n"; shift->dump; print '#'x80,"\n";return } ) if defined $verbose;
$mech->add_handler("response_done", sub { print '#'x80,"\nDONE RESPONSE:\n"; shift->dump; print '#'x80,"\n"; return }) if defined $verbose;
$mech->add_handler("response_redirect" => sub { print '#'x80,"\nREDIRECT RESPONSE:\n"; shift->dump; print '#'x80,"\n"; return }) if defined $verbose;
my $url = 'http://cve.mitre.org/data/downloads/allitems.csv';
my $resp;
unless (-f 'cve.csv') {
$resp=$mech->get($url);
$mech->save_content( "cve.csv" );
}
my $f=File::Util->new( readlimit => 152428800);
File::Util->flock_rules( qw/ IGNORE/ );
my @versions;
my $temp;
unlink '../vulnerabilities.csv' if -f '../vulnerabilities.csv';
open(CVE, 'cve.csv') or die("Could not open file.");
foreach my $line (<CVE>) {
if ($line =~ /(mysql|mariadb|percona)/i
and $line =~ /server/i
and $line =~ /CANDIDATE/i
and $line !~ /MaxDB/i
and $line !~ /\*\* REJECT \*\* /i
and $line !~ /\*\* DISPUTED \*\* /i
and $line !~ /(Radius|Proofpoint|Active\ Record|XAMPP|TGS\ Content|e107|post-installation|Apache\ HTTP|Zmanda|pforum|phpMyAdmin|Proxy\ Server|on\ Windows|ADOdb|Mac\ OS|Dreamweaver|InterWorx|libapache2|cisco|ProFTPD)/i) {
$line =~ s/,/;/g;
@versions = $line =~/(\d{1,2}\.\d+\.[\d]+)/g;
foreach my $vers (uniq(@versions)) {
my @nb=split('\.', $vers);
$nb[2]-- if ($line =~ /before/i);
#print $vers."\n".Dumper @nb;
#print "$line";
#exit 0 if ($line =~/before/i) ;
$f->write_file('file' => '../vulnerabilities.csv', 'content' => "$nb[0].$nb[1].$nb[2];$nb[0];$nb[1];$nb[2];$line", 'mode' => 'append');
}
}
}
close(CVE);
#unlink ('cve.csv') if (-f 'cve.csv');
exit(0);
#!/usr/bin/perl
use warnings;
use strict;
use WWW::Mechanize::GZip;
use File::Util;
use Data::Dumper;
use List::MoreUtils qw(uniq);
my $verbose=1;
sub AUTOLOAD {
use vars qw($AUTOLOAD);
my $cmd = $AUTOLOAD;
$cmd=~s/.*:://;
print "\n","*" x 60, "\n* Catching system call : $cmd \n", "*"x60 if defined $verbose;
print "\nExecution : \t", $cmd, " ", join " ", @_ if defined $verbose;
my $outp=`$cmd @_ 2>&1`;
my $rc=$?;
print "\nResult : \t$outp", if defined $verbose;
print "Code : \t", $rc, "\n" if defined $verbose;
return $rc;
}
my $mech = WWW::Mechanize->new();
$mech->agent('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0');
#$mech->proxy( ['http'], 'http://XXX.XXX.XXX.XXX:3128' );
#$mech->proxy( ['https'], 'http://XXX.XXX.XXX.XXX:3128' );
$mech->env_proxy;
$mech->ssl_opts( 'verify_hostname' => 0 );
$mech->requests_redirectable(['GET', 'POST', 'HEAD']);
$mech->add_handler("request_send", sub { print '#'x80,"\nSEND REQUEST:\n"; shift->dump; print '#'x80,"\n";return } ) if defined $verbose;
$mech->add_handler("response_done", sub { print '#'x80,"\nDONE RESPONSE:\n"; shift->dump; print '#'x80,"\n"; return }) if defined $verbose;
$mech->add_handler("response_redirect" => sub { print '#'x80,"\nREDIRECT RESPONSE:\n"; shift->dump; print '#'x80,"\n"; return }) if defined $verbose;
my $url = 'http://cve.mitre.org/data/downloads/allitems.csv';
my $resp;
unless (-f 'cve.csv') {
$resp=$mech->get($url);
$mech->save_content( "cve.csv" );
}
my $f=File::Util->new( readlimit => 152428800);
File::Util->flock_rules( qw/ IGNORE/ );
my @versions;
my $temp;
unlink '../vulnerabilities.csv' if -f '../vulnerabilities.csv';
open(CVE, 'cve.csv') or die("Could not open file.");
foreach my $line (<CVE>) {
if ($line =~ /(mysql|mariadb|percona)/i
and $line =~ /server/i
and $line =~ /CANDIDATE/i
and $line !~ /MaxDB/i
and $line !~ /\*\* REJECT \*\* /i
and $line !~ /\*\* DISPUTED \*\* /i
and $line !~ /(Radius|Proofpoint|Active\ Record|XAMPP|TGS\ Content|e107|post-installation|Apache\ HTTP|Zmanda|pforum|phpMyAdmin|Proxy\ Server|on\ Windows|ADOdb|Mac\ OS|Dreamweaver|InterWorx|libapache2|cisco|ProFTPD)/i) {
$line =~ s/,/;/g;
@versions = $line =~/(\d{1,2}\.\d+\.[\d]+)/g;
foreach my $vers (uniq(@versions)) {
my @nb=split('\.', $vers);
$nb[2]-- if ($line =~ /before/i);
#print $vers."\n".Dumper @nb;
#print "$line";
#exit 0 if ($line =~/before/i) ;
$f->write_file('file' => '../vulnerabilities.csv', 'content' => "$nb[0].$nb[1].$nb[2];$nb[0];$nb[1];$nb[2];$line", 'mode' => 'append');
}
}
}
close(CVE);
#unlink ('cve.csv') if (-f 'cve.csv');
exit(0);

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff