Skip to content

Instantly share code, notes, and snippets.

@richardsonlima
Last active February 23, 2016 18:58
Show Gist options
  • Save richardsonlima/9bf322682431fc816f43 to your computer and use it in GitHub Desktop.
Save richardsonlima/9bf322682431fc816f43 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Created by Richardson Lima
# set -x
Vlan="10x"
AllFilesDir="RuleEnv/$Vlan/allfiles"
FinalFileDir="RuleEnv/$Vlan/finalfile"
function createEnvDir(){
echo -e '\033[1;32m [+] Creating a Env dir , waiting a moment ... \033[0m'; sleep 5
mkdir -p RuleEnv/$Vlan/{allfiles,finalfile}
}
function insetTarget(){
for IPS in $( cat ./ServerList.txt);
do echo -e '\033[1;32m [+] Ip Target in use: \033[0m' $IPS && \
cat << EOF > $AllFilesDir/target-$RANDOM-$IPS.file
edit "$IPS"
set comment "$IPS"
set associated-interface "Iface_xxx.xxx"
set subnet $IPS 255.255.255.255
next
EOF
done
}
function createFortigateFile(){
echo -e '\033[1;32m [+] Making a Fortigate file to insert rule, waiting a moment ... \033[0m'; sleep 5
cat $AllFilesDir/target-* > $FinalFileDir/fortiGateRuleFile-$Vlan
}
createEnvDir
insetTarget
createFortigateFile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment