Giter Site home page Giter Site logo

scottpeterman / uglypty Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 12.38 MB

UglyPTY is much more than a PyQt6 SSH Terminal manager. It includes an extensible plugin tooling system. This includes NetBox integration, Built-in FTP,SFTP and TFTP servers for code upgrades, Data collectors and Automation tools and more.

Python 86.33% HTML 11.70% JavaScript 1.97%
automation pyqt6-gui ssh-client automation-ui ftp-server serial sftp-server snmpv2 snmpv3 tftp-server

uglypty's Introduction

UglyPTY

UglyPTY is an extensible graphical terminal emulator built with Python and PyQt6. It provides a user-friendly interface for managing and establishing SSH connections, with some great productivity of features. This is the base product of many Network Engineering automation tools currently in development. A plugin based system for adding features to the application is included in this release, along with some basic plugin examples. The best network automation tools are in python ... UglyPTY now has many built in tools from Desktop TFTP & SFTP Servers built in for code upgrades, to highly concurrent data collection automation.

UglyPTY Dark

Why?

The whole point of the UglyPTY project is not to solve every problem, but to provide a platform based on the tool network engineers use most - an SSH Terminal. Developers like text editors with add-on capabilites, this is just the equivilent for CLI focused engineers. Nothing in these plugins is supper special, I just wanted to provide enough example plugins that others could create there own tools. Both the usable .whl files, as well as original source code are included in the repo. And hopefully you enjoy using the base SSH application if thats all you need. You don't have to load any plugins to use UglyPTY, but remember, these are all beta tools, be careful ;)

Python needed a native SSH GUI Terminal

This application does NOT wrap a backend web server like Webssh. It DOES use xterm.js for terminal emulation.

Note: This is a VERY beta release with a lot of functionality.
Latest Changes: I am still adding capabilities

  • Expanded FTP/SFTP support. Much better performance across a WAN for those network OS upgrades/backups
  • New SNMP Interface Monitoring, on demand! v2 and v3 support
FTP/SFTP
SNMP Utilization
SNMPv2/3

Features

  • Session Manager Leverage the sessions you use in your Terminal environment in your automation scripts (examples included).
    • Create, edit, or delete sessions with specific settings.
    • Supports password and key based authentication.
    • You can have as many device tree (i.e. session) files to organize as you like. Files are basic YAML.
  • Credentials Manager Safely manage your user credentials.
    • Passwords are encrypted.
    • Fetch all credentials or a specific credential by ID from a SQLite database (settings.sqlite).
  • Builtin TFTP and SFTP servers
    • For device firmware upgrades, config backups etc.
    • When your in the field and you need to upgrade that box now.
  • TCP Port scanner lite
    • For quick tests of ACL's, check for unwanted network device services like telnet or http
  • IP Subnet Calculator
    • For the obvious
  • LDAP Test Tool
    • For authentication tests
    • Includes search
    • Full O,OU tree view (Container objects only), just to help you find your way around the tree
  • Netbox Exporter
    • To quickly populate your sessions.yaml file with data from Netbox
  • Diff Tool
    • To quickly compare configuration or output differences
  • Grep GUI
    • A friendly grep tool for all the data you collect
  • Netmiko Concurrent CLI Collector
    • Quickly issue show commands against 100's of network devices. I've hit over 1000 in less than 10 minutes.
    • The data will be saved in both raw text (see the grep tool), and a structured yaml file with additional device meta data for processing later
    • Great for audits, or just searching for ckt id's
  • YAML Browser
    • All those structured yaml files with collected data? This will search, browse and view them for you
  • Themed Views
    • Multiple theme modes - light, dark, light-dark, and dark-light.
  • Network Maps!
    • Based on CDP, but soon for LLDP as well. Tool crawls the network via cdp and then maps it to a graphml file.
    • Uses N2G (Need to Graph), from the creator of TTP!
    • Filters to support setting bounds on the crawling. (an issue if you have point-to-point WAN ckts)

Built-in Tools

UglyPTY Dark
UglyPTY Light Splash

Installation

  1. Tested with Python 3.9.13 for Windows in venv, and Ubuntu 22.04 with Python 3.10. Other versions might work.

  2. Use PyPi unless you want to contribute.

  3. Use pip with an activated venv:

    pip install uglypty

Linux dependencies

You may also need to install libxcb with the following sudo apt install libxcb-render0 libxcb-shape0 libxcb-xfixes0

To start the application, navigate to the activated virtual directory, local keys, your session database, and log files will be here:

python or pythonw -m uglypty
python -m uglypty  --plugins-enabled

UglyPTY Plugins

Some plugins have been moved to the main application under "Tools". To use a plugin, download its .whl file and save it in a ./wheels directory where your UglyPTY application is installed. You will have to create this folder. Here is a list of just some of the plugins:

1. Ace Code Editor:  uglyplugin_ace-0.1.0-py3-none-any.whl
2. Dynamic Front End for Click based scripts: uglyplugin_click-0.1.0-py3-none-any.whl
7. CMD, Powershell and WSL2 Tabbed terminals: uglyplugin_terminal-0.1.0-py3-none-any.whl

Download More Plugins

You can find more about UglyPTY's wheel based plugins from github. You can download more .whl plugins from wheels.

catalog.yaml Explained

Only 2 example plugins are pre-entered in the pluging catalog. The catalog.yaml file contains metadata for all available plugins. UglyPTY's Plugin Manager reads this file, so if you download additional plugins, you will have to edit this file to get them installed and registered with the application. Each plugin has its entry defined by the following keys:

  • name: The human-readable name of the plugin.
  • package_name: The name used to register the plugin as a Python package. This is the name you would use if you were to install the plugin using pip.
  • description: A brief description of what the plugin does.
  • import_name: The Python import statement that would be used to load the plugin's main class or function.
  • version: The version number of the plugin.
  • source_type: The type of installation source, currently only supports "wheel".
  • wheel_url: The path to the .whl file for the plugin, relative to the ./wheels directory.

Example entry:

- name: "Ugly Ace Editor"
  package_name: "ugly_ace_editor"
  description: "An Ace based editor with some unique features."
  import_name: "uglyplugin_ace.ugly_ace.QtAceWidget"
  version: "0.1.0"
  source_type: "wheel"
  wheel_url: "./wheels/uglyplugin_ace-0.1.0-py3-none-any.whl"

A Note about Xterm.js

  • Xterm.js is a front-end component written in TypeScript that lets applications bring fully-featured terminals to their users in the browser. It's used by popular projects such as VS Code, Hyper and Theia.
  • In PyQt6, xterm.js is implemented in QT's WebEngine, and chromium based widget. There is of course overhead associated with this approach. If you are interested in how something like UglyPTY could be implemented more natively using a graphics approach, take a look at the early development being done on "UglierPTY" here: https://github.com/scottpeterman/UglierPTY

Features

  • Terminal apps just work: Xterm.js works with most terminal apps such as bash, vim, and tmux, including support for curses-based apps and mouse events.
  • Performant: Xterm.js is really fast, it even includes a GPU-accelerated renderer.
  • Rich Unicode support: Supports CJK, emojis, and IMEs.
  • Self-contained: Requires zero dependencies to work.
  • Accessible: Screen reader and minimum contrast ratio support can be turned on.

A special thanks to those whose efforts this tool is built on (shoulders of giants and all that)

  • Qt https://www.qt.io/
  • PyQt6 https://www.riverbankcomputing.com/software/pyqt/ Yes I could have used PySide6, and maybe will add that. I've used PyQt to fix my own problems for years, and I just love it!
  • Netmiko Kirk - you are awesome! (Network Engineers - his classes are awesome as well)
  • Paramiko Most don't know just how much automation has been enabled by this project (Ansible, looking at you over the years)
  • TTP Very few outside the network automation space know of this, but it transformed the ability to automate legacy network equipment, much of which still wont do a simple "show blah | json". I have literally worked with it since ver 0.0.1 - this guy is amazing: https://github.com/dmulyalin/ttp

Screenshots

Here are some snapshots of UglyPTY in action:

UglyPTY Dark
UglyPTY Light Splash
UglyPTY darklight
UglyPTY Lightdark

Here are some snapshots of UglyPTY-Plugins in action:

UglyPTY Console
UglyPTY CLI Collector
UglyPTY parsers
UglyPTY Serial
UglyPTY Map
UglyPTY Sample Map

Certainly! Below is a concise README.md written in Markdown format that you can copy and paste directly into your project's README file. This README includes instructions for creating a desktop shortcut on Linux systems to launch your PyQt6 application.

# UglyPTY Application Launcher

This guide provides instructions on how to create a desktop shortcut for the UglyPTY application on Linux. This method allows you to launch UglyPTY without opening a terminal window.

## Creating a Desktop Shortcut in Linux

Follow these steps to create a desktop shortcut that launches UglyPTY directly from your desktop environment without displaying a terminal.

### Step 1: Create the `.desktop` File

Create a new file named `UglyPTY.desktop` on your Desktop or in `/usr/share/applications` for system-wide use.

```bash
nano ~/Desktop/UglyPTY.desktop

Copy and paste the following contents into the file:

[Desktop Entry]
Type=Application
Terminal=false
Name=UglyPTY
Icon=application-icon-path  # Replace this path with the actual path to your application icon
Exec=sh -c "cd /path/to/app-folder; /path/to/venv/bin/python3 -m uglypty"
Comment=Run UglyPTY without a terminal window
Categories=Utility;

Replace /path/to/app-folder and /path/to/venv/bin/python3 with the actual paths on your system.

Step 2: Make the .desktop File Executable

Change the permissions of the .desktop file to make it executable:

chmod +x ~/Desktop/UglyPTY.desktop

Step 3: Allow Launching

If your desktop environment requires it (common in GNOME), right-click on the desktop icon and select "Allow Launching".

Step 4: Test the Shortcut

Double-click the shortcut icon on your desktop to launch the UglyPTY application. Ensure that the application starts without displaying a terminal window.

Troubleshooting

If the shortcut does not work:

  • Check that the Exec path in your .desktop file is correct.
  • Ensure that all paths in the Exec command accurately reflect the locations on your system.
  • Verify that the file has executable permissions.
  • Consider running the command in a terminal to see if any errors are outputted that need to be addressed.

Updating Paths

Regularly update the paths in the .desktop file and any associated scripts, especially after changes to your environment or system updates that might affect the paths.

Thank you for using UglyPTY!


### Notes

1. Make sure to replace placeholder paths and comments with actual data relevant to your setup.
2. You might need to adjust instructions slightly depending on the desktop environment or any specific configurations unique to your system or user setup.

This README should provide a clear, user-friendly guide for setting up a desktop shortcut for your application on Linux. Feel free to modify it to better fit your project’s context or specific requirements!




## Package Distribution

```python
# Create a source distribution and a wheel
python setup.py sdist bdist_wheel

# Set up a new virtual environment
python -m venv test_env

# Activate the virtual environment
source test_env/bin/activate  # On Linux/Mac
test_env\Scripts\activate     # On Windows

# Install the wheel
pip install dist/uglypty-0.1-py3-none-any.whl

# Test your script
python or pythonw -m uglypty

# Use `twine` to upload your package to PyPI: 
twine upload dist/* 

 

uglypty's People

Stargazers

 avatar  avatar

Watchers

 avatar

uglypty's Issues

Crashing when connecting via SSH

I tried to connect via SSH with no password in the session. Sanitized output with dollar sign vars.

['/opt/uglypty/lib/python3.11/site-packages/uglypty/__main__.py']
qt.qpa.theme.dbus: Session DBus not running.
qt.qpa.theme.dbus: Application will not react to setting changes.
 Check your DBus installation.
Installed plugins from DB: []
open inv file
reading ... ./sessions/sessions.yaml
open inv file

(python3:24572): dconf-WARNING **: 14:17:05.201: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:05.227: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:05.241: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:05.251: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:05.261: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:05.271: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:05.284: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:05.301: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:05.317: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:05.334: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:05.351: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:05.367: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:05.383: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:05.397: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:05.414: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:05.432: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:08.724: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:09.142: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:09.536: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:09.543: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:09.562: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:09.579: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:09.596: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:09.609: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:09.626: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:09.642: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:09.659: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:09.675: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:09.692: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:09.709: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:09.728: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:09.742: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:09.759: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:09.775: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:09.792: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:11.321: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)

(python3:24572): dconf-WARNING **: 14:17:11.322: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)
reading ... 
This is a tuple
{'host': '192.168.13.6', 'port': '22', 'username': '$user', 'password': '', 'log_filename': './logs/session.log', 'theme': 'dark'}
Xterm.js theme: dark
Path override failed for key base::DIR_APP_DICTIONARIES and path '/usr/bin/qtwebengine_dictionaries'
[24572:24572:0418/141733.406446:ERROR:zygote_host_impl_linux.cc(101)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.

Failed to Launch on Ubuntu 22.04 with Python3

root@vm:/opt/uglypty# source bin/activate
(uglypty) root@vm/opt/uglypty# python3 -m uglypty
Key saved to "crypto.key".
settings.sqlite created
Created base plugin catalog.yaml
['/opt/uglypty/lib/python3.11/site-packages/uglypty/__main__.py']
qt.qpa.plugin: From 6.5.0, xcb-cursor0 or libxcb-cursor0 is needed to load the Qt xcb platform plugin.
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: wayland-egl, vnc, linuxfb, minimalegl, offscreen, vkkhrdisplay, minimal, eglfs, wayland, xcb.

Aborted (core dumped)

Let me know what additional logs you need!

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.