Get my public IP mit netcat

Ich habe eine sehr einfache Linux-server läuft auf einer IP-Kamera (Busybox). Ich würde gerne die öffentliche IP der Kamera, die sich hinter einem router.
Es hat kein "wget" oder "traceroute" und "ping" ist nur die Antwort auf "lebendig" oder "nicht lebendig"...

Die einzige, die eine grundlegende "netcat" :

nc
BusyBox v1.1.3 (2009.12.07-16:16+0000) multi-call binary
Usage: nc [OPTIONS] [IP] [port]
Netcat opens a pipe to IP:port
Options:
        -l              listen mode, for inbound connects
        -p PORT         local port number
        -i SECS         delay interval for lines sent
        -w SECS         timeout for connects and final net reads
        -4              Use IPv4 (default)
        -6              Use IPv6
        -D DSCP         set IP DSCP field
        -P PRIO         set VLAN user-priority

Mein ISP erlaubt ausgehende HTTP -, ist es möglich, mit Hilfe von von netcat, um die öffentliche IP-Antwort von einer Website wie www.obtainip.com oder ähnlich ?

TOLL und vielen Dank an beide von Euch, wie ich fühlte mich nicht wohl mit nc-an alle.

Hier sind die 2 Arbeitsweisen :

echo "GET /automation/n09230945.asp HTTP/1.0" > http_req2.txt
echo "Host: www.whatismyip.com" >> http_req2.txt
echo "" >> http_req2.txt
echo "" >> http_req2.txt
IP2=$(cat http_req2.txt | nc www.whatismyip.com 80 | tail -n 1)
echo $IP2
YEAH !

mehr seltsam, aber... es funktioniert auch :

echo "GET /HTTP/1.0" > http_request.txt
echo "Host: www.whatismyip.com" >> http_request.txt
echo "User-Agent: netcat" >> http_request.txt
echo "Referer: http://www.whatismyip.com/" >> http_request.txt
echo "" >> http_request.txt
echo "" >> http_request.txt
IP=$(cat http_request.txt | nc www.whatismyipaddress.com 80 | tail -n 1)
echo $IP
YEAH again!

BEARBEITEN
Natürlich kann das Skript erstellt werden, besser wie vorgeschlagen :

echo -e "GET /automation/n09230945.asp HTTP/1.0\n"Host: www.whatismyip.com\n\n" | nc www.whatismyipaddress.com 80 | tail -n 1
  • Installieren Sie wget oder curl oder...?
  • hum ich kann nicht installieren Sie wget oder curl, sonst ich würde haben liebte dies zu tun.
InformationsquelleAutor hornetbzz | 2010-11-23
Schreibe einen Kommentar