Score:0

Execute sequence of commands in fortinet

in flag

I would like to execute three commands in a fortinet firewall, the commands are:

#To enter in the config mode:
config vdom
#To select the virtual domain:
edit "name"
#To see the info I want:
get router info routing-table static

But I need to do it remotely, to do that, I try this:

ssh xx@xx "config vdom; edit "xxx"; get router info routing-table static"

When I do that, it executes only the command 1 and gives an error in the second and the third.

I tried changing the command to something like this and it executes 1 and 2, but not the third:

ssh xx@xx "config vdom edit "xxxx"; get router info routing-table static"

And I tried the same for the third one but it does not work...

Looks like it executes the commands independently and not in a sequence.

Is there a way to do that in a single command?

Score:0
in flag

I did it by using paramiko in a python script.

The command to introduce in the exec_command is this one:

command = "config vdom\nedit %s\nget router info routing-table static" % (vdom)
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.