KiTTY Terminal Scripting

PuTTY oder doch KiTTY

KiTTY ist ein Telnet- und SSH-Terminal Emulator für Windows. Die Software ist eine Alternative zu PuTTY und wurde als PuTTY-Clone/Fork entwickelt und ist auch als portable Version erhältlich. Des weiteren werden Raw, Rlogin, ADB, Cygterm und Serial Terminal ermöglicht. KiTTY ist im selben unauffälligen lock and feel gehalten wie PuTTY, bietet jedoch einige nützliche Erweiterungen.

KiTTY Icon

Ein Feature von KiTTY ist der integrierte Editor, mit diesem beim entwickeln und Testen von Scripts die Arbeit im Terminal erleichtert wird, mit <Shift+F2> ruft man den Editor auf.

Feature von KiTTY ist der integrierte Editor
KiTTY Terminal mit mNotepad (Shift+F2) Editor

Die Code Zeilen aus dem mNotepad können zeilenweise oder als markierten Bereich mit der Option Send (F12) zum Terminal gesendet werden. Das Testen von Code Snippets in der Linux Shell kann so schnell und einfach ausgeführt werden.

Mit <Ctrl+Rechte Maustaste> erscheint das Kontext Menu mit den Optionen, so können Scripte über Send script file übertragen werden die im Terminal Shell ausgeführt werden. Die Option User Command bietet die Möglichkeit häufig verwendete Befehle auszuführen, die in der Registry gespeichert werden.

KiTTY Kontext Menu
WinSCP

Falls vorhanden kann WinSCP aufgerufen werden, es wird direkt eine Verbindung zum Host aufgebaut, oder man wählt die Dateiübertragung über Send with pscp.

Wer die Sessions und Hosts Parameter nicht in der Registry verwalten möchte, dem bietet sich die Möglichkeit die Einstellungen in der INI Datei zu speichern. Dabei muss folgender Eintrag in kitty.ini eingefügt werden.

[KiTTY]
savemode=dir

Mit folgender Eingabe in der Eingabeaufforderung für die Verwaltung ohne Registry:

kitty.exe -convert-dir

Hierdurch werden unter dem Programm Ordner 6 Unterordner angelegt, die Einstellungen werden in den Ordnern Commands, Folders, Launcher, Sessions, Sessions_Commands und SSHHostKeys abgelegt.

Python Version? How to check Version

How to check installed Python Version

Python Version

How to check Python Version and query OS Platform using Python.

#!/usr/bin/python

import platform
import sys

def linux_distribution():
  try:
    return platform.linux_distribution()
  except:
    return "N/A"

print("""Python version: %s
Distribution: %s
OS: %s
System: %s
Machine: %s
Platform: %s
uname: %s
version: %s
""" % (
sys.version.split('\n'),
str(platform.dist()),
linux_distribution(),
platform.system(),
platform.machine(),
platform.platform(),
platform.uname(),
platform.version(),
))

Python should output the entire OS environment.

#!/usr/bin/env python

import os

for param in os.environ.keys():
    print "%20s %s" % (param,os.environ[param])

About Python

Python consistently ranks as one of the most popular programming languages.

Python is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation.

Python is dynamically typed and garbage-collected. It supports multiple programming paradigms, including structured (particularly procedural), object-oriented and functional programming. It is often described as a „batteries included“ language due to its comprehensive standard library.

Guido van Rossum began working on Python in the late 1980s as a successor to the ABC programming language and first released it in 1991 as Python 0.9.0.[35] Python 2.0 was released in 2000. Python 3.0, released in 2008, was a major revision not completely backward-compatible with earlier versions. Python 2.7.18, released in 2020, was the last release of Python 2.

The Python Methods

Methods on objects are functions attached to the object’s class; the syntax instance.method(argument) is, for normal methods and functions, syntactic sugar for Class.method(instance, argument). The Python methods have an explicit self parameter to access instance data, in contrast to the implicit self (or this) in some other object-oriented programming languages (e.g., C++, Java, Objective-C, Ruby). Python provides methods, often called dunder methods (due to their names beginning and ending with double-underscores), to allow user-defined classes to modify how they are handled by native operations including length, comparison, in arithmetic operations and type conversion.

Python Libraries

Python’s large standard library provides tools suited to many tasks and is commonly cited as one of its greatest strengths. For Internet-facing applications, many standard formats and protocols such as MIME and HTTP are supported. It includes modules for creating graphical user interfaces, connecting to relational databases, generating pseudorandom numbers, arithmetic with arbitrary-precision decimals, manipulating regular expressions, and unit testing.

Most Python implementations (including CPython) include a read–eval–print loop (REPL), permitting them to function as a command line interpreter for which users enter statements sequentially and receive results immediately.

Also Python comes with an Integrated development environment (IDE) called IDLE, which is more beginner-oriented.

Other shells, including IDLE and IPython, add further abilities such as improved auto-completion, session state retention, and syntax highlighting.

Python Development

As well as standard desktop integrated development environments, there are web browser-based IDEs, including SageMath, for developing science- and math-related programs; PythonAnywhere, a browser-based IDE and hosting environment; and Canopy IDE, a commercial IDE emphasizing scientific computing.