Introducing SOC Insights for BloxOne Threat Defense: Boost your SOC efficiency with AI-driven insights to eliminate manual work and accelerate investigation and response times. Read the blog announcement here.

Automation Scripts

Reply

Hit enter after a send_command in python/netmri

New Member
Posts: 1
2502     0

Hi Team,

 

I'm trying to write a python script in netmri to copy dap.xml file from ASA to my FTP server but once I issue copy it will ask for multiple prompt (we need just press 'enter' for 4 to 5 times) but I couldn't do this, could you please help? I've tried /r,/n and combination but no luck Smiley Sad

 

# BEGIN-SCRIPT-BLOCK
# Script-Filter:
# true
# END-SCRIPT-BLOCK

 

from python_helper import send_multiline
from python_helper import init_helper
from pprint import pprint
import re

# initiate API connector
cli = init_helper(api_url, http_username, http_password, job_id, device_id, batch_id)

 

#get current dap xml file
sh_disk = cli.send_command('sh disk0: | include dap.xml')

#Copy dap file to ftp

#cli.send_command('copy disk0:dap.xml ftp://ftpuser:ftppw@1.1.1.1/VPNDAP_$device_dap.xml\n\n\n')
cli.send_command('\n')
cli.close_session()

 

 

Output:

vpn-rnd-1# sh disk0: | include dap.xml
352 59869 Mar 24 2020 04:28:20 dap.xml
290 9468 Jun 21 2018 11:47:16 original_dap.xml

 

vpn-rnd-1# copy disk0:dap.xml ftp://ftpuser:ftppw@1.1.1.1/VPNDAP_$device_dap.xml


Source filename [dap.xml]?

*** Job Failed Due to Timeout ***

Re: Hit enter after a send_command in python/netmri

Superuser
Posts: 115
2503     0

Change the "\n" to "\r"

Follow me on LinkedIn: https://www.linkedin.com/in/sifbaksh
Twitter: https://twitter.com/sifbaksh

https://sifbaksh.com
Showing results for 
Search instead for 
Did you mean: 

Recommended for You