Skip to content

[BUG] NameError: name 'pwnagotchi' is not defined #1096

@scifijunk

Description

@scifijunk

Describe the bug
Well, I was doing a test build to see if any python packages needed to be updated. I Found that Flask==2.0.1 and Werkzeug==2.0.0 needed to installed. After that, though I got a rather odd error that I'm not sure how to fix. The error is as follows:

[2022-05-26 00:27:50,932] [INFO] setting unit hostname 'pwnagotchi' -> 'scifijunkie'
Traceback (most recent call last):
  File "/usr/local/bin/pwnagotchi", line 150, in <module>
    pwnagotchi.set_name(config['main']['name'])
  File "/usr/local/lib/python3.7/dist-packages/pwnagotchi/__init__.py", line 44, in set_name
    pwnagotchi.reboot()
NameError: name 'pwnagotchi' is not defined

To Reproduce
Steps to reproduce the behavior:

  1. burned img
  2. Noted it was taking longer than normal to boot so I SSHed into it
  3. ran sudo systemctl status pwnagotchi.service and got the following back: ```
● pwnagotchi.service - pwnagotchi Deep Reinforcement Learning instrumenting bettercap for WiFI pwning.
   Loaded: loaded (/etc/systemd/system/pwnagotchi.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Wed 2022-05-25 23:56:51 BST; 26s ago
     Docs: https://pwnagotchi.ai
  Process: 744 ExecStart=/usr/bin/pwnagotchi-launcher (code=exited, status=1/FAILURE)
 Main PID: 744 (code=exited, status=1/FAILURE)
  1. I ran sudo systemctl stop pwnagotchi.service to stop the service
  2. ran sudo pwnagotchi and got the following error:
Traceback (most recent call last):
  File "/usr/local/bin/pwnagotchi", line 139, in <module>
    from pwnagotchi.agent import Agent
  File "/usr/local/lib/python3.7/dist-packages/pwnagotchi/agent.py", line 12, in <module>
    from pwnagotchi.ui.web.server import Server
  File "/usr/local/lib/python3.7/dist-packages/pwnagotchi/ui/web/server.py", line 10, in <module>
    from flask import Flask
  File "/usr/local/lib/python3.7/dist-packages/flask/__init__.py", line 21, in <module>
    from .app import Flask, Request, Response
  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 25, in <module>
    from . import cli, json
  File "/usr/local/lib/python3.7/dist-packages/flask/json/__init__.py", line 21, in <module>
    from itsdangerous import json as _json
ImportError: cannot import name 'json' from 'itsdangerous' (/usr/local/lib/python3.7/dist-packages/itsdangerous/__init__.py)
  1. installed Flask=2.0.1
  2. ran sudo pwnagotchi and got the following error:
Traceback (most recent call last):
  File "/usr/local/bin/pwnagotchi", line 139, in <module>
    from pwnagotchi.agent import Agent
  File "/usr/local/lib/python3.7/dist-packages/pwnagotchi/agent.py", line 12, in <module>
    from pwnagotchi.ui.web.server import Server
  File "/usr/local/lib/python3.7/dist-packages/pwnagotchi/ui/web/server.py", line 12, in <module>
    from flask_wtf.csrf import CSRFProtect
  File "/usr/local/lib/python3.7/dist-packages/flask_wtf/__init__.py", line 3, in <module>
    from .csrf import CSRFProtect, CsrfProtect
  File "/usr/local/lib/python3.7/dist-packages/flask_wtf/csrf.py", line 10, in <module>
    from werkzeug.security import safe_str_cmp
ImportError: cannot import name 'safe_str_cmp' from 'werkzeug.security' (/usr/local/lib/python3.7/dist-packages/werkzeug/security.py)
  1. installed Werkzeug==2.0.0
  2. ran sudo pwnagotchi I got the following error:
Traceback (most recent call last):
  File "/usr/local/bin/pwnagotchi", line 139, in <module>
    from pwnagotchi.agent import Agent
  File "/usr/local/lib/python3.7/dist-packages/pwnagotchi/agent.py", line 12, in <module>
    from pwnagotchi.ui.web.server import Server
  File "/usr/local/lib/python3.7/dist-packages/pwnagotchi/ui/web/server.py", line 12, in <module>
    from flask_wtf.csrf import CSRFProtect
  File "/usr/local/lib/python3.7/dist-packages/flask_wtf/__init__.py", line 4, in <module>
    from .form import FlaskForm, Form
  File "/usr/local/lib/python3.7/dist-packages/flask_wtf/form.py", line 4, in <module>
    from jinja2 import Markup
ImportError: cannot import name 'Markup' from 'jinja2' (/usr/local/lib/python3.7/dist-packages/jinja2/__init__.py)
  1. installed jinja2==3.0.3
  2. ran sudo pwnagotchi I got the following error:
[2022-05-26 00:27:50,932] [INFO] setting unit hostname 'pwnagotchi' -> 'scifijunkie'
Traceback (most recent call last):
  File "/usr/local/bin/pwnagotchi", line 150, in <module>
    pwnagotchi.set_name(config['main']['name'])
  File "/usr/local/lib/python3.7/dist-packages/pwnagotchi/__init__.py", line 44, in set_name
    pwnagotchi.reboot()
NameError: name 'pwnagotchi' is not defined
  1. ran sudo pwnagotchi for the final time and it ran like normal

Expected behavior
for it to work.

Screenshots
N/A.

Environment (please complete the following information):

  • Pwnagotchi version: built v1.5.5
  • OS version: 2020-02-13-raspbian-buster-lite
  • Type of hardware: Raspberry Pi4 2G

Additional context
N/A.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions