How to open links to device in Linux for Uneltab

  1. For integration protocols (telnet, vnc, capture,ssh etc) you need to add in browser (firefox) some rows like in picture below.Screenshot_Selection_20160401_13:21:07
  2.  Then browser will ask about application for open this link. I wrote script for ssh/telnet/vnc
    #cat moz-telnet.pl
    #!/usr/bin/perl
    # parse URL
    ($protocol,$host) = split /:\/\//, $ARGV[0];
    ($host,$port) = split /:/, $host;
     
     # validate input
    if ( $protocol !~ /^(telnet|ssh|vnc)$/ ||
    $host !~ /^[a-zA-Z0-9][a-zA-Z0-9.-]*$/ ||
    $port !~ /(^[a-zA-Z0-9][a-zA-Z0-9_-]*$|^$)/ ) {
    warn "Invalid URL";
    exit 1;
           }
           
    # if SSH, add -p argument
    if ( $protocol eq "ssh" && $port != '' ) { $port = "-p $port" ; }
     
    # call terminal emulator
    if ( $protocol eq "ssh") {exec("xterm -e $protocol $host $port");}
    if ( $protocol eq "telnet") {exec("xterm -e $protocol $host $port");}
    if ( $protocol eq "vnc") {exec("xterm -e vncviewer $host:$port");}
    
     
    
    exit;
    

3. For wireshark I wrote another script. I takes ssh connection to root account to unetlab machine so you need to change sshd settings (allow root access), then script

cat moz-capture.pl
#!/usr/bin/perl
# parse URL
($protocol,$host) = split /:\/\//, $ARGV[0];
($host,$port) = split /\//, $host;
 

# call terminal emulator
if ( $protocol eq "capture") {exec("xterm -e 'wireshark -k -i <(ssh $host -l root -i /id_rsa tcpdump -s 0 -U -n -w - -i $port)'");}

exit;

 

Запись опубликована в рубрике How to, linux с метками , . Добавьте в закладки постоянную ссылку.