#!/bin/bash ################################################## # script to convert configuration files from XML # # mRemote format to ssh config # # f4ir from toniemy crew # ################################################## #define temp=/tmp/temp.txt config=/tmp/config #check files if [ -a $temp ] then rm -rf $temp fi if [ -a $config ] then rm -rf $config fi #check path if [ "$1" == "" ] then echo "Usage $0 " else # looking for something interesting with ssh2 cat $1 | grep "Node " | grep 'SSH2' | cut -d " " -f 10,15,18 > $temp #load into loop grep "^[^#]" $temp | while read NAME USER HOST; do name=`echo $NAME | cut -d '"' -f 2`; user=`echo $USER | cut -d '"' -f 2`; ip=`echo $HOST | cut -d '"' -f 2`; echo " host $name" >> $config echo " Hostname $ip" >> $config echo -e " User $user\n\n" >> $config done echo "Your config is in $config. Please check :)" fi