i have search specific url, through large number of ips. i've written script in python checks if port open, , checks if url exist using httplib, , it's working great! problem i've been getting many false-positives, because net devices, give status 200 when ask page, , returns page 400 error on body
here code:
def mypage(self,ip): try: conn = httplib.httpconnection(ip) conn.request("head", "/path/to/mypage.php") resp = conn.getresponse() if (resp.status == 200): return true else : return false except : return false
i solved problem checking title tag on body of page
def mypage(self,ip): try: conn = httplib.httpconnection(ip) conn.request("get", "/path/to/mypage.php") resp = conn.getresponse() if (resp.status == 200): html = beautifulsoup(resp.read()) data = html.find('title') titulo = str(data.contents[0]) if titulo == "the title": return true else: return false else : return false except : return false
Comments
Post a Comment