🔒 Closed Several vb.net codes

Status
Not open for further replies.

Maviz

(Otaku)
I'll make some VB codes available for you, especially for Beginners

Check Internet:
Code:
MsgBox (My.Computer.Network.IsAvailable)

Verify that the file exists in the folder:
Code:
On top of public class place this code

Imports System.IO

put this command in a buton or wherever you want in the form
IO.File.Exists ("c: \ test.txt")

Close program:
Code:
I love you

Shutdown / Logoff / Restart pc:
Code:
'Shut Down the Computer
System.Diagnostics.Process.Start ("shutdown", "-s -t 00")

'Restart Computer
System.Diagnostics.Process.Start ("shutdown", "-r -t 00")

'LogOff to Computer
System.Diagnostics.Process.Start ("shutdown", "-l -t 00")

Download Files to Pc:
Code:
My.Computer.Network.DownloadFile ("Here the link", "Here the name how it will be downloaded")

Open Another Form:
Code:
'' form2.show or form3.show and so it goes, it depends on the form number you want to open

Open Web Page:
Code:
Process.Start ("place link here")

Show message:
Code:
messagebox.show ("Post a message here")

Extract injecting:
Code:
Public Class Form1

Private TargetProcessHandle As Integer
Private pfnStartAddr As Integer
Private pszLibFileRemote As String
Private TargetBufferSize As Integer

Public Const PROCESS_VM_READ = & H10
Public Const TH32CS_SNAPPROCESS = & H2
Public Const MEM_COMMIT = 4096
Public Const PAGE_READWRITE = 4
Public Const PROCESS_CREATE_THREAD = (& H2)
Public Const PROCESS_VM_OPERATION = (& H8)
Public Const PROCESS_VM_WRITE = (& H20)
Dim DLLFileName As String
Public Declare Function ReadProcessMemory Lib "kernel32" (_
ByVal hProcess As Integer, _
ByVal lpBaseAddress As Integer, _
ByVal lpBuffer As String, _
ByVal nSize As Integer, _
ByRef lpNumberOfBytesWritten As Integer) As Integer

Public Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (_
ByVal lpLibFileName As String) As Integer

Public Declare Function VirtualAllocEx Lib "kernel32" (_
ByVal hProcess As Integer, _
ByVal lpAddress As Integer, _
ByVal dwSize As Integer, _
ByVal flAllocationType As Integer, _
ByVal flProtect As Integer) As Integer

Public Declare Function WriteProcessMemory Lib "kernel32" (_
ByVal hProcess As Integer, _
ByVal lpBaseAddress As Integer, _
ByVal lpBuffer As String, _
ByVal nSize As Integer, _
ByRef lpNumberOfBytesWritten As Integer) As Integer

Public Declare Function GetProcAddress Lib "kernel32" (_
ByVal hModule As Integer, ByVal lpProcName As String) As Integer

Private Declare Function GetModuleHandle Lib "Kernel32" Alias "GetModuleHandleA" (_
ByVal lpModuleName As String) As Integer

Public Declare Function CreateRemoteThread Lib "kernel32" (_
ByVal hProcess As Integer, _
ByVal lpThreadAttributes As Integer, _
ByVal dwStackSize As Integer, _
ByVal lpStartAddress As Integer, _
ByVal lpParameter As Integer, _
ByVal dwCreationFlags As Integer, _
ByRef lpThreadId As Integer) As Integer

Public Declare Function OpenProcess Lib "kernel32" (_
ByVal dwDesiredAccess As Integer, _
ByVal bInheritHandle As Integer, _
ByVal dwProcessId As Integer) As Integer

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (_
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Integer

Private Declare Function CloseHandle Lib "kernel32" Alias "CloseHandleA" (_
ByVal hObject As Integer) As Integer
Dim ExeName As String = IO.Path.GetFileNameWithoutExtension (Application.Ex ecutablePath)

Private Sub Inject ()
Dim TargetProcess As Process () = Process.GetProcessesByName ("BlackShot")
Dim lpThreadId As IntPtr
Try
TargetProcessHandle = OpenProcess (& H1F0FFF, 0, TargetProcess (0) .Id)
pszLibFileRemote = ("C: \ Windows \ System32 \ nullname.dll")
pfnStartAddr = GetProcAddress (GetModuleHandle ("Kernel32"), "LoadLibraryA")
TargetBufferSize = 1 + Len (pszLibFileRemote)
Dim Rtn As Integer
Dim LoadLibParamAdr As Integer
LoadLibParamAdr = VirtualAllocEx (TargetProcessHandle, 0, TargetBufferSize, MEM_COMMIT, PAGE_READWRITE)
Rtn = WriteProcessMemory (TargetProcessHandle, LoadLibParamAdr, pszLibFileRemote, TargetBufferSize, 0)
CreateRemoteThread (TargetProcessHandle, 0, 0, pfnStartAddr, LoadLibParamAdr, 0, lpThreadId)
If lpThreadId = IntPtr.Zero Then
Else
End If
Catch ex As Exception
End Try
End Sub

'####################
'Extract and check
'####################
IO.File.WriteAllBytes ("C: \ Windows \ System32 \ names uadll.dll", My.Resources.nomedasuadllnoresources) 'extract dll in System32
If IO.File.Exists ("C: \ Windows \ System32 \ nullname.dll ll") Then 'check if the dll is in system32 if it is not
Timer4.Start ()

Else
IO.File.WriteAllBytes ("C: \ Windows \ System32 \ names uadll.dll", My.Resources.nomedasuadllnoresources) 'If the dll is not in system32, the dll in resources will be extracted.

End If

'####################
'Extract and check
'####################
Dim TargetProcess As Process () = Process.GetProcessesByName ("BlackShot") 'check if the process is open
If TargetProcess.Length = 0 Then
Me.Label9.Text = ("Waiting for BlackShot ...") 'if not.

Else
Call Inject () 'injectDLL' Inject = Private Sub Inject ()
End If

Placing Music:
Code:
My.Computer.Audio.Play (My.Resources.Place the music here,
AudioPlayMode.BackgroundLoop)

Delete file from folder:
Code:
IO.File.Delete ("LocalDaDllPC")

Do you really want to close the form?
Code:
If MsgBox ("Do you want to close?", MsgBoxStyle.OkCancel) = MsgBoxResult.Ok Then
Me.Close ()
else
end if

Finalize Processes:
Code:
Dim Process As Process () = Process.GetProcessesByName ("Process Name")
For Each p In process
p.Kill ()
Next

Check if it was opened as Adm:
Code:
If My.User.IsInRole (ApplicationServices.BuiltInRole.A dministrator) Then
MsgBox ("The program was opened as an admin !!!")
Else
MsgBox ("The program must be opened as Administrator !! the program will be closed!")
Me.Close ()
End Ift

Crypter:
Code:
Imports System.IO
Imports System.Text
Imports System.Security.Cryptography

Public Class Crypto
'################################################# ###########
'# Asianism
'# Web: [url] phcorner.org [/ url] #
'# Email: [email] decrypt.cl@gmail.com [/ email] #
'################################################# ###########
Public Shared Function Decrypt (ByVal input As String, ByVal pass As As String) As String
Dim AES As New System.Security.Cryptography.RijndaelManaged
Dim Hash_AES As New System.Security.Cryptography.MD5CryptoServiceProvi der
Dim decrypted As String = ""
Try
Dim hash (31) As Byte
Dim temp As Byte () = Hash_AES.ComputeHash (System.Text.ASCIIEncoding.ASC II.GetBytes (pass))
Array.Copy (temp, 0, hash, 0, 16)
Array.Copy (temp, 0, hash, 15, 16)
AES.Key = hash
AES.Mode = Security.Cryptography.CipherMode.ECB
Dim DESDecrypter As System.Security.Cryptography.ICryptoTransform = AES.CreateDecryptor
Dim Buffer As Byte () = Convert.FromBase64String (input)
decrypted = System.Text.ASCIIEncoding.ASCII.GetString (DESDecry pter.TransformFinalBlock (Buffer, 0, Buffer.Length))
Return decrypted
Catch ex As Exception
End Try
End Function

End Class

Protection vb:
#Region "Process Protection"
Public Const SE_DEBUG_NAME As String = "SeDebugPrivilege"
Public Const SE_SHUTDOWN_NAME As String = "SeShutdownPrivilege"
Public Const SE_SECURITY_NAME As String = "SeSecurityPrivileges"
Public Const SE_TCB_NAME As String = "SeTcbPrivileges"
Public Const SE_TAKE_OWNERSHIP_NAME As String = "SeTakeOwnershipPrivileges"

Private Structure LUID
Public LowPart As Integer
Public HighPart As Integer
End Structure

Private Structure LUID_AND_ATTRIBUTES
Public pLuid As LUID
Public Attributes As Integer
End Structure

Private Structure TOKEN_PRIVILEGES
Public PrivilegeCount As Integer
_
Public Privileges () As LUID_AND_ATTRIBUTES
End Structure

Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Ansi Function OpenProcessToken Lib "advapi32.dll" (ByVal ProcessHandle As IntPtr, ByVal DesiredAccess As Integer, ByRef TokenHandle As IntPtr) As Integer
Private Declare Ansi Function LookupPrivilegeValue Lib "advapi32.dll" Alias "LookupPrivilegeValueA" (ByVal lpSystemName As String, ByVal lpName As String, ByRef lpLuid As LUID) As Integer
Private Declare Ansi Function AdjustTokenPrivileges Lib "advapi32.dll" (ByVal TokenHandle As IntPtr, ByVal DisableAllPrivileges As Boolean, ByRef NewState As TOKEN_PRIVILEGES, ByVal BufferLength As Integer, ByRef PreviousState As TOKEN_PRIVILEGES, ByRef ReturnLength As IntPtr) As Integer
Private Declare Function CloseHandle Lib "kernel32.dll" (ByVal hHandle As IntPtr) As Boolean
Public Declare Sub RtlSetProcessIsCritical Lib "ntdll.dll" (ByVal NewValue As Boolean, ByVal OldValue As Boolean, ByVal WinLogon As Boolean)

Private Const TOKEN_ADJUST_PRIVILEGES As Integer = & H20
Private Const TOKEN_QUERY As Integer = & H8
Private Const SE_PRIVILEGE_ENABLED As Integer = & H2
Private Const ANYSIZE_ARRAY As Integer = 1

Public Function GetPrivileges (ByVal privileges As String) As Boolean
Dim hToken As IntPtr
Dim hProcess As IntPtr = Process.GetCurrentProcess (). Handle
Dim uid_Debug As LUID
Dim luaAttr As New LUID_AND_ATTRIBUTES
Dim newState As New TOKEN_PRIVILEGES
Dim prevState As TOKEN_PRIVILEGES = New TOKEN_PRIVILEGES
Dim returnLength As IntPtr

Try
If LookupPrivilegeValue ("", privileges, uid_Debug) = 0 Then Return False
If OpenProcessToken (hProcess, TOKEN_ADJUST_PRIVILEGES Or TOKEN_QUERY, hToken) = 0 Then Return False
moonAttr.pLuid = uid_Debug
luaAttr.Attributes = SE_PRIVILEGE_ENABLED
newState.PrivilegeCount = 1
newState.Privileges = New LUID_AND_ATTRIBUTES () {luaAttr}
ReDim prevState.Privileges (CInt (newState.PrivilegeCount))
If AdjustTokenPrivileges (hToken, False, newState, Marshal.SizeOf (prevState), prevState, returnLength) = 0 Then Return False
Finally
CloseHandle (hToken)
End Try
Return True
End Function
#End Region



Put this in FormLoad:
Code:
GetPrivileges (SE_SECURITY_NAME)
RtlSetProcessIsCritical (True, False, False)

~Asianism
(Death Code Team / AG Team)
 
boss may codes or sample kaba kung paano magupload ng image using vb.net with sql/access, maraming salamat sa pag tulong.
 
Status
Not open for further replies.

About this Thread

  • 17
    Replies
  • 1K
    Views
  • 11
    Participants
Last reply from:
xdelat

Trending Topics

Online now

Members online
1,272
Guests online
1,636
Total visitors
2,908

Forum statistics

Threads
2,269,831
Posts
28,931,496
Members
1,241,597
Latest member
mastermind2319
Back
Top