Memaparkan catatan dengan label Visual Studio. Papar semua catatan
Memaparkan catatan dengan label Visual Studio. Papar semua catatan

Isnin, Jun 23, 2014

VB.net : Geo Location

ADDR = IP 'HOLDS IP ADDRESS
    If VALIDATE_IP(ADDR) = True Then 'FUNCTION TO VALIDATE IP BY USING THIS PATTERN: ^(([01]?\d\d?|2[0-4]\d|25[0-5])\.){3}([01]?\d\d?|25[0-5]|2[0-4]\d)$
        BUFFER = SOURCE("http://www.geobytes.com/IpLocator.htm?GetLocation&IpAddress=" & ADDR) 'FUNCTION THAT FETCHES THE URL SOURCE
        DATA = Split(BUFFER, """ value=")
        FLAG = Split(BUFFER, "<a href=" & Chr(34) & "FreeServices.htm" & Chr(34) & "><img border=" & Chr(34) & "0" & Chr(34) & "src=" & Chr(34) & "http://www.geobytes.com/Flags/") 'LAZY XD
        FLAG = Split(FLAG(1), Chr(34))
        PIC = "http://www.geobytes.com/Flags/" & FLAG(0)
        LOAD_PIC PIC 'FUNCTION TO DOWNLOAD THE PICTURE AND DISPLAY IT
        If UBound(DATA()) > 33 Then
            For M = 13 To 34
                DAT = Split(DATA(M), Chr(34))
                GEOLOC.G(Val(M) - 13).Caption = DAT(0) 'GET GEO LOCATIONS AND DISPLAY THEM
                DoEvents
            Next M
        End If
    Else
        MsgBox "INVALID IP!", vbInformation, ""
        GEOLOC.IP.Text = vbNullString
    End If

Ahad, September 22, 2013

VB.NET : Port Scanner

Imports System.Net.Sockets
Imports System.Net
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.CheckForIllegalCrossThreadCalls = False 'Now you can Add items through a thread
        For i As Integer = NumericUpDown1.Value To NumericUpDown2.Value
            Dim tmpThread As New System.Threading.Thread(AddressOf ScanPort)
            tmpThread.IsBackground = True
            tmpThread.Start(i) 'i represents the current port 
        Next
    End Sub
    Private Sub ScanPort(ByVal port As Integer)
        Try 'Always put your code [or more complicated code] in a Try Catch Block :]
            Dim tmpClient As New TcpClient()
            Dim tmpEndPoint As New IPEndPoint(IPAddress.Parse(TextBox1.Text), port)
            tmpClient.Connect(tmpEndPoint)
            Threading.Thread.Sleep(50) '50 is the Timeout in ms.
            If tmpClient.Connected = True Then
                ListBox1.Items.Add("Open Port: " & port) 'If Connected then it will be an open port
            End If
        Catch ex As Exception
        End Try
    End Sub
End Class

Rabu, Mei 08, 2013

Visual Studio: Batch Auto delete bin, obj etc

start for /d /r . %%d in (bin,obj, ClientBin,Generated_Code) do @if exist "%%d" rd /s /q "%%d"
Nota : Simpan dan nama kan fail dengan ektensi *.bat, letak dalam direktori projek anda. Jalankan fail ini HANYA apabila anda selesai membuat aturcara. Selamat mencuba.Wassalam ~