csdn泄漏密码分析
csdn密码泄漏,640万用户数据泄漏,对于在小公司的我,从没见过这么大数据量,于是非
常兴奋,迫不及待的想去操作一下如此大的表。
使用mysql,首先建表。
create database csdn;
create table csdn(
id int not null auto_increment,
username varchar(100),
passwd varchar(100),
email varchar(100),
primary key (id)
)
接着导入表,由于泄漏的文件不是标准sql,只有三列,使用#隔开,因此使用load data infile方式。
load data local infile '/home/kaka/csdn.sql' into table csdn fields terminated by '#' (username,passwd,email);
导入成功,共有6428632条记录。
这么多条记录,访问起来十分慢,首先建几条索引(index)
create index passwd_index on csdn(passwd) using btree;
时间是
引用
Query OK, 6428632 rows affected (3 min 46.82 sec)
再对邮箱建一个索引:
create index email_index on csdn(email) using btree;
用的时间更长,
引用
Query OK, 6428632 rows affected (6 min 51.11 sec)
Records: 6428632 Duplicates: 0 Warnings: 0
不过和后面的查询减少的时间比起来,这个6分钟也是很值得了。
下面来进行一些有趣的分析:
1、常用密码排名(前20名)
引用
| passwd | count(passwd) |
+--------------+---------------+
| 123456789 | 235029 |
| 12345678 | 212766 |
| 11111111 | 76348 |
| dearbook | 46052 |
| 00000000 | 34953 |
| 123123123 | 20010 |
| 1234567890 | 17794 |
| 88888888 | 15033 |
| 111111111 | 6995 |
| 147258369 | 5966 |
| aaaaaaaa | 5890 |
| 987654321 | 5555 |
| 1111111111 | 5145 |
| 66666666 | 5026 |
| a123456789 | 4686 |
| 11223344 | 4096 |
| 1qaz2wsx | 3969 |
| password | 3654 |
| xiazhili | 3649 |
| 789456123 | 3611 |
12345678和12345678分别突破20万,整天叫嚷这数据安全的程序员们,轮到自己的时候,密码就这么简单啊~
排名第