Open panda2799 opened 2 years ago
I think something like this would do the trick:
def write_to_file(msg):
with open('output.log', 'a') as f:
f.write(msg)
interact = SshClientInteraction(client, output_callback=write_to_file)
@panda2799 did this helped ?
Hi sir,
I have been trying to log the output that i get on cmd through interact.expect() into a file. But file is not receiving anything. I am not able to find a proper code as well. Could you please help me with that.
Pasting my code for reference: interact.send("show full-configuration") with open('backup1'+'.txt','w') as file: for line in interact.expect("",timeout=1): file.write(line)
I am trying to fetch the fortigate configuration output. Please help me. Thanks!