在内网渗透中找到数据库密码,我们这时候需要找大量的数据来提高效率。这时候我么可以针对不同的数据库来进行检索。
SqlServer
CREATE TABLE #temp_41c0549e42919922 (TableName VARCHAR (255),RowsCount INT) DECLARE @dbname NVARCHAR(500) DECLARE @SQL NVARCHAR(4000) DECLARE MyCursor CURSOR FOR (SELECT Name FROM master..SysDatabases where name not in ('master', 'model', 'msdb', 'tempdb') and status not in (66048,66056)) OPEN MyCursor; FETCH NEXT FROM MyCursor INTO @dbname; WHILE @@FETCH_STATUS = 0 Begin SET @SQL = 'insert into #temp_41c0549e42919922 SELECT '''+@dbname+'..''+a.name, b.rows FROM '+@dbname+'..sysobjects AS a INNER JOIN '+@dbname+'..sysindexes AS b ON a.id = b.id WHERE (a.type = ''u'') AND (b.indid IN (0, 1)) ORDER BY b.rows DESC' exec(@SQL); FETCH NEXT FROM MyCursor INTO @dbname; End CLOSE MyCursor; DEALLOCATE MyCursor; SELECT TableName,RowsCount FROM #temp_41c0549e42919922 WHERE RowsCount>0 ORDER BY RowsCount desc DROP TABLE #temp_41c0549e42919922
oracle
SELECT '/*'||OWNER||'.'||TABLE_NAME||'*/ SELECT ROWNUM,'||OWNER||'.'||TABLE_NAME||'.*'||' from
'||OWNER||'.'||TABLE_NAME||' where ROWNUM<100;',NUM_ROWS FROM SYS.ALL_TABLES
where OWNER not in ('SYS','SYSMAN') and NUM_ROWS>0 ORDER BY NUM_ROWS desc;
mysql
select table_schema,table_name,table_rows,table_comment from information_schema.tables WHERE table_schema not in ('performance_schema', 'mysql', 'sys', 'information_schema') order by table_rows desc;