View previous topic :: View next topic |
Author |
Message |
assente Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/167949243540c5ac7d7b247.png)
Joined: 12 Apr 2004 Posts: 570 Location: Torino, italia, New Europe
|
Posted: Sun May 29, 2005 10:33 am Post subject: come faccio a sapere il mio ip da non-root? [RISOLTO] |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
comio Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
![](images/avatars/761284344415a971047e47.gif)
Joined: 03 Jul 2003 Posts: 2191 Location: Taranto
|
Posted: Sun May 29, 2005 10:35 am Post subject: Re: come faccio a sapere il mio ip da non-root? |
|
|
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
![Smile :)](images/smiles/icon_smile.gif) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
assente Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/167949243540c5ac7d7b247.png)
Joined: 12 Apr 2004 Posts: 570 Location: Torino, italia, New Europe
|
Posted: Sun May 29, 2005 10:40 am Post subject: |
|
|
mappork! ero convinto che ifconfig lo potesse solo usare root _________________ Blog
E8400, 4850, P5q |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
lavish Bodhisattva
![Bodhisattva Bodhisattva](/images/ranks/rank-bodhisattva.gif)
Joined: 13 Sep 2004 Posts: 4296
|
Posted: Sun May 29, 2005 10:46 am Post subject: |
|
|
Puoi anche dare un:
Code: | wget -O - http://www.whatismyip.org 2> /dev/null | ![Wink ;)](images/smiles/icon_wink.gif) _________________ minimalblue.com | secgroup.github.io/ |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
comio Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
![](images/avatars/761284344415a971047e47.gif)
Joined: 03 Jul 2003 Posts: 2191 Location: Taranto
|
Posted: Sun May 29, 2005 11:21 am Post subject: |
|
|
lavish wrote: | Puoi anche dare un:
Code: | wget -O - http://www.whatismyip.org 2> /dev/null | ![Wink ;)](images/smiles/icon_wink.gif) | se è dietro un nat non funziona
ciao _________________ RTFM!!!!
e
http://www.comio.it
![Smile :)](images/smiles/icon_smile.gif) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
stefanonafets l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
![](images/avatars/419971626410bbd508e677.gif)
Joined: 10 Feb 2003 Posts: 644
|
Posted: Sun May 29, 2005 2:26 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
ProT-0-TypE Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/773882800405da1ca5557e.jpg)
Joined: 20 Dec 2003 Posts: 1624 Location: Cagliari
|
Posted: Sun May 29, 2005 2:59 pm Post subject: |
|
|
comio wrote: | lavish wrote: | Puoi anche dare un:
Code: | wget -O - http://www.whatismyip.org 2> /dev/null | ![Wink ;)](images/smiles/icon_wink.gif) | se è dietro un nat non funziona
ciao |
io sono dietro nat e funziona
EDIT: mi sa che tu intendevi un'altra cosa ![Very Happy :-D](images/smiles/icon_biggrin.gif) _________________ [Vuoi guadagnare navigando?] |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
gutter Bodhisattva
![Bodhisattva Bodhisattva](/images/ranks/rank-bodhisattva.gif)
![](images/avatars/67030318436dd16c1dd5e.jpg)
Joined: 13 Mar 2004 Posts: 7162 Location: Aarau, Aargau, Switzerland
|
Posted: Sun May 29, 2005 3:29 pm Post subject: |
|
|
ProT-0-TypE wrote: |
io sono dietro nat e funziona
EDIT: mi sa che tu intendevi un'altra cosa ![Very Happy :-D](images/smiles/icon_biggrin.gif) |
Dipende da che indirizzo vuoi conoscere ![Wink ;)](images/smiles/icon_wink.gif) _________________ Registered as User #281564 and Machines #163761 |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
ProT-0-TypE Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/773882800405da1ca5557e.jpg)
Joined: 20 Dec 2003 Posts: 1624 Location: Cagliari
|
Posted: Sun May 29, 2005 3:31 pm Post subject: |
|
|
gutter wrote: | ProT-0-TypE wrote: |
io sono dietro nat e funziona
EDIT: mi sa che tu intendevi un'altra cosa ![Very Happy :-D](images/smiles/icon_biggrin.gif) |
Dipende da che indirizzo vuoi conoscere ![Wink ;)](images/smiles/icon_wink.gif) |
si infatti
a me solitamente server conoscere quello del router _________________ [Vuoi guadagnare navigando?] |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
stefanonafets l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
![](images/avatars/419971626410bbd508e677.gif)
Joined: 10 Feb 2003 Posts: 644
|
Posted: Sun May 29, 2005 6:53 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
lavish Bodhisattva
![Bodhisattva Bodhisattva](/images/ranks/rank-bodhisattva.gif)
Joined: 13 Sep 2004 Posts: 4296
|
Posted: Sun May 29, 2005 7:11 pm Post subject: |
|
|
comio wrote: | se è dietro un nat non funziona ![Very Happy :D](images/smiles/icon_biggrin.gif) |
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 ![Very Happy :D](images/smiles/icon_biggrin.gif) _________________ minimalblue.com | secgroup.github.io/ |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
assente Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/167949243540c5ac7d7b247.png)
Joined: 12 Apr 2004 Posts: 570 Location: Torino, italia, New Europe
|
Posted: Sun May 29, 2005 8:05 pm Post subject: |
|
|
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 :wink:](images/smiles/icon_wink.gif) _________________ Blog
E8400, 4850, P5q |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Cazzantonio Bodhisattva
![Bodhisattva Bodhisattva](/images/ranks/rank-bodhisattva.gif)
![](images/avatars/195356323743686d76373d8.jpg)
Joined: 20 Mar 2004 Posts: 4514 Location: Somewere around the world
|
Posted: Sun May 29, 2005 8:22 pm Post subject: |
|
|
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 :wink:](images/smiles/icon_wink.gif) |
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
(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 |
|
![](templates/gentoo/images/spacer.gif) |
lavish Bodhisattva
![Bodhisattva Bodhisattva](/images/ranks/rank-bodhisattva.gif)
Joined: 13 Sep 2004 Posts: 4296
|
Posted: Sun May 29, 2005 8:57 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
neryo Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/gallery/Funny_Figure/klo.gif)
Joined: 09 Oct 2004 Posts: 1292 Location: Ferrara, Italy, Europe
|
Posted: Mon May 30, 2005 3:58 pm Post subject: |
|
|
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 :wink:](images/smiles/icon_wink.gif) |
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
(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 :wink:](images/smiles/icon_wink.gif) _________________ cache: a safe place for hiding or storing things..
D-link DWL-G650 AirPlus
Apache Php Mysql |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Cazzantonio Bodhisattva
![Bodhisattva Bodhisattva](/images/ranks/rank-bodhisattva.gif)
![](images/avatars/195356323743686d76373d8.jpg)
Joined: 20 Mar 2004 Posts: 4514 Location: Somewere around the world
|
Posted: Mon May 30, 2005 4:27 pm Post subject: |
|
|
neryo wrote: | geniale... molto utile! ![Wink :wink:](images/smiles/icon_wink.gif) |
Sono contento che ti piaccia
non so se può funzionare su tutti i router ![Rolling Eyes :roll:](images/smiles/icon_rolleyes.gif) _________________ 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 |
|
![](templates/gentoo/images/spacer.gif) |
fejfbo Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/gallery/Blade Runner/movie_blade_runner_howl.gif)
Joined: 30 May 2005 Posts: 407 Location: Milano - Italy
|
Posted: Tue Dec 13, 2005 8:57 am Post subject: [OT] script per sapere Ip |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
Peach Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
![](images/avatars/113917422347ec3b2cbcf21.gif)
Joined: 08 Mar 2003 Posts: 3686 Location: London, UK
|
Posted: Tue Dec 13, 2005 9:25 am Post subject: Re: [OT] script per sapere Ip |
|
|
fejfbo wrote: | il mio router Adsl |
ciao, scusa potresti essere preciso?
il tuo router Adsl è... ? un carciofo! ![Razz :-P](images/smiles/icon_razz.gif) _________________ Gentoo user since 2004.
"It's all fun and games, until someone loses an eye" - mom |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
makoomba Bodhisattva
![Bodhisattva Bodhisattva](/images/ranks/rank-bodhisattva.gif)
![](images/avatars/54100765943a2d293cd61e.jpg)
Joined: 03 Jun 2004 Posts: 1856
|
Posted: Tue Dec 13, 2005 9:29 am Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
fejfbo Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/gallery/Blade Runner/movie_blade_runner_howl.gif)
Joined: 30 May 2005 Posts: 407 Location: Milano - Italy
|
Posted: Tue Dec 13, 2005 9:33 am Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
Peach Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
![](images/avatars/113917422347ec3b2cbcf21.gif)
Joined: 08 Mar 2003 Posts: 3686 Location: London, UK
|
Posted: Tue Dec 13, 2005 9:33 am Post subject: |
|
|
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
ottima solution _________________ Gentoo user since 2004.
"It's all fun and games, until someone loses an eye" - mom |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
makoomba Bodhisattva
![Bodhisattva Bodhisattva](/images/ranks/rank-bodhisattva.gif)
![](images/avatars/54100765943a2d293cd61e.jpg)
Joined: 03 Jun 2004 Posts: 1856
|
Posted: Tue Dec 13, 2005 9:39 am Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
fejfbo Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/gallery/Blade Runner/movie_blade_runner_howl.gif)
Joined: 30 May 2005 Posts: 407 Location: Milano - Italy
|
Posted: Tue Dec 13, 2005 9:40 am Post subject: |
|
|
Grazie mille!!!
Poi troverò la soluzione per inserirla in un messaggio da mandare tramite smssend ![Wink :wink:](images/smiles/icon_wink.gif) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
lavish Bodhisattva
![Bodhisattva Bodhisattva](/images/ranks/rank-bodhisattva.gif)
Joined: 13 Sep 2004 Posts: 4296
|
Posted: Tue Dec 13, 2005 10:18 am Post subject: |
|
|
[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) ![Smile :)](images/smiles/icon_smile.gif) _________________ minimalblue.com | secgroup.github.io/ |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
lavish Bodhisattva
![Bodhisattva Bodhisattva](/images/ranks/rank-bodhisattva.gif)
Joined: 13 Sep 2004 Posts: 4296
|
Posted: Tue Dec 13, 2005 10:24 am Post subject: |
|
|
Moved from Forum italiano (Italian) to Forum di discussione italiano. _________________ minimalblue.com | secgroup.github.io/ |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|