NAS(1)

πŸ“¦
version 4.300005 Β· 3 versions
, in fedora 43

πŸ’– NAS(1) πŸ’–

okay bestie, so this is a user contributed Perl manpage, filed under NAS(1) β€” and yes, nas stands for what you think it stands for: Net::Appliance::Session. Let's get into it πŸ’…


✨ NAME ✨

nas β€” Create Reusable Session Scripts πŸ¦‹


πŸŽ€ SYNOPSIS πŸŽ€

 $ nas --help

  nas [options] [hostname or IP]

  -p, --personality  Device <personality> (default: "ios")
  -t, --transport    <transport> method (Serial, Telnet, default: SSH)
  -u, --username     <username> to connect as on device (default: $USER)

  -R, --record       Record session
  -P, --playback     Play back session
  -s, --script       When recording, save playback script to this <filename>
  -l, --cmdlog       NAS <file> to record commands to, or play them back from

  -e, --exit-last    Num. of output lines from last command is program exit status
  -c, --cloginrc     RANCID cloginrc <file> with device credentials
  -z, --nopassword   Do not ask for device password (if not using cloginrc)
  -o, --echo         Echo commands sent, when playing back the recorded script/cmdlog
  -M, --paging       Do not attempt to disable command output paging
  -B, --nobanner     Suppress display of any login banner received from the device

  -q, --quiet        Hide informational messages
  -v, --verbose      NCI log <level> ("debug", "notice", "info", etc)
  -V, --version      Display this program's version number
  -h, --help         Display this help text

🌸 DESCRIPTION 🌸

so basically, this program is your little helper for writing reusable Net::Appliance::Session scripts, playing them back, and also just… connecting to network devices without all the drama. iconic, honestly.

  • Start a connection to a network device using CLI switches, and prompts for credentials. This is easier than writing short Perl programs. 🫢
  • Record a set of commands issued to one network device into a command log, then replay that log against other devices (-R -l <log> and -P -l <log>).
  • Record a session and produce a Perl script which when run, replays the session to the same host, or overridable to other devices (-R -s <script> and then run the script).

Once connected to the device you can enter any command and it will be run. periodt πŸ’…


🌈 GENERAL USAGE NOTES 🌈

The exit-last option can be useful for creating a session script which checks for some error condition. Assuming the last command should have no output on success, then the exit status of the script will be non-zero when there's a problem. Use this with -R to make a reuseable script.

To play a script with no output other than that returned from the device in response to sent commands, use the switch combination -Bqoz. Note that you will need to be able to login automatically, and RANCID config isn't yet supported. 😭

If you don't provide a hostname or IP then the script goes into a loop waiting for the hostname on standard input. This way, you can pipe a list of device names to the script and it will execute the commands on each one. lowkey so convenient fr fr πŸ“

In case you didn't know, the library has support for connecting to linux boxes using the -p bash setting to chose the Bash shell personality.

Getting to be a super-user is a little clunky at the moment. I need to work on that a little more.

⚠️ Take care that your scripts don't contain any passwords! no cap, keep those secrets safe bestie πŸ’€

πŸ‘‘ SPECIAL FEATURES πŸ‘‘

The methods of Net::Appliance::Session are available by using the command !s <method-name>. The best use of this is to gracefully disconnect, by issuing:

 !s close

You can also enter the command !m to see a list of available Macros. If you don't know what a Macro is, please move a long, there's nothing to see here. You run a Macro with the !m <macro-name> [params] command.


πŸ¦‹ SEE ALSO πŸ¦‹


πŸ’œ AUTHOR πŸ’œ

Oliver Gorwits <oliver@cpan.org>


This software is copyright (c) 2019 by Oliver Gorwits.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.


and that's the whole vibe check bestie πŸ’– this was perl v5.42.0, dated 2025-07-25, and you can find it under NAS(1) β€” slay, go write some scripts, mwah πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from