Coder Social home page Coder Social logo

bitburrow's People

Contributors

bitinerant avatar goldseven avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bitburrow's Issues

Fix remaining line length issues in main.py

The remaining line length PEP8 issues in main.py are within a complex shell script. This is the last remaining style issue that I'm not comfortable fixing as @bitinerant knows more about how this should work.

Once that is fixed, I think we're ready to start using black to automatically format all of the projects code and then it's mechanical how things should look and everything will pass style checks all the time.

Fix three remaining style issues in main.py

I was able to fix all but the following three style issues:

./main.py:893:5: E722 do not use bare 'except'
./main.py:900:5: E722 do not use bare 'except'
./main.py:928:5: E722 do not use bare 'except'

The proper thing to do in these situations is to catch an exact (or several distinct) exceptions you are expecting to handle.

For example to catch two types of exceptions:

except (IDontLikeYouException, YouAreBeingMeanException) as e:
    pass

This is important as bare excepts swallow up unexpected exceptions and make debugging bugs harder.

When this is done I can complete #36

Implement logging

Add logging capabilities to assist in local debugging, remote (end-user) debugging, and especially when implementing new hardware or VPN providers. Be sure passwords do not go into logs. See also podcast on Eliot, especially question near the end, "How does Eliot compare ...".

Remove dependency on NetworkManager/DBus

@bitinerant As mentioned in #5, if we can remove our dependency on NetworkManager/DBus we can make this project much more portable.

I'd recommend that all of dependencies by installable by PyPI and ideally have support for Windows and macOS as that will be what a majority of potential users will have. It looks like all of our current dependencies satisfy this except for NetworkManager / DBus.

One possibility is pywifi.

Test VPN set-up after configuration

#### 7. test
* Wait for the router to reboot.
* Reconnect the WiFi to the VPN router. The password should be saved in Network Manager. (It is also in ``~/.cleargopher/cleapher.conf``.)
* From the client computer, test a few websites and download a large file (30 seconds or more).
* Test that your IP is from PIA (e.g. banner at top of PIA home page should say, "You are protected by PIA")
* Test that DNS is not leaking (none of the DNS addresses displayed should be in same country as the router) at <https://ipleak.net/> (an additional DNS leak test is at <https://dnsleaktest.com/>).
* Test that IPv6 is blocked:  <http://ipv6-test.com/>.
* Test that  DNS and traffic are completely blocked when OpenVPN dies or the connection is lost; this will also test that OpenVPN automatically restarts:
	* Preparation--on router:  ``opkg update && opkg install tcpdump``
	* Terminal window 1--on router:  ``tcpdump -n -i eth0 '(not port 1198) and (tcp or udp)'``
	* Terminal window 2--on router:  ``for i in `seq 10000`; do ping -c 1 -q a$i.example.com; done |grep ^PING``
	* Terminal window 3--on client computer:  ``for i in `seq 10000`; do ping -c 1 -q b$i.example.com; done |grep ^PING``
	* Terminal window 4--on router:  ``ps |grep '[o]penvpn'; sleep 1; killall openvpn; sleep 1; ps |grep '[o]penvpn'; sleep 10; ps |grep '[o]penvpn'``
	* After running the above command, watch the tcpdump window. After a couple of seconds, you should see some queries for privateinternetaccess.com but **not any other queries**. If you don't see any tcpdump activity, wait a few mintues for the DNS cache to time out. The above command should list exactly 2 lines--the old and the new OpenVPN instances.
# Test that your IP is from PIA via:
# wget -q -O- 'https://www.privateinternetaccess.com/' |grep 'You are protected by PIA'

Enable PEP8 Travis build

Currently it's allowed to fail until #35, #32, and a few more minor fixes are applied.
We can then moving forward have a way to always keep things passing PEP8 properly.

Investigate network automation tools and libraries

Trigger

"a robust network automation toolkit written in Python that was designed for interfacing with network devices"

NetJSONConf

"a python library that converts NetJSON DeviceConfiguration objects into real router configurations that can be installed on systems like OpenWRT, LEDE or OpenWisp Firmware"

  • may be useful in some contexts - can convert a 'configuration dictionary' to and from the format used natively by a router
  • see basic concepts

NAPALM

"Network Automation and Programmability Abstraction Layer with Multivendor support"

Add OS-specific instructions

Currently the instructions assume a Linux or Mac host:

Telnet to the router: telnet 192.168.8.1

I think it would be helpful to tell the user to "Open a Terminal" and input those commands.

We could also expand the the instructions for Windows 10 users by having them install the Windows Subsystem for Linux. It's as simple as installing it from the Windows Store now.

Edit: Though if the purpose is just to document the steps to later automate, this might not be necessary.

Model command argument as an enum

    parser.add_argument(
        "command",
        choices=("set-up", "update", "shell", "internal-tests"),
        metavar="command",
        help=_("task to perform: set-up, update, or shell"),
    )

This would better be expressed using an Enum, which is type safe and supports better type hinting and auto-completion than bare string names.

Support localization/translation

Currently there is a comment at the top of main.py that " " should be localized and ' ' should not be. A true solution to this would be to support full localization. One such package that does this well in Django: https://docs.djangoproject.com/en/stable/topics/i18n/translation/

We hopefully wouldn't need everything Django provides (web server, etc) and could just pull out the translation portions.

Translation would then look something like:

from django.utils.translation import gettext as _

def my_view(request):
    output = _("Welcome to my site.")

Use more flexible group version system

Gracefully handle missing WiFi network

main.py shell
...
Unable to find WiFi network for a supported router

When running on a VM that is NAT'd behind a host that is already connected to the router's WIFI, it would be nice if this step could be skipped automatically (perhaps with a warning logged to the terminal).

In this case, my VM can ping the router (through the NAT) so the remaining steps should work.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.