• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

expect script not working as expected

Scheduled Pinned Locked Moved Development
7 Posts 3 Posters 1.2k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M
    mephmanx
    last edited by mephmanx Jan 24, 2023, 4:04 PM Jan 24, 2023, 3:27 PM

    I am trying to use an expect script against a pfsense 2.6 vm running on qemu but I am seeing strange behavior when trying to use it.

    expect script (for demo purposes)

    #!/usr/bin/expect
    set timeout -1;
    spawn telnet localhost 4568
    send "\n"
    expect -ex "Enter an option:"
    send "8\n"
    expect "option:"
    send "8\r"
    expect eof
    expect "root"
    send "./pf-init-2.sh\r"
    expect "/root"
    

    But when it is run, it hangs at the below prompt:Screenshot 2023-01-24 at 10.26.46 AM.png

    Adding debug output:
    Screenshot 2023-01-24 at 11.03.35 AM.png

    V 1 Reply Last reply Jan 24, 2023, 5:05 PM Reply Quote 0
    • V
      viragomann @mephmanx
      last edited by Jan 24, 2023, 5:05 PM

      @mephmanx
      Why don't you use SSH??

      M 2 Replies Last reply Jan 24, 2023, 5:19 PM Reply Quote 0
      • M
        mephmanx @viragomann
        last edited by mephmanx Jan 24, 2023, 5:20 PM Jan 24, 2023, 5:19 PM

        @viragomann can i change the ssh port? i am running this through an ssh session so ssh to localhost 22 logs in to the local system, not the pfsense vm.

        R 1 Reply Last reply Jan 24, 2023, 5:20 PM Reply Quote 0
        • R
          rcoleman-netgate Netgate @mephmanx
          last edited by Jan 24, 2023, 5:20 PM

          @mephmanx said in expect script not working as expected:

          can i change the ssh port?

          https://docs.netgate.com/pfsense/en/latest/config/advanced-admin.html#ssh-port

          A search header in our docs when you search "ssh port"

          Ryan
          Repeat, after me: MESH IS THE DEVIL! MESH IS THE DEVIL!
          Requesting firmware for your Netgate device? https://go.netgate.com
          Switching: Mikrotik, Netgear, Extreme
          Wireless: Aruba, Ubiquiti

          M 1 Reply Last reply Jan 24, 2023, 5:22 PM Reply Quote 0
          • M
            mephmanx @rcoleman-netgate
            last edited by Jan 24, 2023, 5:22 PM

            @rcoleman-netgate what would be the value in the xml? i dont have access to the gui in this use case.

            1 Reply Last reply Reply Quote 0
            • M
              mephmanx @viragomann
              last edited by Jan 24, 2023, 5:41 PM

              @viragomann it also appears like I have no access to the networks either...only telnet. i havent hooked up the virtual ports to the host...

              V 1 Reply Last reply Jan 24, 2023, 6:05 PM Reply Quote 0
              • V
                viragomann @mephmanx
                last edited by Jan 24, 2023, 6:05 PM

                @mephmanx
                Can you edit and re-import the config?

                If so, there is an <ssh> section within <system>.
                You can add a port line there:

                <port></port>
                
                1 Reply Last reply Reply Quote 0
                • J jimp moved this topic from Problems Installing or Upgrading pfSense Software on Jan 25, 2023, 7:51 PM
                1 out of 7
                • First post
                  1/7
                  Last post
                Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                  This community forum collects and processes your personal information.
                  consent.not_received