Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
come faccio a sapere il mio ip da non-root? [RISOLTO]
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Forum di discussione italiano
View previous topic :: View next topic  
Author Message
assente
Guru
Guru


Joined: 12 Apr 2004
Posts: 570
Location: Torino, italia, New Europe

PostPosted: Sun May 29, 2005 10:33 am    Post subject: come faccio a sapere il mio ip da non-root? [RISOLTO] Reply with quote

ifconfig ppp0 funziona solo da root, senza cambiare i permessi come posso accedere a questa info?
Grazie 1000
_________________
Blog
E8400, 4850, P5q


Last edited by assente on Sun May 29, 2005 10:40 am; edited 1 time in total
Back to top
View user's profile Send private message
comio
Advocate
Advocate


Joined: 03 Jul 2003
Posts: 2191
Location: Taranto

PostPosted: Sun May 29, 2005 10:35 am    Post subject: Re: come faccio a sapere il mio ip da non-root? Reply with quote

assente wrote:
ifconfig ppp0 funziona solo da root, senza cambiare i permessi come posso accedere a questa info?
Grazie 1000


prova a scrivere /sbin/ifconfig ;)

ciao
_________________
RTFM!!!!

e

http://www.comio.it
:)
Back to top
View user's profile Send private message
assente
Guru
Guru


Joined: 12 Apr 2004
Posts: 570
Location: Torino, italia, New Europe

PostPosted: Sun May 29, 2005 10:40 am    Post subject: Reply with quote

mappork! ero convinto che ifconfig lo potesse solo usare root
_________________
Blog
E8400, 4850, P5q
Back to top
View user's profile Send private message
lavish
Bodhisattva
Bodhisattva


Joined: 13 Sep 2004
Posts: 4296

PostPosted: Sun May 29, 2005 10:46 am    Post subject: Reply with quote

Puoi anche dare un:
Code:
wget -O - http://www.whatismyip.org 2> /dev/null
;)
_________________
minimalblue.com | secgroup.github.io/
Back to top
View user's profile Send private message
comio
Advocate
Advocate


Joined: 03 Jul 2003
Posts: 2191
Location: Taranto

PostPosted: Sun May 29, 2005 11:21 am    Post subject: Reply with quote

lavish wrote:
Puoi anche dare un:
Code:
wget -O - http://www.whatismyip.org 2> /dev/null
;)
se è dietro un nat non funziona :D

ciao
_________________
RTFM!!!!

e

http://www.comio.it
:)
Back to top
View user's profile Send private message
stefanonafets
l33t
l33t


Joined: 10 Feb 2003
Posts: 644

PostPosted: Sun May 29, 2005 2:26 pm    Post subject: Reply with quote

Non credo che lo sia, cisto che l'interfaccia che usa è PPP, anche se teoricamente potrebbe...
_________________
registered Linux user number #411324
sed 's/ke/che/g'

<The Deployment Slave is initializing>
Back to top
View user's profile Send private message
ProT-0-TypE
Veteran
Veteran


Joined: 20 Dec 2003
Posts: 1624
Location: Cagliari

PostPosted: Sun May 29, 2005 2:59 pm    Post subject: Reply with quote

comio wrote:
lavish wrote:
Puoi anche dare un:
Code:
wget -O - http://www.whatismyip.org 2> /dev/null
;)
se è dietro un nat non funziona :D

ciao


io sono dietro nat e funziona :-|

EDIT: mi sa che tu intendevi un'altra cosa :-D
_________________
[Vuoi guadagnare navigando?]
Back to top
View user's profile Send private message
gutter
Bodhisattva
Bodhisattva


Joined: 13 Mar 2004
Posts: 7162
Location: Aarau, Aargau, Switzerland

PostPosted: Sun May 29, 2005 3:29 pm    Post subject: Reply with quote

ProT-0-TypE wrote:

io sono dietro nat e funziona :-|

EDIT: mi sa che tu intendevi un'altra cosa :-D


Dipende da che indirizzo vuoi conoscere ;)
_________________
Registered as User #281564 and Machines #163761
Back to top
View user's profile Send private message
ProT-0-TypE
Veteran
Veteran


Joined: 20 Dec 2003
Posts: 1624
Location: Cagliari

PostPosted: Sun May 29, 2005 3:31 pm    Post subject: Reply with quote

gutter wrote:
ProT-0-TypE wrote:

io sono dietro nat e funziona :-|

EDIT: mi sa che tu intendevi un'altra cosa :-D


Dipende da che indirizzo vuoi conoscere ;)


si infatti :-D

a me solitamente server conoscere quello del router
_________________
[Vuoi guadagnare navigando?]
Back to top
View user's profile Send private message
stefanonafets
l33t
l33t


Joined: 10 Feb 2003
Posts: 644

PostPosted: Sun May 29, 2005 6:53 pm    Post subject: Reply with quote

cmq wget è un pò pesante per quel lavoro (pesante fra virgolette), esiste un altro programmino per fare delle GET http + leggero, del quale però nn mi ricordo il nome (sorry,nn ho la mia gentoo sotto mano...)
_________________
registered Linux user number #411324
sed 's/ke/che/g'

<The Deployment Slave is initializing>
Back to top
View user's profile Send private message
lavish
Bodhisattva
Bodhisattva


Joined: 13 Sep 2004
Posts: 4296

PostPosted: Sun May 29, 2005 7:11 pm    Post subject: Reply with quote

comio wrote:
se è dietro un nat non funziona :D

Sì ma dipende cosa ti interessa... di solito serve conoscere quello con il quale si "esce", quello del router quindi. Se si vuole conoscere il proprio ip nella lan.. beh... è un altro paio di maniche, decisamente :D
_________________
minimalblue.com | secgroup.github.io/
Back to top
View user's profile Send private message
assente
Guru
Guru


Joined: 12 Apr 2004
Posts: 570
Location: Torino, italia, New Europe

PostPosted: Sun May 29, 2005 8:05 pm    Post subject: Reply with quote

Anche se ho risolto, mi chiedo.. se qualcuno non usa ppp0, ma ethX,.. per accedere ad internet, c'è un modo per sapere qual'è l'ip con cui si esce? Ovviamente senza passare per siti esterni :wink:
_________________
Blog
E8400, 4850, P5q
Back to top
View user's profile Send private message
Cazzantonio
Bodhisattva
Bodhisattva


Joined: 20 Mar 2004
Posts: 4514
Location: Somewere around the world

PostPosted: Sun May 29, 2005 8:22 pm    Post subject: Reply with quote

assente wrote:
Anche se ho risolto, mi chiedo.. se qualcuno non usa ppp0, ma ethX,.. per accedere ad internet, c'è un modo per sapere qual'è l'ip con cui si esce? Ovviamente senza passare per siti esterni :wink:

Io utilizzo questo script in cron per scaricare la pagina dell'interfaccia web del mio router (che contiene l'ip), per estrarre l'ip, confrontarlo con il vecchio per vedere se è cambiato ed eventualmente spedirmelo su gmail... magari è utile a qualcuno :roll:
(ovviamente l'indirizzo della pagina e il tipo di "trattamento" per estrarre l'ip, riga 16 dello script, può variare da router a router... fate le vostre opportune modifiche... il mio è un netgear DG834G)
(se qualcuno si sta chiedendo perché lo script scarica 2 volte la pagina dopo una pausa è perché a volte alla prima non la scarica... boh...)

Code:
#!/bin/bash

INDIRIZZOMAIL=<mioindirizzomail>
USER_ROUTER=<user per accedere al router>
PASSWORD_ROUTER=<password per accedere al router>

if [ `ping 192.168.1.1 -c1 |grep Unreachable|wc -l` -eq 0 ]
then
  echo "getting ip address from router"
  wget --http-user=$USER_ROUTER --http-passwd=$PASSWORD_ROUTER http://192.168.1.1/setup.cgi?next_file=s_status.htm -O /root/logs/myip.htm &>/dev/null
  sleep 2s
  wget --http-user=$USER_ROUTER --http-passwd=$PASSWORD_ROUTER http://192.168.1.1/setup.cgi?next_file=s_status.htm -O /root/logs/myip.htm &>/dev/null
 
 cat /root/logs/myip.htm|grep "Porta ADSL" -A 9|tail -n1|cut -f2 -d">"|cut -f1 -d"<" >> /root/logs/myip

  if [ `/usr/bin/tail -n 2 /root/logs/myip|head -n1|wc -l` -eq 1 ]
  then
    OLDIP=$(/usr/bin/tail -n 2 /root/logs/myip|head -n1)
  fi
  NEWIP=$(/usr/bin/tail -n 1 /root/logs/myip)
  echo $OLDIP > /root/logs/myip
  echo $NEWIP >> /root/logs/myip
  fi

if [ `/usr/bin/tail -n 2 /root/logs/myip |head -n1` != `/usr/bin/tail -n 1 /root/logs/myip` ]
then
  echo "the ip address has changed" >> /var/log/syslog
  echo "mailing new ip address to $INDIRIZZOMAIL" >> /var/log/syslog
  cat /root/logs/myip |mail $INDIRIZZOMAIL -s cambio_indirizzo
fi

_________________
Any mans death diminishes me, because I am involved in Mankinde; and therefore never send to know for whom the bell tolls; It tolls for thee.
-John Donne
Back to top
View user's profile Send private message
lavish
Bodhisattva
Bodhisattva


Joined: 13 Sep 2004
Posts: 4296

PostPosted: Sun May 29, 2005 8:57 pm    Post subject: Reply with quote

Questo invece è il semplice script che ho scritto per essere avvisato del cambio di ip via sms. Necessita di smssend ;)

Code:

#!/bin/sh
#
#
# SMS-CheckIP V. 1.0
#
#
#------------------------

# Define your variables here:

company=""
user=""
password=""
tel_number=""

ipNew=`wget -O - http://www.whatismyip.org 2> /dev/null`

if [ ! -f /tmp/ip ]
   then
      echo 0.0.0.0 > /tmp/ip
fi

ipOld=`cat /tmp/ip`

if [ $ipNew != $ipOld ]
   then
      smssend $company $user $password $tel_number "I've just changed ip. $ipNew replaced $ipOld"
      echo $ipNew > /tmp/ip
fi

_________________
minimalblue.com | secgroup.github.io/


Last edited by lavish on Tue Dec 13, 2005 10:22 am; edited 1 time in total
Back to top
View user's profile Send private message
neryo
Veteran
Veteran


Joined: 09 Oct 2004
Posts: 1292
Location: Ferrara, Italy, Europe

PostPosted: Mon May 30, 2005 3:58 pm    Post subject: Reply with quote

Cazzantonio wrote:
assente wrote:
Anche se ho risolto, mi chiedo.. se qualcuno non usa ppp0, ma ethX,.. per accedere ad internet, c'è un modo per sapere qual'è l'ip con cui si esce? Ovviamente senza passare per siti esterni :wink:

Io utilizzo questo script in cron per scaricare la pagina dell'interfaccia web del mio router (che contiene l'ip), per estrarre l'ip, confrontarlo con il vecchio per vedere se è cambiato ed eventualmente spedirmelo su gmail... magari è utile a qualcuno :roll:
(ovviamente l'indirizzo della pagina e il tipo di "trattamento" per estrarre l'ip, riga 16 dello script, può variare da router a router... fate le vostre opportune modifiche... il mio è un netgear DG834G)
(se qualcuno si sta chiedendo perché lo script scarica 2 volte la pagina dopo una pausa è perché a volte alla prima non la scarica... boh...)


geniale... molto utile! :wink:
_________________
cache: a safe place for hiding or storing things..

D-link DWL-G650 AirPlus
Apache Php Mysql
Back to top
View user's profile Send private message
Cazzantonio
Bodhisattva
Bodhisattva


Joined: 20 Mar 2004
Posts: 4514
Location: Somewere around the world

PostPosted: Mon May 30, 2005 4:27 pm    Post subject: Reply with quote

neryo wrote:
geniale... molto utile! :wink:

Sono contento che ti piaccia :D
non so se può funzionare su tutti i router :roll:
_________________
Any mans death diminishes me, because I am involved in Mankinde; and therefore never send to know for whom the bell tolls; It tolls for thee.
-John Donne
Back to top
View user's profile Send private message
fejfbo
Guru
Guru


Joined: 30 May 2005
Posts: 407
Location: Milano - Italy

PostPosted: Tue Dec 13, 2005 8:57 am    Post subject: [OT] script per sapere Ip Reply with quote

Ciao a tutti.

Esiste un modo per sapere qual'è l'ip che prende il mio router Adsl e salvarlo in una variabile?

Mi sarebbe comodo per inviarlo poi automaticamente, ogni tot di tempo, tramite un sms al cellulare per tenere sott'occhio la connessione ad Internet.

Se non mi sono spiegato bene, sono pronto a dare delucidazioni.
Back to top
View user's profile Send private message
Peach
Advocate
Advocate


Joined: 08 Mar 2003
Posts: 3686
Location: London, UK

PostPosted: Tue Dec 13, 2005 9:25 am    Post subject: Re: [OT] script per sapere Ip Reply with quote

fejfbo wrote:
il mio router Adsl

ciao, scusa potresti essere preciso?

il tuo router Adsl è... ? un carciofo! :-P
_________________
Gentoo user since 2004.
"It's all fun and games, until someone loses an eye" - mom
Back to top
View user's profile Send private message
makoomba
Bodhisattva
Bodhisattva


Joined: 03 Jun 2004
Posts: 1856

PostPosted: Tue Dec 13, 2005 9:29 am    Post subject: Reply with quote

Code:
wget -O /dev/stdout http://www.whatismyip.com 2>/dev/null| grep '<TITLE>' | perl -ne '/(\d+\.\d+\.\d+\.\d+)/ && print $1'

_________________
When all else fails, read the instructions.
Back to top
View user's profile Send private message
fejfbo
Guru
Guru


Joined: 30 May 2005
Posts: 407
Location: Milano - Italy

PostPosted: Tue Dec 13, 2005 9:33 am    Post subject: Reply with quote

makoomba wrote:
Code:
wget -O /dev/stdout http://www.whatismyip.com 2>/dev/null| grep '<TITLE>' | perl -ne '/(\d+\.\d+\.\d+\.\d+)/ && print $1'


Scusa l'ignoranza...

Così facendo viene salvato nella variabile $1?
Back to top
View user's profile Send private message
Peach
Advocate
Advocate


Joined: 08 Mar 2003
Posts: 3686
Location: London, UK

PostPosted: Tue Dec 13, 2005 9:33 am    Post subject: Reply with quote

makoomba wrote:
Code:
wget -O /dev/stdout http://www.whatismyip.com 2>/dev/null| grep '<TITLE>' | perl -ne '/(\d+\.\d+\.\d+\.\d+)/ && print $1'

dimenticavo che cmq si è visti da fuori coll'ip del router :-P
ottima solution
_________________
Gentoo user since 2004.
"It's all fun and games, until someone loses an eye" - mom
Back to top
View user's profile Send private message
makoomba
Bodhisattva
Bodhisattva


Joined: 03 Jun 2004
Posts: 1856

PostPosted: Tue Dec 13, 2005 9:39 am    Post subject: Reply with quote

fejfbo wrote:
Così facendo viene salvato nella variabile $1?

no, quella è una variabile di perl utilizzata per stampare solo l'ip
puoi utilizzarlo in uno script così
Code:
#!/bin/bash
myip=`wget -O /dev/stdout http://www.whatismyip.com 2>/dev/null| grep '<TITLE>' | perl -ne '/(\d+\.\d+\.\d+\.\d+)/ && print $1'`
echo "l'ip è $myip"

_________________
When all else fails, read the instructions.
Back to top
View user's profile Send private message
fejfbo
Guru
Guru


Joined: 30 May 2005
Posts: 407
Location: Milano - Italy

PostPosted: Tue Dec 13, 2005 9:40 am    Post subject: Reply with quote

Grazie mille!!!


Poi troverò la soluzione per inserirla in un messaggio da mandare tramite smssend :wink:
Back to top
View user's profile Send private message
lavish
Bodhisattva
Bodhisattva


Joined: 13 Sep 2004
Posts: 4296

PostPosted: Tue Dec 13, 2005 10:18 am    Post subject: Reply with quote

[MOD]
Fatto il merge del thread aperto da fejfbo con questo
[/MOD]

Ho editato anche il mio script che avevo precedentemente postato per segnalare via SMS i cambianeti del proprio IP (con smssend eheh) :)
_________________
minimalblue.com | secgroup.github.io/
Back to top
View user's profile Send private message
lavish
Bodhisattva
Bodhisattva


Joined: 13 Sep 2004
Posts: 4296

PostPosted: Tue Dec 13, 2005 10:24 am    Post subject: Reply with quote

Moved from Forum italiano (Italian) to Forum di discussione italiano.
_________________
minimalblue.com | secgroup.github.io/
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Forum di discussione italiano All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum