Last active
February 23, 2016 18:58
-
-
Save richardsonlima/9bf322682431fc816f43 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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