Help socket - 17/11/14 08:05 PM
I need to modify this code:
I think the wrong line is:
With this code I want extract Ip data from the web: http://geoip.flagfox.net/
Example: 186.127.20.22
/ip 186.127.20.22
Result:
Expected result:
Hostname: host220.186-127-20.telecom.net.ar
Continent: South America
Country: Argentina
Region: Unknown
City: Unknown
IP:186.127.20.22
ISP: Telecom Argentina S.A. (AS7303)
Country Code:AR (ARG)
Code:
alias ip { if ($1 == $null) { echo -a 10 You must enter the IP address to find, in this format 12 $+ /ip 111.111.111.111 | return } if ($sock(InfoIP) != $null) sockclose InfoIP set %InfoIP $1 sockopen InfoIP geoip.flagfox.net 80 echo -ae 9,1Seeking information of IP: %InfoIP } on 1:sockopen:InfoIP: { if ($sockerr > 0) { echo -a 9,1Could not connect to the page. } else { sockwrite -nt $sockname GET geoip.flagfox.net $+ %InfoIP $+ &ip= $+ %InfoIP HTTP/1.1 sockwrite -nt $sockname Host: geoip.flagfox.net:80 sockwrite -nt $sockname Connection: close sockwrite -nt $sockname $crlf } } on 1:sockread:InfoIP: { :VerInfoIP sockread -f %DatosIP if ($sockbr == 0) { return } if (<title> isin %DatosIP) { echo -ae 5Title: $gettok($gettok(%DatosIP,2,62),1,60) } if (Hostname isin %DatosIP) echo -a 12Hostname:1 $gettok(%DatosIP,2,58) if (Continent isin %DatosIP) echo -a 12Continent:1 $gettok(%DatosIP,2,58) if (Country isin %DatosIP) echo -a 12Country:1 $gettok(%DatosIP,2,58) if (Metropolis isin %DatosIP) echo -a 12Metropolis:1 $gettok(%DatosIP,2,58) if (City isin %DatosIP) echo -a 12City:1 $gettok(%DatosIP,2,58) if (IP Address isin %DatosIP) echo -a 12IP:1 $gettok(%DatosIP,2,58) if (ISP isin %DatosIP) echo -a 12ISP:1 $gettok(%DatosIP,2,58) if (Country Code isin %DatosIP) echo -a 12Country Code:1 $gettok(%DatosIP,2,58) goto VerInfoIP } on 1:sockclose:InfoIP: { echo -a 4Search Completed! }
I think the wrong line is:
Code:
sockwrite -nt $sockname GET geoip.flagfox.net $+ %InfoIP $+ &ip= $+ %InfoIP HTTP/1.1
With this code I want extract Ip data from the web: http://geoip.flagfox.net/
Example: 186.127.20.22
/ip 186.127.20.22
Result:
Quote:
Title: 400 Bad Request
Expected result:
Quote:
Hostname: host220.186-127-20.telecom.net.ar
Continent: South America
Country: Argentina
Region: Unknown
City: Unknown
IP:186.127.20.22
ISP: Telecom Argentina S.A. (AS7303)
Country Code:AR (ARG)