Skip to content

Instantly share code, notes, and snippets.

@kinomakino
Created March 2, 2017 10:15
Show Gist options
  • Save kinomakino/6982b12dfe2f8203b96f91c09e5867e9 to your computer and use it in GitHub Desktop.
Save kinomakino/6982b12dfe2f8203b96f91c09e5867e9 to your computer and use it in GitHub Desktop.
#!/usr/bin/expect -f
set mortadela [lindex $argv 0]
set timeout 60
spawn ssh usuario@ip_fortinet
expect "password:"
send "tu_clave\r"
expect "Terciario"
send "config firewall address\r"
expect "Terciario (address)"
send "edit $mortadela\r"
expect ")"
send "set subnet $mortadela/32\r"
expect ")"
send "end\r"
expect "Terciario"
send "config firewall addrgrp\r"
expect ")"
send "edit BLACKLIST\r"
expect ")"
send "append member $mortadela\r"
expect ")"
send "end\r"
expect "Terciario"
send "exit\r"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment