📜 ⬆️ ⬇️

Paste Putty under 1 comb

Those of us who work with a bunch of Linux servers, have to use Putty for sitting under Windows - it’s good for everyone: free, supports everything you need, but there’s one problem: when there are too many configured connections, a massive change in parameters will suck out of you all juices (as well as, for example, setting your favorite parameters for new compounds). On Habré 2.5 years ago there was a note on this topic , but there still requires a lot of manual work.

After having been tormented for several years with this problem, I decided to write a small python script that should solve the problem once and for all - just run it without parameters, and it rolls through all the saved connections, wired changes that you can customize to your taste.

We take the script here - license MIT = we do what we want (to start you need a python). By default, the script changes colors so that (I) read better (dark blue makes a little lighter, light blue also), increases the scrolling buffer to 20k (so that the left text does not disappear), sets the window size more, turns on Alt + Enter full screen, removes the warning when closing and enables compression of SSH traffic.
')
Of course you can stick any parameters here. When adding a new connection, I just roll this script and it's done. Under the cut - source text, you can not click ;-)


As text:

#Author Michail Svarychevski 3@14.by #Licensed under MIT license import winreg print ("") print ("This is awesome Putty settings update script!") print ("---------------------------------------------") i = 0 with winreg.OpenKey(winreg.HKEY_CURRENT_USER, "Software\SimonTatham\PuTTY\Sessions", 0, 15) as key: while 1: try: subkey = winreg.EnumKey(key, i ) print ("Processing " + subkey + "...") with winreg.OpenKey(key, subkey, 0, 15) as session: winreg.SetValueEx(session, "Colour14", 0, winreg.REG_SZ, "96,96,255") winreg.SetValueEx(session, "Colour15", 0, winreg.REG_SZ, "150,150,255") winreg.SetValueEx(session, "ScrollbackLines", 0, winreg.REG_DWORD, 20000) winreg.SetValueEx(session, "TermHeight", 0, winreg.REG_DWORD, 40) winreg.SetValueEx(session, "TermWidth", 0, winreg.REG_DWORD, 150) winreg.SetValueEx(session, "WarnOnClose", 0, winreg.REG_DWORD, 0) winreg.SetValueEx(session, "Compression", 0, winreg.REG_DWORD, 1) winreg.SetValueEx(session, "FullScreenOnAltEnter", 0, winreg.REG_DWORD, 1) i+=1 except WindowsError: break print ("---------------------------------------------") print ("We are done!") 


Comments / improvements - in the studio

Source: https://habr.com/ru/post/118278/


All Articles