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

Netmon refactor fix #86

Open
wants to merge 2 commits into
base: sulley_refactor
Choose a base branch
from

Conversation

jtpereyda
Copy link
Contributor

Problem

When running network_monitor.py on Ubuntu, it would crash while trying to create the usage text.

Solution

create_usage was using global variables IFS and device when they weren't yet declared, and using device where it should have been pcapy_device. The first commit was the minimal fix.

The second commit sought to eliminate these global variables and clean up a couple warnings. Change summary:

  • new get_ifs() method makes IFS variable available to main
  • create_usage() now takes IFS as an input
  • IFS renamed to ifs (PEP8)
  • added main() method so that main code executes in a local scope. This addressed shadowing issues with the ifs variable.
  • added required packages as suggested by PyCharm
  • added docstrings

create_usage() is now side-effect free and we're using less global variables!

Tested

on Ubuntu. Verified docstring works and that network_monitor.py starts and accepts connections. I haven't figure out how to get Tornado on Windows yet so I can't test it there.

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.

1 participant