elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Security Series.XSS. [Cross Site Scripting]


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  Crea tu propio Ip-Checker [VB+PHP]
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Crea tu propio Ip-Checker [VB+PHP]  (Leído 2,479 veces)
Karcrack


Desconectado Desconectado

Mensajes: 2.416


Se siente observado ¬¬'


Ver Perfil
Crea tu propio Ip-Checker [VB+PHP]
« en: 2 Julio 2008, 17:12 pm »

Bueno, como dice el titulo con el siguiente metodo puedes obtener tu Ip externa como si del DynDNS se tratara. Lo primero sera subir el fichero *.PHP a un servidor que sea compatible con el PHP.



PHP:
Código
  1. /* Esta es una pequeña funcion que devuleve la IP
  2.   Actual siempre y cuando se navege desde el navegador 'karcrack'
  3. */
  4. <?PHP
  5. $Nav = $_SERVER['HTTP_USER_AGENT'];
  6. if ($Nav == "karcrack")
  7. {
  8. echo $_SERVER['REMOTE_ADDR'];
  9. }
  10. else
  11. {
  12. echo '127.0.0.1';
  13. }
  14. ?>

Esta funcion comprueba que el navegador con el que se navega sea 'karcrack', por supuesto esto se puede modificar :xD



VB:
Código
  1. 'Esto se pone siempre xD
  2. Option Explicit
  3. 'Se declara el Objecto.
  4. Public WinHttp As Object
  5. 'Se declaran las constantes para la configuracion del WinHttp
  6. Public Const WinHttpRequestOption_EnableHttp1_1 As Long = 17
  7. Public Const WinHttpRequestOption_EnableHttpsToHttpRedirects As Long = 12
  8. Public Const WinHttpRequestOption_EnableRedirects As Long = 6
  9. Public Const WinHttpRequestOption_UserAgentString As Long = 0
  10. Public Const HTTPREQUEST_PROXYSETTING_DIRECT As Long = 1
  11.  
  12. 'Esta funcion configura el WinHttp con las opciones mas habituales...
  13. Public Sub SetHTTPLib()
  14.    'Se vacia el objecto.
  15.    Set WinHttp = Nothing
  16.    'Se carga el objecto
  17.    Set WinHttp = CreateObject("WinHttp.WinHttpRequest.5.1")
  18.    With WinHttp
  19.        'Permite la version del protocolo http 1.1
  20.        .Option(WinHttpRequestOption_EnableHttp1_1) = True
  21.        'Permite la redireccion de https:// a http://
  22.        .Option(WinHttpRequestOption_EnableHttpsToHttpRedirects) = True
  23.        'Permite las demas redirecciones
  24.        .Option(WinHttpRequestOption_EnableRedirects) = True
  25.        'Modifica el Navegador, para que nuestro script PHP sepa que somos notros :D
  26.        .Option(WinHttpRequestOption_UserAgentString) = "karcrack"
  27.        'Desactiva el proxy.
  28.        .SetProxy HTTPREQUEST_PROXYSETTING_DIRECT
  29.    End With
  30. End Sub
  31.  
  32. Public Function ObIP(ByVal URL As String) As String
  33.    Call SetHTTPLib
  34.    With WinHttp
  35.        'Se conecta.
  36.        .Open "GET", URL
  37.        'Pide la IP
  38.        .Send
  39.        'La obtiene
  40.        ObIP = .ResponseText
  41.    End With
  42. End Function

Bueno, aqui esta todo bien explicado... la funcion se llama de esta forma:
Código
  1. msgbox ObIp ("URL_DONDE_ESTA_EL_SCRIPT_EN_PHP")



Saludos :D


« Última modificación: 2 Julio 2008, 17:14 pm por Karcrack » En línea

krackwar


Desconectado Desconectado

Mensajes: 900


Ver Perfil
Re: Crea tu propio Ip-Checker [VB+PHP]
« Respuesta #1 en: 2 Julio 2008, 19:07 pm »

Gracias , por el aporte.

Otro metodo de la api guide es:

Código
  1. 'In a form
  2. Private Sub Form_Load()
  3.    'KPD-Team 1999
  4.    'URL: http://www.allapi.net/
  5.    'E-Mail: KPDTeam@Allapi.net
  6.    MsgBox "IP-address: " + GetIPAddress
  7. End Sub
  8.  

Código
  1. 'In a module
  2. Public Const MIN_SOCKETS_REQD As Long = 1
  3. Public Const WS_VERSION_REQD As Long = &H101
  4. Public Const WS_VERSION_MAJOR As Long = WS_VERSION_REQD \ &H100 And &HFF&
  5. Public Const WS_VERSION_MINOR As Long = WS_VERSION_REQD And &HFF&
  6. Public Const SOCKET_ERROR As Long = -1
  7. Public Const WSADESCRIPTION_LEN = 257
  8. Public Const WSASYS_STATUS_LEN = 129
  9. Public Const MAX_WSADescription = 256
  10. Public Const MAX_WSASYSStatus = 128
  11. Public Type WSAData
  12.    wVersion As Integer
  13.    wHighVersion As Integer
  14.    szDescription(0 To MAX_WSADescription) As Byte
  15.    szSystemStatus(0 To MAX_WSASYSStatus) As Byte
  16.    wMaxSockets As Integer
  17.    wMaxUDPDG As Integer
  18.    dwVendorInfo As Long
  19. End Type
  20. Type WSADataInfo
  21.    wVersion As Integer
  22.    wHighVersion As Integer
  23.    szDescription As String * WSADESCRIPTION_LEN
  24.    szSystemStatus As String * WSASYS_STATUS_LEN
  25.    iMaxSockets As Integer
  26.    iMaxUdpDg As Integer
  27.    lpVendorInfo As String
  28. End Type
  29. Public Type HOSTENT
  30.    hName As Long
  31.    hAliases As Long
  32.    hAddrType As Integer
  33.    hLen As Integer
  34.    hAddrList As Long
  35. End Type
  36. Declare Function WSAStartupInfo Lib "WSOCK32" Alias "WSAStartup" (ByVal wVersionRequested As Integer, lpWSADATA As WSADataInfo) As Long
  37. Declare Function WSACleanup Lib "WSOCK32" () As Long
  38. Declare Function WSAGetLastError Lib "WSOCK32" () As Long
  39. Declare Function WSAStartup Lib "WSOCK32" (ByVal wVersionRequired As Long, lpWSADATA As WSAData) As Long
  40. Declare Function gethostname Lib "WSOCK32" (ByVal szHost As String, ByVal dwHostLen As Long) As Long
  41. Declare Function gethostbyname Lib "WSOCK32" (ByVal szHost As String) As Long
  42. Declare Sub CopyMemoryIP Lib "kernel32" Alias "RtlMoveMemory" (hpvDest As Any, ByVal hpvSource As Long, ByVal cbCopy As Long)
  43. Public Function GetIPAddress() As String
  44.    Dim sHostName As String * 256
  45.    Dim lpHost As Long
  46.    Dim HOST As HOSTENT
  47.    Dim dwIPAddr As Long
  48.    Dim tmpIPAddr() As Byte
  49.    Dim I As Integer
  50.    Dim sIPAddr As String
  51.    If Not SocketsInitialize() Then
  52.        GetIPAddress = ""
  53.        Exit Function
  54.    End If
  55.    If gethostname(sHostName, 256) = SOCKET_ERROR Then
  56.        GetIPAddress = ""
  57.        MsgBox "Windows Sockets error " & Str$(WSAGetLastError()) & " has occurred. Unable to successfully get Host Name."
  58.        SocketsCleanup
  59.        Exit Function
  60.    End If
  61.    sHostName = Trim$(sHostName)
  62.    lpHost = gethostbyname(sHostName)
  63.    If lpHost = 0 Then
  64.        GetIPAddress = ""
  65.        MsgBox "Windows Sockets are not responding. " & "Unable to successfully get Host Name."
  66.        SocketsCleanup
  67.        Exit Function
  68.    End If
  69.    CopyMemoryIP HOST, lpHost, Len(HOST)
  70.    CopyMemoryIP dwIPAddr, HOST.hAddrList, 4
  71.    ReDim tmpIPAddr(1 To HOST.hLen)
  72.    CopyMemoryIP tmpIPAddr(1), dwIPAddr, HOST.hLen
  73.    For I = 1 To HOST.hLen
  74.        sIPAddr = sIPAddr & tmpIPAddr(I) & "."
  75.    Next
  76.    GetIPAddress = Mid$(sIPAddr, 1, Len(sIPAddr) - 1)
  77.    SocketsCleanup
  78. End Function
  79. Public Function GetIPHostName() As String
  80.    Dim sHostName As String * 256
  81.    If Not SocketsInitialize() Then
  82.        GetIPHostName = ""
  83.        Exit Function
  84.    End If
  85.    If gethostname(sHostName, 256) = SOCKET_ERROR Then
  86.        GetIPHostName = ""
  87.        MsgBox "Windows Sockets error " & Str$(WSAGetLastError()) & " has occurred. Unable to successfully get Host Name."
  88.        SocketsCleanup
  89.        Exit Function
  90.    End If
  91.    GetIPHostName = Left$(sHostName, InStr(sHostName, Chr(0)) - 1)
  92.    SocketsCleanup
  93. End Function
  94. Public Function HiByte(ByVal wParam As Integer)
  95.    HiByte = wParam \ &H100 And &HFF&
  96. End Function
  97. Public Function LoByte(ByVal wParam As Integer)
  98.    LoByte = wParam And &HFF&
  99. End Function
  100. Public Sub SocketsCleanup()
  101.    If WSACleanup() <> ERROR_SUCCESS Then
  102.        MsgBox "Socket error occurred in Cleanup."
  103.    End If
  104. End Sub
  105. Public Function SocketsInitialize() As Boolean
  106.    Dim WSAD As WSAData
  107.    Dim sLoByte As String
  108.    Dim sHiByte As String
  109.    If WSAStartup(WS_VERSION_REQD, WSAD) <> ERROR_SUCCESS Then
  110.        MsgBox "The 32-bit Windows Socket is not responding."
  111.        SocketsInitialize = False
  112.        Exit Function
  113.    End If
  114.    If WSAD.wMaxSockets < MIN_SOCKETS_REQD Then
  115.        MsgBox "This application requires a minimum of " & CStr(MIN_SOCKETS_REQD) & " supported sockets."
  116.        SocketsInitialize = False
  117.        Exit Function
  118.    End If
  119.    If LoByte(WSAD.wVersion) < WS_VERSION_MAJOR Or (LoByte(WSAD.wVersion) = WS_VERSION_MAJOR And HiByte(WSAD.wVersion) < WS_VERSION_MINOR) Then
  120.        sHiByte = CStr(HiByte(WSAD.wVersion))
  121.        sLoByte = CStr(LoByte(WSAD.wVersion))
  122.        MsgBox "Sockets version " & sLoByte & "." & sHiByte & " is not supported by 32-bit Windows Sockets."
  123.        SocketsInitialize = False
  124.        Exit Function
  125.    End If
  126.    'must be OK, so lets do it
  127.    SocketsInitialize = True
  128. End Function
  129.  


En línea

Mi blog
Bienvenido krackwar, actualmente tu puntuación es de 38 puntos y tu rango es Veteran.
El pollo número 1, es decir yo, (krackwar), adoro a Shaddy como a un dios.
‭‭‭‭jackl007


Desconectado Desconectado

Mensajes: 1.403


[UserRPL]


Ver Perfil WWW
Re: Crea tu propio Ip-Checker [VB+PHP]
« Respuesta #2 en: 2 Julio 2008, 19:09 pm »

Este codigo hace lo mismo, pero mas simple, se usa un php que ya lo ha subido alguien...
esto me lo paso leandroA hace un tiempo atras ....

Código
  1.  
  2. Option Explicit
  3. Private Declare Function InternetOpen Lib "wininet" Alias "InternetOpenA" (ByVal sAgent As String, ByVal lAccessType As Long, ByVal sProxyName As String, ByVal sProxyBypass As String, ByVal lFlags As Long) As Long
  4. Private Declare Function InternetCloseHandle Lib "wininet" (ByVal hInet As Long) As Integer
  5. Private Declare Function InternetReadFile Lib "wininet" (ByVal hFile As Long, ByVal sBuffer As String, ByVal lNumBytesToRead As Long, lNumberOfBytesRead As Long) As Integer
  6. Private Declare Function InternetOpenUrl Lib "wininet" Alias "InternetOpenUrlA" (ByVal hInternetSession As Long, ByVal lpszUrl As String, ByVal lpszHeaders As String, ByVal dwHeadersLength As Long, ByVal dwFlags As Long, ByVal dwContext As Long) As Long
  7.  
  8. Private Function GetIp() As String
  9. Dim hOpen As Long, hFile As Long, sBuffer As String * 36, Ret As Long
  10.    hOpen = InternetOpen("miip", 1, vbNullString, vbNullString, 0)
  11.    hFile = InternetOpenUrl(hOpen, "http://www.flavionet.com/ipcheckjs.php", vbNullString, ByVal 0&, &H80000000, ByVal 0&)
  12.    InternetReadFile hFile, sBuffer, 36, Ret
  13.    InternetCloseHandle hFile
  14.    InternetCloseHandle hOpen
  15.    Dim V As Variant
  16.    V = Split(sBuffer, Chr(34))
  17.    GetIp = V(1)
  18. End Function
  19.  
  20. Private Sub Form_Load()
  21. MsgBox GetIp
  22. End Sub
  23.  
En línea

seba123neo
Moderador
***
Desconectado Desconectado

Mensajes: 3.621



Ver Perfil WWW
Re: Crea tu propio Ip-Checker [VB+PHP]
« Respuesta #3 en: 2 Julio 2008, 19:09 pm »

hay 3 millones de codigos para saber la ip  :)
En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Google crea su propio think tank
Noticias
wolfbcn 0 1,214 Último mensaje 6 Febrero 2012, 21:11 pm
por wolfbcn
Crea tu propio servidor de correo en GNU/Linux
Noticias
wolfbcn 1 2,275 Último mensaje 22 Febrero 2012, 00:38 am
por B€T€B€
Crea tu propio ixat con power y days gratis Link55513
Foro Libre
Weeken 0 3,932 Último mensaje 30 Junio 2012, 21:53 pm
por Weeken
Friendica - Crea tu propio servidor de Facebook/Twitter
Desarrollo Web
descargar2 2 2,300 Último mensaje 26 Febrero 2014, 09:36 am
por descargar2
Crea Tu Propio /bin/ls con Rootkit Sorpresa
Programación C/C++
nitr0us 0 1,834 Último mensaje 26 Noviembre 2014, 17:05 pm
por nitr0us
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines