ergodic_db_tb.py,,[Python]代码#!
ergodic_db_tb.py,,[Python]代码#!
[Python]代码
#!/usr/bin/pythonimport MySQLdbimport getoptimport sysfrom datetime import datetimeconf_host = '127.0.0.1'conf_port = 3306conf_user = 'root'conf_pass = ''conf_db = 'information_schema'conf_bind_db = 'mydns'def main(): db_bind = MySQLdb.connect(host = conf_host, port = conf_port, user = conf_user, passwd = conf_pass, db = conf_bind_db) cursor_bind = db_bind.cursor() db = MySQLdb.connect(host = conf_host, port = conf_port, user = conf_user, passwd = conf_pass, db = conf_db) cursor = db.cursor() file = open("output.txt","w") cursor.execute("select table_name from tables where table_name regexp'rg_' and table_schema ='" + conf_bind_db + "';") for row in cursor.fetchall(): print row[0] sql = "select zone,host,type,data,ttl from " + row[0] + " where zone regexp'(cnc|ct|edu|ov).centos.com' and data='originboss.centos.com.' and type='cname';" cursor_bind.execute(sql) result = cursor_bind.fetchall() for row in result: print row[0],row[1],row[2],row[3],row[4] cursor.close() db.close() cursor_bind.close() db_bind.close()if __name__ == '__main__': main()
相关内容
- 单链表和二叉树的操作,单链表二叉树操作,#author:
- 批量下载51voa的文本和MP3,51voa文本mp3,[Python]代码My
- 加速器后台程序,,[Python]代码#!
- 快速多线程ping,多线程ping,[Python]代码#!
- 在VIM中使用GOOGLE进行搜索或者翻译,vimgoogle,[Python]代码
- secure crt 脚本,securecrt,[Python]代码#$
- hashlib穷举字典破解md5,sha1,hashlibsha1,初步完工,在U
- python求素数的一句话代码 lambda实现,pythonlambda,#在交互
- 用python计算(1+2+3+4……+100),python,[Python]代码n=
- python修改操作系统时间的代码,python操作系统,#-*- cod
评论关闭