Posts

使用Python批量检测URL状态码

想要找到3位长度的github ID,可以对用户页URL进行探测,找到所有不可用的就有可能没有注册。

使用python很简单能实现以上需求。

首先安装pip requests

import requests
for x1 in range(97,123):   
    for x2 in range(97,123):
        for x3 in range(97,123):
            url='https://github.com/'+chr(x1)+chr(x2)+chr(x3)
            r=requests.get(url)
            print(url,r.status_code)

其中range(97,123)就是遍历a-z

运行结果如下:

root@bwg:~# python3 ./gid.py
https://github.com/aaa status 200
https://github.com/aab status 200
https://github.com/aac status 200
https://github.com/aad status 200
https://github.com/aae status 200
https://github.com/aaf status 200
https://github.com/aag status 200
https://github.com/aah status 200
... ...
logo