Closed new-gen23 closed 5 years ago
There’s nothing in the codebase which should cause that to happen.
What is making you think it’s starting a web server?
On Sep 25, 2019, at 6:24 AM, new-gen23 notifications@github.com wrote:
when I run "from gophish import Gophish" in python, it starts a webserver on 127.0.0.1:8000 instead of running through the rest of the code.
using: Python 2.7.16 gophish 0.3.0 installed via pip.
Any ideas?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
That's very unexpected behavior. Here's the expected behavior I see:
jordan@mac:~/$ docker run -ti --rm python:3-slim /bin/sh
# pip install gophish
Collecting gophish
Downloading https://files.pythonhosted.org/packages/23/f2/26641037d5260591dfae422a4524da61bdc4937837475ec3915aff01f590/gophish-0.3.0-py3-none-any.whl
Collecting appdirs==1.4.0 (from gophish)
Downloading https://files.pythonhosted.org/packages/7b/8b/eebc6e2002a1e0383f1c7108d0111d4d33ea93bf417d7e19e43ec9b87b2b/appdirs-1.4.0-py2.py3-none-any.whl
Collecting six==1.10.0 (from gophish)
Downloading https://files.pythonhosted.org/packages/c8/0a/b6723e1bc4c516cb687841499455a8505b44607ab535be01091c0f24f079/six-1.10.0-py2.py3-none-any.whl
Collecting pyparsing==2.1.10 (from gophish)
Downloading https://files.pythonhosted.org/packages/2b/f7/e5a178fc3ea4118a0edce2a8d51fc14e680c745cf4162e4285b437c43c94/pyparsing-2.1.10-py2.py3-none-any.whl (56kB)
|████████████████████████████████| 61kB 2.1MB/s
Collecting packaging==16.8 (from gophish)
Downloading https://files.pythonhosted.org/packages/87/1b/c39b7c65b5612812b83d6cab7ef2885eac9f6beb0b7b8a7071a186aea3b1/packaging-16.8-py2.py3-none-any.whl
Collecting python-dateutil==2.6.0 (from gophish)
Downloading https://files.pythonhosted.org/packages/40/8b/275015d7a9ec293cf1bbf55433258fbc9d0711890a7f6dc538bac7b86bce/python_dateutil-2.6.0-py2.py3-none-any.whl (194kB)
|████████████████████████████████| 194kB 3.7MB/s
Collecting requests>=2.20.0 (from gophish)
Downloading https://files.pythonhosted.org/packages/51/bd/23c926cd341ea6b7dd0b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/requests-2.22.0-py2.py3-none-any.whl (57kB)
|████████████████████████████████| 61kB 8.4MB/s
Collecting certifi>=2017.4.17 (from requests>=2.20.0->gophish)
Downloading https://files.pythonhosted.org/packages/18/b0/8146a4f8dd402f60744fa380bc73ca47303cccf8b9190fd16a827281eac2/certifi-2019.9.11-py2.py3-none-any.whl (154kB)
|████████████████████████████████| 163kB 18.3MB/s
Collecting chardet<3.1.0,>=3.0.2 (from requests>=2.20.0->gophish)
Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB)
|████████████████████████████████| 143kB 13.5MB/s
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 (from requests>=2.20.0->gophish)
Downloading https://files.pythonhosted.org/packages/e0/da/55f51ea951e1b7c63a579c09dd7db825bb730ec1fe9c0180fc77bfb31448/urllib3-1.25.6-py2.py3-none-any.whl (125kB)
|████████████████████████████████| 133kB 12.1MB/s
Collecting idna<2.9,>=2.5 (from requests>=2.20.0->gophish)
Downloading https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl (58kB)
|████████████████████████████████| 61kB 10.0MB/s
Installing collected packages: appdirs, six, pyparsing, packaging, python-dateutil, certifi, chardet, urllib3, idna, requests, gophish
Successfully installed appdirs-1.4.0 certifi-2019.9.11 chardet-3.0.4 gophish-0.3.0 idna-2.8 packaging-16.8 pyparsing-2.1.10 python-dateutil-2.6.0 requests-2.22.0 six-1.10.0 urllib3-1.25.6
# python
Python 3.7.4 (default, Sep 12 2019, 15:51:10)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from gophish import Gophish
>>>
>>>
>>> dir(Gophish)
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__']
I'm admittedly not sure what is causing the behavior you're seeing. Would you mind zipping up the Gophish package you have installed (should be your site-packages/
folder) and attaching it to this issue so I can investigate?
Update: I just tested the line with python3.7.4 . It works as you describe. My fault. Seems to be a bug with Python 2.7. However, when I include it into a script, it throws the following error, which point again to the first line:
Script:
from gophish import Gophish
api_key = 'apikey'
api = Gophish(api_key, host='https://127.0.0.1:3333', verify=False)
# get all campaign ids
print ("#### Campaigns:")
for campaign in api.campaigns.get():
print (campaign.name + " : " + str(campaign.id))
I tested it with Python 2.7 as well and didn’t encounter that issue. If you could please send in a zip of the Gophish package you installed, I’d appreciate it. My goal is to make sure this is just some kind of mixup. If you managed to download a Gophish package that has unintended behavior, it’s very important for me to track down how that happened.
And for this latest error, you might try deleting all *.pyc files in that folder.
That did it. Thank you very much!
Could you please do me a favor and still upload a copy of the Gophish package you have installed? There's 0 reason it should start up a webserver, and I want to make sure this was some kind of mixup, not something I need to look into further.
when I run "from gophish import Gophish" in python, it starts a webserver on 127.0.0.1:8000 instead of running through the rest of the code.
using: Python 2.7.16 gophish 0.3.0 installed via pip.
Any ideas?