wwwoffle-users  

Re: [WWWOFFLE-Users] wwwoffle-fatso-finder

Micha
Wed, 15 Mar 2006 22:42:31 -0800


| Speaking about xmessage, say, perhaps you are interested in making
| this work.

No sorry, i never use this. But if you like to try yourself,
here is an example:

____________________________


#!/bin/bash

# hostinfo <ip:port>
#
# inform about an ip address by arpa reverse lookup and /etc/services
# optionally, launch ip in a browser or do nmap scan
# By now, the GUI is xmessage
#

( 

# ===== CONFIG

tmp=/tmp/hostinfo.tmp

# defaulz
ip=0.0.0.0
port=80
# main menu
buttons="    nmap  ,   whois,   browser,    OK    "
# nmap menu
title1="SYNSTEALTH"
nmap1="sudo nmap -sS -O -PI -PT"   
title2="CONNECT"
nmap2="sudo nmap -sT -O -PI -PT"
title3="HOSTLIST"
nmap3="sudo nmap -sL -PI -PT"
# whois server
whois_serv=whois.thur.de
# webbrowser
browser=dillo


# ===== FUNCTIONS

message ()      # message "buttons" "message"
                # returned $choice will be cleaned from spaces
{
choice=`xmessage -center -print -buttons "$1" "$2" | tr -d " "`
}



# ===== MAIN


# commandline

for param in $@; do

    case $param in
    
            -h) exec less $0;;
             *) ip_port=$param;;
    esac

    shift

done

# clean up string
ip_port=`echo $ip_port | tr -d " "`
ip_port=`echo $ip_port | sed s/\|//g`

# seperate ip and port
ip=`echo $ip_port | cut -f1 -d":"`
port=`echo $ip_port | cut -f2 -d":"`

# grep the port service from /etc/services 
service=`grep -m 1 "[[:blank:]]$port\/" /etc/services | cut -f2 -d "#"`

## debug 1; exit 0

# get domain from arpa reverse lookup
domain=`host $ip | tr " " "\\n" | tail -n1 | cut -f1-3 -d"."`

#
xmesg="
Domain: $domain
IP:            $ip
Port:        $port
Service: $service

"
message "$buttons" "$xmesg"

case $choice in
            
    nmap) # offer different nmap modes
          message "$title1  ,  $title2  ,  $title3" "          Which scan do 
you want ?         "
          case $choice in
            $title1) $nmap1 $ip | grep -v "Starting nmap" > $tmp;;
            $title2) $nmap2 $ip | grep -v "Starting nmap" > $tmp;;
            $title3) $nmap3 $ip | grep -v "Starting nmap" > $tmp;;
          esac
          echo -e "\n" >> $tmp
          exec xmessage -file $tmp &
       ;;
       

    whois) # query whois server about IP
          whois -h $whois_serv $ip > $tmp
          echo -e "\n" >> $tmp
          exec xmessage -file $tmp &
       ;;
       

 browser) exec $browser $ip
       ;;

esac

exit 0


)  &


____________________________

This is designed to be launched by mouseclick on an wmaker icon that 
passes the mouse selection to the script as [EMAIL PROTECTED] 
Or from commandline,
hostinfo 83.250.130.199:6346

If you need a user to do sth as root, you should try sudo.
/etc/sudoers examples,

User_Alias      STAFF = danny,wife      # fully trusted
User_Alias      LOGIN = STAFF, guest    # standard login privileges
Host_Alias      LOCAL = woody.lan0, woody.lan1
# commands
root ALL = ( ALL ) ALL 
LOGIN LOCAL = ( root ) PASSWD: /usr/local/bin/sendsleep
LOGIN LOCAL = ( root ) PASSWD: /usr/local/bin/tuneide
STAFF LOCAL = ( root ) PASSWD: /sbin/halt
STAFF LOCAL = ( root ) PASSWD: /usr/bin/multi-gnome-terminal
STAFF LOCAL = ( root ) PASSWD: /usr/bin/xlogmaster
STAFF LOCAL = ( root ) PASSWD: /usr/bin/gps
STAFF LOCAL = ( root ) PASSWD: /usr/bin/nmapfe
STAFF LOCAL = ( root ) PASSWD: /usr/bin/nmap
STAFF LOCAL = ( root ) PASSWD: /sbin/ifup
STAFF LOCAL = ( root ) PASSWD: /sbin/ifdown
STAFF LOCAL = ( root ) PASSWD: /etc/init.d/networking restart
STAFF LOCAL = ( root ) PASSWD: /usr/local/bin/packup

Then you can put something like 
alias nmap='sudo nmap' into users profile (best via ~/.alias or  .profile)
and call the command just as usual

   °
 /\/