File tree 3 files changed +8
-6
lines changed 3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,6 @@ def ssh_connect():
88
88
elif basevm_type == 'aws' :
89
89
correct_date = subprocess .check_output ("date +%Y%m%d" , shell = True )
90
90
correct_time = subprocess .check_output ("date +%T" , shell = True )
91
- os .system ("ssh -i TESTKEY.pem ec2-user@{0} date +%Y%m%d -s {1}" .format (attacked_addr , correct_date ))
92
- os .system ("ssh -i TESTKEY.pem ec2-user@{0} date +%T -s {1}" .format (attacked_addr , correct_time ))
93
- os .system ("ssh -i TESTKEY.pem ec2-user@{0} sort --stable --reverse --key=1,2 /var/log/secure -o /var/log/secure" .format (attacked_addr ))
91
+ os .system ("ssh -i TESTKEY.pem ec2-user@{0} sudo date +%Y%m%d -s {1}" .format (attacked_addr , correct_date ))
92
+ os .system ("ssh -i TESTKEY.pem ec2-user@{0} sudo date +%T -s {1}" .format (attacked_addr , correct_time ))
93
+ os .system ("ssh -i TESTKEY.pem ec2-user@{0} sudo sort --stable --reverse --key=1,2 /var/log/secure -o /var/log/secure" .format (attacked_addr ))
Original file line number Diff line number Diff line change @@ -34,7 +34,8 @@ elif [ ${basevm_type} = "aws" ]; then
34
34
ssh -i TESTKEY.pem -o StrictHostKeyChecking=no ec2-user@${image_addr} " sudo mkdir -p ${dst} "
35
35
fi
36
36
scp -r -i TESTKEY.pem -o StrictHostKeyChecking=no ${src} ec2-user@${image_addr} :
37
- ssh -i TESTKEY.pem -o StrictHostKeyChecking=no ec2-user@${image_addr} " sudo mv ${src} ${dst} "
37
+ # Special syntax for ${src} to preserve the last part of the name (after /) for the local 'mv'
38
+ ssh -i TESTKEY.pem -o StrictHostKeyChecking=no ec2-user@${image_addr} " sudo mv ${src##*/ } ${dst} "
38
39
elif [ ${os_type} = " ubuntu_20" -o ${os_type} = " ubuntu_18" -o ${os_type} = " ubuntu_16" ]; then
39
40
if (ssh -i TESTKEY.pem -o StrictHostKeyChecking=no ubuntu@${image_addr} " [ -d ${dst} ]" )
40
41
then
@@ -43,6 +44,7 @@ elif [ ${basevm_type} = "aws" ]; then
43
44
ssh -i TESTKEY.pem -o StrictHostKeyChecking=no ubuntu@${image_addr} " sudo mkdir -p ${dst} "
44
45
fi
45
46
scp -r -i TESTKEY.pem -o StrictHostKeyChecking=no ${src} ubuntu@${image_addr} :
46
- ssh -i TESTKEY.pem -o StrictHostKeyChecking=no ubuntu@${image_addr} " sudo mv ${src} ${dst} "
47
+ # Special syntax for ${src} to preserve the last part of the name (after /) for the local 'mv'
48
+ ssh -i TESTKEY.pem -o StrictHostKeyChecking=no ubuntu@${image_addr} " sudo mv ${src##*/ } ${dst} "
47
49
fi
48
50
fi
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ elif [ ${basevm_type} = "aws" ]; then
34
34
scp -r -i TESTKEY.pem -o StrictHostKeyChecking=no ${abs_path}${inst_dir} /malware_creation/cpulimit/src/cpulimit ec2-user@${addr} :
35
35
command=" \" exec -a cpusage cpulimit -l ${crspd_option} ${malware_name} ${mode} 1000 &\" " ;
36
36
# ssh -i TESTKEY.pem -o StrictHostKeyChecking=no ec2-user@${addr} "chmod +x cpulimit; sudo mv cpulimit /usr/bin"
37
- ssh -i TESTKEY.pem -o StrictHostKeyChecking=no ec2-user@${addr} " chmod +x cpulimit; sudo mv cpulimit /usr/bin; sudo chmod 777 /etc/rc.d/rc.local; echo 'bash -c ${command} ' >> /etc/rc.d/rc.local" ;
37
+ ssh -i TESTKEY.pem -o StrictHostKeyChecking=no ec2-user@${addr} " chmod +x cpulimit; sudo mv cpulimit /usr/bin; sudo chmod 777 /etc/rc.d/rc.local; echo 'bash -c ${command} ' >> /etc/rc.d/rc.local" ;
38
38
else
39
39
command=" ${malware_name} ${mode} ${crspd_option} &" ;
40
40
ssh -i TESTKEY.pem -o StrictHostKeyChecking=no ec2-user@${addr} " echo '${command} ' >> /etc/rc.d/rc.local" ;
You can’t perform that action at this time.
0 commit comments