Skip to content
This repository was archived by the owner on Nov 28, 2024. It is now read-only.
This repository was archived by the owner on Nov 28, 2024. It is now read-only.

How to put the output we get from expect prompt in a file #83

Description

@panda2799

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions