中间人攻击.

一重装,写自动化脚本

1.#vim expectd :

#!/usr/bin/expect 

spawn mysqladmin -uroot -p password "onno799967"
expect "Enter password:"
send "\r"

interact

#chmod a+x expectd

2.vim lamp.sh:

#!/usr/bin/env bash
yum -y install httpd mariadb-server mariadb php php-mysql php-gd gd
yum -y install expect
if [ $? == 0 ];  then


        echo "$date1-----yum install packages IS OK." >> /opt/lamp.log




else
        echo "$date1-----yum install packages IS NOT OK." >> /opt/lamp.log
fi


date2=`date`


systemctl start httpd mariadb
systemctl enable httpd mariadb
if [ $? == 0 ];  then
        echo "$date2-----启动服务成功." >> /opt/lamp.log
else
        echo "$date2-----启动服务失败" >> /opt/lamp.log
fi
echo "" > /var/www/html/index.php
expect /root/expectd
cat <<-EOF >/var/www/html/index.php
\$link=mysql_connect("localhost","root","onno799967"); 
if(!link)
        echo "this connect is false";
else
        echo "this connect is true";
?>
EOF

systemctl restart httpd mariadb

wget -O  /root/wordpress-4.9.4-zh_CN.tar.gz  https://cn.wordpress.org/wordpress-4.9.4-zh_CN.tar.gz

tar xf /root/wordpress-4.9.4-zh_CN.tar.gz -C /root/

mv /root/wordpress/wp-config-sample.php /root/wordpress/wp-config.php
mysql -uroot  -p"onno799967" -e "create database wordpress;"
sed -i s/username_here/root/g /root/wordpress/wp-config.php
sed -i s/database_name_here/wordpress/g /root/wordpress/wp-config.php
sed -i s/password_here/onno799967/g /root/wordpress/wp-config.php
rm -rf /var/www/html/*
cp -rf /root/wordpress/* /var/www/html/
systemctl restart httpd mariadb

http://netsecurity.51cto.com/art/201303/386031.htm


你可能感兴趣的:(中间人攻击.)