(text:str)
| 76 | |
| 77 | |
| 78 | def select_weak_password(text:str) -> str: |
| 79 | weak_password_list = re.findall( |
| 80 | r'\[\+\]\s*((ftp|Mysql|Mssql|SMB|RDP|Postgres|SSH|Oracle|SMB2-shares|redis|Mongodb|Memcached)(:|\s).+)\n', text, re.I |
| 81 | ) |
| 82 | if weak_password_list == []: |
| 83 | return '弱口令检查结果为空' |
| 84 | |
| 85 | weak_password_list = sorted([line[0] for line in weak_password_list]) |
| 86 | |
| 87 | weak_password, server = '','' |
| 88 | for line in weak_password_list: |
| 89 | if server == line.split(':',1)[0]: |
| 90 | weak_password += '[+] {}\n'.format(line) |
| 91 | else: |
| 92 | weak_password += '\n[+] {}\n'.format(line) |
| 93 | server = line.split(':',1)[0] |
| 94 | |
| 95 | return weak_password |
| 96 | |
| 97 | |
| 98 | def select_os_info(text:str) -> str: |
no outgoing calls
no test coverage detected