• Operand
  • can sell console.

gram:build

> ./config/nushell/scan.nu

Lenses
(coming soon!)


def scan [
  node: path,
  --dura (-d): duration = 8sec
] { loop { clear
  try { ls $node | get name | sort | path basename | print }
sleep $dura } }

def "ip scan" [
  --dura (-d): duration = 8sec
] { loop { clear; try { print (address) }; print ''; ip a | print; sleep $dura } }

def "ps scan" [
  name:string,
  --dura (-d): duration = 8sec,
] { loop { clear
  netstat -tunlp | tail -n+3 | lines | split column -r ' +' | where column7 =~ $"/($name)" | print;
  print " "; ps | where name =~ $name | to yaml
sleep $dura } }

def "cycle" --wrapped [ --dura (-d): duration = 6sec, ...command: string ] {
  loop {
    clear | print;
    nu -e (($command | str join ' ') + '; exit' | str join ' ') | print;
    sleep $dura
  }
}