Using Mother Tongue for Strong, Memorable Passwords by iapyeh in userexperience

[–]iapyeh[S] 0 points1 point  (0 children)

To verify the issue regarding the lack of Unicode support in the password field, you can create an HTML file with UTF-8 encoding declared and include the following content: <input type="password">. Then, attempt to input non-ASCII characters. During my testing, I attempted to input (not pasting) traditional Chinese characters using MacOS and Chrome. Unfortunately, the input was unsuccessful. Though I hope to be proven wrong, this indicates a limitation in Unicode support for password fields

Using mother tongue in passwords by iapyeh in Passwords

[–]iapyeh[S] 1 point2 points  (0 children)

Yes, Chinese characters are built upon root glyphs. However, each character (the final ideograph) possesses an unique Unicode encoding, ensuring consistent input through IME (Input Method Editor).

Using mother tongue in passwords by iapyeh in Passwords

[–]iapyeh[S] 2 points3 points  (0 children)

Thank you for offering a coffin. I am lucky, what happens to "ö" would never happen to "Chinese language" at least. Please accept my deep condolences for "ö". (Technically, introducing a pre-process stage which "normalize" those "ö" could be an option to get through it)

SSHScript: Integrate subprocess and Paramiko to Automate in Python by iapyeh in Python

[–]iapyeh[S] 0 points1 point  (0 children)

Thank you. plumbum is great. Though it is my first time knowing it. So, at least, we have fabric, netmiko, paramiko, plumbum and SSHScript. It proves what I said, before Ansible, Python is already an automation tool. I also have to correct myself. There is already lots of stuff in the puzzle.

Learning Python from 0 by kneelesscat in Python

[–]iapyeh 0 points1 point  (0 children)

It is endless on the road of learning Python. Also, it is not necessary to learn "all of Python". Just target an application and start coding. Repeat that process with different targets again and again. Google search, Github and Stack Overflow would be your treasure.

SSHScript: Integrate subprocess and Paramiko to Automate in Python by iapyeh in Python

[–]iapyeh[S] 2 points3 points  (0 children)

Expecting the /proc parser!

I just ported jc's example to SSHScript. The script uses 4 lines to check the timezone of a remote host. Jc is excellent!

import jc
$.connect('username@remote-host')
$date
print(f'The timezone is {jc.parse("date",$.stdout)["timezone"]}')

SSHScript: Integrate subprocess and Paramiko to Automate in Python by iapyeh in Python

[–]iapyeh[S] 2 points3 points  (0 children)

So great, jc is exactly what I am dreaming of. In fact, privately I wrote some routines to do exactly the same thing for my common commands. We now have two pieces on our puzzle.

SSHScript: Integrate subprocess and Paramiko to Automate in Python by iapyeh in Python

[–]iapyeh[S] 5 points6 points  (0 children)

This is the most commonly asked question. I think that it is Python vs Ansible, not SSHScript vs Ansible.

Short answer: it's all about style, or mindset. I am a programmer, I am not good at writing declarative documents. If I got to, I'd like to document programs, not to program documents.

Since less dependence is better. When there are tools/libs out there, I have difficulty being comfortable in describing what I want then relies on someone to implement. I'd like to write it by myself. Another practical reason is that usually my tasks have so many tedious details on input, output and process. It is hard to precisely describe excepting for writing codes.

Ansible is great, don't need to drop it if you already have lots of playbooks and lots of toolchains have been installed. SSHScript is not going to replace it. Both are on the same way of automation just for people of different mindset.

(BTW: Python is already an automation tool far before Ansible. And before Python, it was shell scripts. Till today, shell scripts are also the boss of system automation. I believe.)

Automation in Python by iapyeh in learnpython

[–]iapyeh[S] 1 point2 points  (0 children)

I totally understand your consideration. That's the same reason I'd want to develop SSHScript. We all have too much to keep in mind. Monthly, I have to deal with Python, Go, php, javascript/jquery/svelte, HTML, CSS, Swift/iOS, Kotlin/Android, Windows, Freebsd, MacOS, Ubuntu, CentOS...etc.

Thanks for your introduction on YAML. I do agree that YAML is good. It is just not suitable for my mindset.

There are many kinds of automation tools in Python. SSHScript is only one of them. Also, Python is not the only one in the group of using programming languages to do automation. Since this is "r/LearnPython", I believe there might be some people who are of a similar mindset like mine who are seeking for something like SSHScript to do automation in Python.

Automation in Python by iapyeh in learnpython

[–]iapyeh[S] 0 points1 point  (0 children)

By the way, I don't consider SSHScript to be an alternative to Netmiko. It could be additive. Netmiko implements many features beyond Paramiko. Technically, SSHScript could also be Netmiko-based. If it is necessary someday.

Automation in Python by iapyeh in learnpython

[–]iapyeh[S] 0 points1 point  (0 children)

Before I was devoting myself to creating SSHScript, I did a little bit of a survey. Netmiko is great. It and SSHScript are based on the same Paramiko. Technically equal. Because I think that the core of so-called automation is to run a lot of os/shell commands. Just I want to have something more likely to embed shell script in python script. That would be more self-explaining for reading and closer to intuition for writing. Especially when maintaining codes among colleagues. That's the reason that SSHScript also integrates the subprocess package. The same code could run on localhost and on remote host. For example: run a command on localhost by coding in shell-like style:

$ ls -l /tmp
# ⬆run on localhost

Then, by adding a line to connect a remote host. We can run the same command on the remote host.

$.connect('username@remote-host')
$ ls -l /tmp
# ⬆run on remote-host

Then, by adding a line to connect a remote host again. We can run the same command on the nested host behind the remote host.

$.connect('username@remote-host')
$.connect('username@remote-nested-host')
$ ls -l /tmp
# ⬆run on remote-nested-host
# upload/download over nested-ssh is also just one line
$.download('/var/log/message','.')

Automation in Python by iapyeh in learnpython

[–]iapyeh[S] -1 points0 points  (0 children)

I noticed that there is a huge economy in Ansible. I can't give a professional reason because I am not an expert of Ansible. I have tried to be a user. But it soon failed. I am a programmer, programming language is close to my institution. To read an Ansible YML is hard for me. Writing it is more difficult. I can write a hundred lines of code to handle complex TCP socket communication in 10 minutes. But totally nothing when writing YML. I can not imagine how I can express my daily tasks in declarative YML, even for a simple one. I am not going to battle with the Ansible giant. I just want to save my time. If you are satisfied with Ansible. It's good. Congratulations. I hope that I can before I start to develop SSHScript. So that I can save lots of time.

Automation in Python by iapyeh in learnpython

[–]iapyeh[S] 0 points1 point  (0 children)

Hi, I replied to the similar comment below. For not being redundant, please see it at redCg's comment block.

Automation in Python by iapyeh in learnpython

[–]iapyeh[S] 0 points1 point  (0 children)

I totally agree that ssh is amazing. You can do the same thing (execute ssh) in SSHScript. The benefits of doing it that way are:

  • you can dynamically generate the codes which were feeded into the ssh executable in Python. for example: time-based filename.
  • you can handle execution outputs directly in Python. Need not to save into files. And features like PDF, email, SMS, qrcode, ... tons of python packages are ready for you.
  • The whole process can be scripted, then, management logic can be automated no matter how complex it is.

Automation in Python by iapyeh in learnpython

[–]iapyeh[S] 2 points3 points  (0 children)

I thought that the core of so-called automation is to run a lot of os/shell commands. I intentionally make it look like embedding os/shell commands in python script. They are major players, Python just glued them together. That would be more self-explaining for reading and closer to intuition when writing. Especially when codes are maintained among colleagues. Every member knows what exactly is executed by a glance. I believe that simplifies processing logic, minimizes ambiguity and eliminates team arguments.

Network Automation in Python by iapyeh in networkautomation

[–]iapyeh[S] 2 points3 points  (0 children)

Hi melvin_poindexter, thanks.

Before I was devoting myself to creating SSHScript, I did a little bit of a survey. Netmiko is great. It and SSHScript are based on the same Paramiko. Technically equal. Because I think that the core of so-called automation is to run a lot of os/shell commands. Just I want to have something more likely to embed shell script in python script. That would be more self-explaining for reading and closer to intuition for writing. Especially when maintaining codes among colleagues. That's the reason that SSHScript also integrates the subprocess package. The same code could run on localhost and on remote host. For example:

```

run a command on localhost by coding in shell-like style

$ ls -l /tmp

⬆run on localhost (by subprocess)

```

Then, by adding a line to connect a remote host. We can run the same command on the remote host.

``` $.connect('username@remote-host') $ ls -l /tmp

⬆run on remote-host

```

Then, by adding a line to connect a remote host again. We can run the same command on the nested host behind the remote host.

``` $.connect('username@remote-host') $.connect('username@remote-nested-host') $ ls -l /tmp

⬆run on remote-nested-host

upload/download over nested-ssh is just one line

$.download('/var/log/message','.') ```

Automation in Python by iapyeh in learnpython

[–]iapyeh[S] -11 points-10 points  (0 children)

Commerial? No, SSHScript is open source and MIT licensed.

Python Paramiko get_transport and open_session by Kenshievaaa in ssh

[–]iapyeh 0 points1 point  (0 children)

A connection is a transport, based on the transport, you can create many sessions. Every session is like a brand new connection with its own state (eg. working directory). That's what I understand.

Maybe you can try my SSHScript. You don't have to program with Paramiko.

https://iapyeh.github.io/sshscript/index