In python2.7
I’m programming a function that parses a site source code and it should return only the links.
Here is my code:
def LfiOneAttack(site):
os.system("clear||cls")
print "[*] Scan Link"
request = requests.get(site)
SourceCode = str(request.text.encode("utf-8"))
FindLinkGroups = re.compile(r"^[(href=\"|src=\")+(?P<lien>^.\w\S.)+\"")
searchResult = re.search(SourceCode, FindLinkGroups)
print searchResult.groups()
and here is the error :
[*] Scan Link
Traceback (most recent call last):
File "requeteGene.py", line 202, in <module>
__main__()
File "requeteGene.py", line 103, in __main__
LFISCAN()
File "requeteGene.py", line 85, in LFISCAN
LfiOne(site)
File "requeteGene.py", line 36, in LfiOne
FindLinkGroups = re.compile(r"^[(href=\"|src=\")+(?P<lien>^.\w\S.)+\"")
File "/usr/lib/python2.7/re.py", line 194, in compile
return _compile(pattern, flags)
File "/usr/lib/python2.7/re.py", line 251, in _compile
raise error, v # invalid expression
sre_constants.error: unexpected end of regular expression
Thank in advance for your answers :)