Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

OGG Operation and maintenance Optimization script (12)-Information synchronization Class-Information upload

2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

File: upload.sh

Path: $HOME/ggscript/ggupload

Function: this script will not be used directly, it is designed to satisfy other scripts for uploading information, and the corresponding file information is directly called within the script.

He reads the system configuration information in the system information configuration file sysinfo

Example

[detest#]

Ip-MTMyLjEyMS4xMDEuODYK

UserName-Z2dzCg==

PassWord-Z2dzxxxxxx

Port-MjIK

Path-L2RhdGExL2dncy9nZ3NlcnZlci9kaXJkZWYK

[# detest]

The above information is encrypted with base64 to ensure the security of the information. Obtain the IP user name, password, and port path.

And send the corresponding files to the corresponding machine.

#! / bin/bashif [$#-eq 0]; then echo "info host file checkf" exit 2fiif [$#-eq 1]; then echo "info host file checkf" exit 2fiif [$#-eq 1] Then echo "info host file checkf" exit 2fihost=$1file=$2checkf=$3cd $HOME/ggscript/ggupload#sed'/ "$host" /, / 5lapp'$checkf > infotmpcat $HOME/ggscript/ggupload/$checkf | awk'/'$host'#/,/#'$host'/ {if (I > 1) print x tersichi 0 Grep +}'> $HOME/ggscript/ggupload/infotmpip= `cat $HOME/ggscript/ggupload/infotmp | grep-w "Ip" | cut-d "-"-f 2`pw = `cat $HOME/ggscript/ggupload/infotmp | grep-w "PassWord" | cut-d "-" f 2`port = `cat $HOME/ggscript/ggupload/infotmp | grep-w "Port" | cut-d "-"-f 2`us = `cat $HOME/ggscript/ggupload/infotmp | grep-w "UserName" | cut-d "-"-f 2`path = `cat $HOME/ggscript/ggupload/infotmp | grep-w "path" | cut-d "-"-f " 2`echo "code" echo "ip=$ip" echo "pw=$pw" echo "port=$port" echo "user= $us" echo "path=$path" echo $ip > tmpperl-MMIME::Base64-ne 'print decode_base64 ($_)'

< tmp >

Outip= `cat out`echo $pw > tmpperl-MMIME::Base64-ne 'print decode_base64 ($_)'

< tmp >

Outpw= `cat out`echo $port > tmpperl-MMIME::Base64-ne 'print decode_base64 ($_)'

< tmp >

Outport= `cat out`echo $us > tmpperl-MMIME::Base64-ne 'print decode_base64 ($_)'

< tmp >

Outus= `cat out`echo $path > tmpperl-MMIME::Base64-ne 'print decode_base64 ($_)'

< tmp >

Outpath= `cat out` # echo "decode" # echo "ip=$ip" # echo "pw=$pw" # echo "port=$port" # echo "user=$us" # echo "path=$path" while [${# port}-le 1] do port=22done#echo $ip $pw $port $pathexpect-c "spawn scp-r-P $port $file $us@$ip:$path expect {\" * assword\ "{set timeout 300; send\" $pw\ r\ ";}\" yes/no\ "{send\" yes\ r\ "; exp_continue;}} expect eof"

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report