码迷,mamicode.com
首页 > 其他好文 > 详细

批量升级 CentOS bash

时间:2014-10-14 22:58:59      阅读:361      评论:0      收藏:0      [点我收藏+]

标签:http   os   for   sp   div   on   ef   line   bs   

#! /usr/bin/env python
#coding=utf-8
 
from fabric.api import *
from fabric.state import *
 
env.roledefs = {
    ‘scan_proc_server‘: [
                         ‘172.16.1.15‘,
                         ‘172.16.1.12‘,
                         ‘172.16.1.18‘,
                         ‘172.16.1.19‘,
                         ‘172.16.1.10‘,
                         ‘172.16.1.11‘,
                         ‘172.16.1.12‘,
                         ‘172.16.1.13‘,
                         ‘172.16.1.14‘,
                         ‘172.16.1.15‘,
                         ‘172.16.1.16‘,
                         ‘172.16.1.17‘,
                         ‘172.16.1.18‘,
                         ‘172.16.1.19‘,
                        # ‘172.16.1.14‘,
                         ‘172.16.1.101‘,
                         ‘172.16.1.102‘,
                         ‘172.16.1.103‘,
    ],
    ‘storage_server‘:[
        ‘172.16.1.100‘
        ],
    ‘auto_server‘:[
        ],
}
 
env.user=‘root‘
env.password = ‘******‘
 
 
@roles(‘scan_proc_server‘)
def task_scan_source():
    run(‘mkdir /dev/shm/chan/‘)
    put(‘./chan/‘, ‘/dev/shm/‘)
    with cd(‘/dev/shm/chan/‘):
        run(‘python2.6 change_netmask.py‘)
 
@roles(‘scan_proc_server‘)
def update_bash():
    run(‘rpm -ivh http://172.16.1.250:60001/packages/bash-4.1.2-15.el6_5.2.x86_64.rpm --force‘)
    run("env x=‘() { :;}; echo vulnerable‘ bash -c \"echo this is a test\"")
 
 
def dotask():
    execute(update_bash)
 
if __name__ == ‘__main__‘
    dotask()

批量升级 CentOS bash

标签:http   os   for   sp   div   on   ef   line   bs   

原文地址:http://www.cnblogs.com/L-H-R-X-hehe/p/4025273.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!