Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
Jorge_Cardona
Participant

From Bash script to Web Services API

Hi All,

This question might have been asked and answered in different ways, but I still cannot get what I need.

 

We have a script that ssh to a server to run 'fw sam' commands to block IPs.

The scripts looks like this:

		spawn ssh -o "StrictHostKeyChecking no" $USERNAME@$FIREWALL
   		expect "*assword: "
		send "$PASSWORD\r"
   		expect $multiPrompt
   		send "mdsenv PROD_FW\r"
   		expect $multiPrompt
   		send "fw sam -t $TIME -e name=\"NOT_IN Block\" -e comment=\"$FLAG\" -J src $ATTACKER\r"
		exit
		exit
		
	

What I would like to know is if it is possible to convert that script to Web Services API calls
with something like web_api/login, web_api/sam_command, web_api/logout or something similar.

The other answers for /put-file and /run-script dont tell me much if it will work the same as the above code.

Thanks in advance.

3 Replies
Danny
Champion Champion
Champion

This has been answered before.

Also see here.

Jorge_Cardona
Participant

Hi @Danny  Thanks for your reply.

One quick question.. What kind of access does a user needs in order to run the commands?

I tried simple 'ls -la /' and I get a permission error.

To run 'fw sam...' what kind of access would be it? Is it a the server level, or at the Smart Console level?

 

Thanks...

0 Kudos
Jorge_Cardona
Participant

I just ran a test and I got this message
"message": "To run a script on a Domain Server, you must have an admin role with Multi-Domain provisioning permissions.",

Will post another update once I get that kind of access..

0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events