I am trying to make a simple anti phishing script in python. I need help figuring how to look at a simple html source statement such as this (below)and then have the program spit back "bad news" or so forth.
<a href="http://bogus.com" >https://mybank.com</a>
Expand|Select|Wrap|Line Numbers
- #! /usr/bin/python
- # scan.py
- import sys,string,re
- f = open(sys.argv[1])
- lines = f.readlines()
- string = string.join(lines,"")
- # I or IGNORECASE for case insensitive, S or DOTALL for . matches \n
- phmatch = re.search(r'(secure).*?(phishing)',string,re.IGNORECASE | re.DOTALL)
- if phmatch:
- print "Looks like a phishing scam."
- print "Redirection from %s to %s." % (phmatch.group(1),phmatch.group(2))
- else:
- print "Looks Ok."