I'm trying to combine the two python scripts 'SendData.py' and 'GetDataToFile.py'. I can get both scripts to work independently of each other but not together. The platform is Palo Alto Panorama.
Code:
# $language = "python"
# $interface = "1.0"
import os
output_path = 'path to output folder'
show_script = 'script with cli commands'
def main(output_file):
crt.Screen.Synchronous = True
filename = os.path.join(output_file, 'output.txt')
fp = open(filename, "wb+")
for line in open(show_script, 'r'):
crt.Screen.Send(line)
crt.Screen.WaitForString("\n", 2)
promptStr = '>'
waitStrs = ["\n", promptStr]
row = 1
while True:
result = crt.Screen.WaitForStrings( waitStrs )
if result == 2:
break
screenrow = crt.Screen.CurrentRow - 1
readline = crt.Screen.Get(screenrow, 1, screenrow, 500)
fp.write(readline + os.linesep)
crt.Screen.Synchronous = False
main(output_path)
The screen output is chewed up as are the lines captured in the output file. Oddly, the output file never captures the full output. I've scoured the forums, the internet, etc, to no avail. Any help would be appreciated, even if it's just a link somewhere with solid information about SecurtCRT methods/attributes.Thank you.