Regular Expression Syntax > Error

testing935
6 years ago | edited 6 years ago

0

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 :)

0replies
1voice
212views
Discussion thread has been locked. You can no longer add new posts.
1 of 1

This site only uses cookies that are essential for the functionality of this website. Cookies are not used for tracking or marketing purposes.

By using our site, you acknowledge that you have read and understand our Privacy Policy, and Terms of Service.

Dismiss