Skip to content

scripting and python

I wrapped up the linux+ and started studying for the sec+ just to realize I was incredibly bored with it. It’s not challenging what-so-ever so I hit a bit of a wall on what to do next. I’ve been putting off coding for a long time, and I think it’s time I gain some proficiency. Going forward for a bit it’s likely going to be more snippets in the direction of automation, and a bit of python. I hope to get far into API integration if I can build up a strong core here. The intention is to start building a github portfolio as well.


This blob is just a quicky so that I could enable vim colors on all my shells. I had also set an alias on my servers for vi=vim as well. Not much to it, but it’s a start.

Yes I log into my home servers as root.

blob below, but wordpress because wordpress doesn’t handle indents well.


#functions needed. Just scrubs text and appends if not found.
vimcolor ()
 [ ! -f ~/.vimrc ] && touch ~/.vimrc

 grep -q 'syntax on' ~/.vimrc
 if [ $? -eq 1 ] 
 printf "syntax on\ncolorscheme desert\n" >> ~/.vimrc

vimalias ()
 grep -q 'alias vi=' ~/.bashrc
 if [ $? -eq 1 ] 
 printf "alias vi='vim'" >> ~/.bashrc
#make array
declare -a targethost
#query user, initial
printf "Enter the IP or FQDN of a target machine\n(Ctrl+C to Cancel)\n:"
read -a targethost

#create indef while loop with break when user inputs done
while :
 printf "Enter another IP or FQDN, or type...\n done\nto begin running.\n:"
 read "input"
 echo $input
 if [ $input == "done" ]; then

#run for loop for every value in $targethost arrray
for i in "${targethost[@]}"
 #the actual action 
 sshpass -f /home/mzimmerer/Nextcloud/Scripts/.sshauth ssh -tt root@$target "$(typeset -f); vimcolor; vimalias; dnf -y --quiet install vim"




One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *