def get_mysql_pass(t_dbid): global username, password, port, ip_addr, host_id, g_h_username, g_h_passwd mysqlcur.execute("set names utf8") t_sql = "SELECT a.slow_log_user,a.slow_log_pass,a.port,b.ip_addr,a.host_id,b.user_account_1,b.user_passwd_1 FROM b_db_config a,b_host_config b WHERE a.host_id=b.host_id and a.db_id=%s limit 1 " mysqlcur.execute(t_sql, (t_dbid, )) data = mysqlcur.fetchone() username = data[0] password = data[1] port = data[2] ip_addr = data[3] host_id = data[4] g_h_username = data[5] g_h_passwd = aes.jiemi(data[6]) print 'IP: ' + ip_addr
def get_mysql_pass(t_dbid): global username,password,port,ip_addr,host_id,g_h_username,g_h_passwd mysqlcur.execute("set names utf8") t_sql="SELECT a.slow_log_user,a.slow_log_pass,a.port,b.ip_addr,a.host_id,b.user_account_1,b.user_passwd_1 FROM b_db_config a,b_host_config b WHERE a.host_id=b.host_id and a.db_id=%s limit 1 " mysqlcur.execute(t_sql,(t_dbid,)) data = mysqlcur.fetchone() username=data[0] password=data[1] port=data[2] ip_addr=data[3] host_id=data[4] g_h_username=data[5] g_h_passwd=aes.jiemi(data[6]) print 'IP: '+ip_addr
def get_server_pass(t_ip_addr): global ip_addr global username global password global hostname,host_id,rootaccount,rootpasswd ip_addr=t_ip_addr mysqlcur.execute("set names utf8") t_sql="select user_account,user_passwd,host_name,host_id,root_account,IFNULL(root_passwd,'GFyBYZKLwVrhDj0Sh5x9uu==') root_passwd from b_host_config where ip_addr=%s limit 1" mysqlcur.execute(t_sql,(ip_addr,)) data = mysqlcur.fetchone() #hostname 一定要设对,不然后续获得文件名会出错 username,password,hostname,host_id,rootaccount,rootpasswd=data print rootpasswd rootpasswd=aes.jiemi(rootpasswd)
# -*- coding: utf-8 -*- from __future__ import division import MySQLdb import sys import subprocess import time import subprocess import os import datetime import random from fabric.api import env, run, put, get, local import getopt import aes rootpasswd = 'GFyBYZKLwVrhDj0Sh5x9hA==' print rootpasswd rootpasswd2 = aes.jiemi(rootpasswd) print rootpasswd2 print "test"
# -*- coding: utf-8 -*- from __future__ import division import MySQLdb import sys import subprocess import time import subprocess import os import datetime import random from fabric.api import env,run,put,get,local import getopt import aes rootpasswd='GFyBYZKLwVrhDj0Sh5x9hA==' print rootpasswd rootpasswd2=aes.jiemi(rootpasswd) print rootpasswd2 print "test"