
06/01/2009, 11:53
|
| | Fecha de Ingreso: febrero-2005
Mensajes: 37
Antigüedad: 20 años Puntos: 0 | |
Respuesta: Desactivar/Activar el FireWall de Windows y Obtener la IP Publica Para activar y desactivar el firewall de windows creo que esto te a va a poder ayudar: http://www.codeproject.com/KB/IP/ena..._firewall.aspx
Para el tema de saber la IP veamos si estos códigos te echan una mano; ya que me imagino que en muchos casos ese equipo se encontrará detrás de un router.
Código:
#include <wininet.h>
#include <stdio.h>
#define AUTHOR "da_cash"
CHAR buffer[100];
int i=75;
int main()
{
printf("+-----------------------+\n");
printf("+ WAN IP by %s/2k5 +\n",AUTHOR);
printf("+-----------------------+\n\n");
HINTERNET hINet, hFile;
CHAR buffer[100];
hINet = InternetOpen(AUTHOR, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0 );
if ( !hINet )
{
printf("Error getting WAN IP");
return;
}
hFile = InternetOpenUrl( hINet,"http://checkip.dyndns.org/" , NULL, 0, 0, 0 );
if ( hFile )
{
DWORD dwRead;
InternetReadFile( hFile, buffer, 100, &dwRead );
}
InternetCloseHandle( hFile );
InternetCloseHandle( hINet );
printf("WAN IP:");
while ((buffer[i] != 0x3C) && (i < sizeof(buffer)))
{
printf("%c",buffer[i]);
i++;
}
printf("\n");
return;
}
Código:
#!/bin/sh
#
# Script for getting an external WAN IP
#
URLS[0]="http://checkip.dyndns.org"
URLS[1]="http://whatismyip.com"
URLS[2]="http://www.whatismyipaddress.com"
URLS[3]="http://ipid.shat.net"
URLS[4]="http://www.edpsciences.com/htbin/ipaddress"
URLS[5]="http://www.showmyip.com"
for URL in ${URLS[@]}
do
THIS=${URL}
IP=`curl -s "${THIS}" | tr -cs '[0-9\.]' '\012' \
| awk -F'.' 'NF==4 && $1>0 && $1<256 && $2<256 && $3<256 && $4<256 && !/\.\./' | uniq`
if [ $? == 0 ]; then
IP=`echo $IP | awk '{print $1}'`
echo "Your WAN IP Address is: $IP"
exit
fi
done
Los tenía guardados
Última edición por Analyzer; 06/01/2009 a las 11:58 |