Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure paw-gps works when default values are used. #1054

Merged
merged 2 commits into from
Aug 2, 2022

Conversation

justin-p
Copy link
Contributor

Ensures sane defaults are used for paw-gps plugin.
Implements additional check for the value of self.options['ip'] to avoid empty strings breaking the plugin.
Implements error handling for more detailed error logs.

Description

The default.toml file contains the following default value for the IP of paw-gps plugin main.plugins.paw-gps.ip = "".

The current plugin uses the following logic to determine what value it should use by default. This logic does not handle the default empty string, meaning IP is never set to the intended default value.

def on_loaded(self):
        logging.info("PAW-GPS loaded")
        if 'ip' not in self.options or ('ip' in self.options and self.options['ip'] is None):
            logging.info("PAW-GPS: No IP Address in the config file is defined, it uses the default (192.168.44.1:8080)")

    def on_handshake(self, agent, filename, access_point, client_station):
        if 'ip' not in self.options or ('ip' in self.options and self.options['ip'] is None):
            ip = "192.168.44.1:8080"
        else:
            ip = self.options['ip']

Additionally no error logs are created when the plugin is unable to reach the paw server.

Motivation and Context

Plugin should 'just' work using default settings after enabling and not require troubleshooting/inspecting logs.
When the plugin is incorrectly configured/is unable to perform its action it should log detailed (enough) errors to figure out what went wrong in a eye glans.

  • I have raised an issue to propose this change (required)

#1053

How Has This Been Tested?

Trying to get the plugin to work while setting up a fresh pwnagotchi. Updated the plugin and pip installed the updated version. Ran pwnagotchi and verified the plugin now works as intended with the default values from default.toml.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I've read the CONTRIBUTION guide
  • I have signed-off my commits with git commit -s

@evilsocket evilsocket merged commit a5890d9 into evilsocket:master Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants