Search code examples
pythonblockurllib

Python - bypass Malwarebytes blocked websites with urllib?


Here's a part my code that gets source code from websites:

#Header dictionary
headers = {}
#Header for websites
headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"

#Urllib code
req = urllib.request.Request(url, headers=headers)
resp = urllib.request.urlopen(req)
respData = resp.read()

This works, however my Malwarebytes blocks some websites even when I use this program. Is there a way I can bypass this block?

I want to get the source code and possibly write it to a txt file, all without Malwarebytes blocking anything but avoiding malicious stuff.


Solution

  • A third party program (Malwarebytes) is controlling network traffic from and to your computer. You are at the mercy of this software.

    Unless this program provides a method to bypass its checks (which I highly doubt) the advice is that

    • Disable Malwarebytes

    • Run your Python script on a different computer

    • Contact Malwarebytes how to adjust their program to allow your script (highly unlikely they have any bypass mechanism or they will do any exception for single individual)

    Also as a further security advise I suggest you run and visit malware sites in a browser run inside a Linux virtual machine.