HASH-Cafe (Client) VB.NET

HASH-Cafe (Client) VB.NET


FORM 1
Option Explicit On
Option Strict On
Imports System.Runtime.InteropServices
Imports System.Data.OleDb
Imports System.IO
Public Class Client
    Public security As Boolean
    Private Sub Client_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub

    '-----------------------------------------------------------------------------JGUARD----------------------------------------------------------------------------


    Private Structure KBDLLHOOKSTRUCT

        Public key As Keys
        Public scanCode As Integer
        Public flags As Integer
        Public time As Integer
        Public extra As IntPtr

    End Structure

    Private Delegate Function LowLevelKeyboardProc(ByVal nCode As Integer, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr

    <DllImport("user32.dll", CharSet:=CharSet.Auto, SetLastError:=True)>
    Private Shared Function SetWindowsHookEx(ByVal id As Integer, ByVal callback As LowLevelKeyboardProc, ByVal hMod As IntPtr, ByVal dwThreadId As UInteger) As IntPtr

    End Function
    <DllImport("user32.dll", CharSet:=CharSet.Auto, SetLastError:=True)>
    Private Shared Function UnhookWindowsHookEx(ByVal hook As IntPtr) As Boolean

    End Function
    <DllImport("user32.dll", CharSet:=CharSet.Auto, SetLastError:=True)>
    Private Shared Function CallNextHookEx(ByVal hook As IntPtr, ByVal nCode As Integer, ByVal wp As IntPtr, ByVal lp As IntPtr) As IntPtr

    End Function
    <DllImport("kernel32.dll", CharSet:=CharSet.Auto, SetLastError:=True)>
    Private Shared Function GetModuleHandle(ByVal name As String) As IntPtr

    End Function
    <DllImport("user32.dll", CharSet:=CharSet.Auto)>
    Private Shared Function GetAsyncKeyState(ByVal key As Keys) As Short

    End Function
    Private ptrHook As IntPtr
    Private objKeyboardProcess As LowLevelKeyboardProc




    Public Sub New()

        Try
            Dim objCurrentModule As ProcessModule = Process.GetCurrentProcess().MainModule

            objKeyboardProcess = New LowLevelKeyboardProc(AddressOf captureKey)

            ptrHook = SetWindowsHookEx(13, objKeyboardProcess, GetModuleHandle(objCurrentModule.ModuleName), 0)

            InitializeComponent()



        Catch ex As Exception

        End Try
    End Sub

    Private Function captureKey(ByVal nCode As Integer, ByVal wp As IntPtr, ByVal lp As IntPtr) As IntPtr

        Try
            If nCode >= 0 Then

                Dim objKeyInfo As KBDLLHOOKSTRUCT = DirectCast(Marshal.PtrToStructure(lp, GetType(KBDLLHOOKSTRUCT)), KBDLLHOOKSTRUCT)


                If objKeyInfo.key = Keys.RWin OrElse objKeyInfo.key = Keys.LWin Then

                    If security = True Then

                        Return CType(1, IntPtr)
                    End If
                End If


                If objKeyInfo.key = Keys.ControlKey OrElse objKeyInfo.key = Keys.Escape Then

                    If security = True Then

                        Return CType(1, IntPtr)
                    End If
                End If



                If objKeyInfo.key = Keys.Alt OrElse objKeyInfo.key = Keys.Tab Then

                    If security = True Then

                        Return CType(1, IntPtr)
                    End If
                End If



                If objKeyInfo.key = Keys.Alt OrElse objKeyInfo.key = Keys.Control Then

                    If security = True Then

                        Return CType(1, IntPtr)
                    End If
                End If



                If objKeyInfo.key = Keys.Alt OrElse objKeyInfo.key = Keys.F4 Then

                    If security = True Then

                        Return CType(1, IntPtr)
                    End If
                End If


                If objKeyInfo.key = Keys.Control OrElse objKeyInfo.key = Keys.Alt OrElse objKeyInfo.key = Keys.Delete Then

                    If security = True Then

                        Return CType(1, IntPtr)
                    End If
                End If

                If objKeyInfo.key = Keys.Delete Then
                    If security = True Then

                        Return CType(1, IntPtr)
                    End If
                End If


            End If

            Return CallNextHookEx(ptrHook, nCode, wp, lp)
        Catch ex As Exception

        End Try
    End Function



    '-----------------------------------------------------------------------------JGUARD----------------------------------------------------------------------------



    Public Function ReadLine(lineNumber As Integer, lines As List(Of String)) As String
        Return lines(lineNumber - 1)
    End Function

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        Try
            Dim filepath As String = Application.StartupPath + "\DATABASE\Config\PC-1.txt"
            If System.IO.File.Exists(filepath) Then
                ' Open
                Me.Hide()
                security = False


                '------------------------------------------CHECK MESSAGE ------------------------------------------------------------





                If My.Computer.FileSystem.FileExists(Application.StartupPath + "\DATABASE\Config\Message.txt") Then
                    Dim linenumber As Integer
                    Dim reader As New System.IO.StreamReader(Application.StartupPath + "\DATABASE\Config\Message.txt")
                    Dim allLines As List(Of String) = New List(Of String)
                    Do While Not reader.EndOfStream
                        allLines.Add(reader.ReadLine())
                    Loop
                    XMSG.Label1.Text = ReadLine(1, allLines)
                    reader.Close()
                    XMSG.ShowDialog()
                Else
                    XMSG.Hide()
                End If







                '------------------------------------------CHECK MESSAGE ------------------------------------------------------------






            Else
                'Close
                Me.Show()
                security = True



                '------------------------------------------CHECK MESSAGE ------------------------------------------------------------





                If My.Computer.FileSystem.FileExists(Application.StartupPath + "\DATABASE\Config\Message.txt") Then
                    Dim linenumber As Integer
                    Dim reader As New System.IO.StreamReader(Application.StartupPath + "\DATABASE\Config\Message.txt")
                    Dim allLines As List(Of String) = New List(Of String)
                    Do While Not reader.EndOfStream
                        allLines.Add(reader.ReadLine())
                    Loop
                    XMSG.Label1.Text = ReadLine(1, allLines)
                    reader.Close()
                    XMSG.ShowDialog()
                Else
                    XMSG.Hide()
                End If







                '------------------------------------------CHECK MESSAGE ------------------------------------------------------------



            End If

        Catch ex As Exception
        End Try
    End Sub

    Private Sub Client_DoubleClick(sender As Object, e As EventArgs) Handles MyBase.DoubleClick
        Admin.ShowDialog()
    End Sub
End Class




FORM 2


Public Class Admin
    Private Sub GunaButton1_Click(sender As Object, e As EventArgs) Handles GunaButton1.Click
        Dim filepath As String = Application.StartupPath & "\DATABASE\Config"
        If GunaTextBox1.Text = "admin" And GunaTextBox2.Text = "admin" Then
            IO.File.Copy(filepath & "\PC.txt", filepath & "\PC-1.txt", True)
            Me.Close()
        Else
            MsgBox("Wrong Username or Password!")
        End If
    End Sub
End Class


Comments

Popular posts from this blog

QR CODE SCANNER (Emgu CV ) VB.NET

Simple Modern Login (Guna UI, Mysql) VB.NET

Simple Lottery Game (Guna UI) VB.NET