Advertisement
Guest User

sshome

a guest
Sep 13th, 2010
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.61 KB | None | 0 0
  1. #!/bin/bash
  2. NAVIIP=`which naviip`
  3. NMAP=`which nmap`
  4.  
  5. echo -n "Retrieving your homebox IP through gmail: "
  6. IP=`$NAVIIP`
  7.  
  8. if [ -n "$IP" ] && [ "$IP" != '\n' ]; then
  9.    echo -en "$IP\nScanning the service behind secret port: "
  10.    SCAN=` $NMAP -sV -p2247 $IP | sed '/2247/!d' `
  11.    STATE=` echo $SCAN | awk '{print $2}' `
  12.    SERVICE=` echo $SCAN | awk '{print $4" "$5}'`
  13.    echo $SERVICE $STATE
  14.  
  15.    if [ "$STATE" = "open" ]; then
  16.       echo "Proceeding with ssh connection: "
  17.       ssh -l zeh -p 2247 $IP
  18.    fi
  19. else
  20.    echo -e "FAILED.\nSorry, I could not retrieve your IP"
  21.    echo "Exiting..."
  22. fi
  23.  
  24. # EOF #
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement