anouarbensaad / vulnx

vulnx 🕷️ an intelligent Bot, Shell can achieve automatic injection, and help researchers detect security vulnerabilities CMS system. It can perform a quick CMS security detection, information collection (including sub-domain name, ip address, country information, organizational information and time zone, etc.) and vulnerability scanning.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

'NoneType' object

sertif85 opened this issue · comments

Traceback (most recent call last):
File "/usr/share/vulnx/vulnx.py", line 719, in
detect_cms()
File "/usr/share/vulnx/vulnx.py", line 533, in detect_cms
wordpressMain(url,headers)
File "/usr/share/vulnx/vulnx.py", line 259, in wordpressMain
getOS(url, headers)
File "/usr/share/vulnx/vulnx.py", line 609, in getOS
print(' %s %sServer :%s %s' % (good, W, end, find.group(1)))
AttributeError: 'NoneType' object has no attribute 'group'

I caught a problem with the "Server" response header. This header did not exist in my case. Regular expression did not find a match and returned a None object.
This is my patch:
find = regx.search(server_response)
if find is None:
print('"Server" header is not exist')
else:
print(' %s %sServer :%s %s' % (good, W, end, find.group(1)))
print(' %s %sOS :%s %s' % (good, W, end, find.group(2)))

Thank you, i'm working to solve this issues.

    def os_server(self):
        response = requests.get(self.url, headers=self.headers).headers
        try:
            if response["server"]:
                regx = re.compile(r"(.+) \((.+)\)")
                data = regx.search(response["server"])
                print(' {} {}Server :{} {}' .format(good, W, end, data.group(1)))
                print(' {} {}OS :{} {}' .format(good, W, end, data.group(2)))
        except AttributeError as notfound:
            print(' {} Cannot Match the server headers : {}' .format(bad, str(notfound)))