Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Possible to invoke text?

$
0
0
Hi, I have come across a little problem. I am attempting to create a log in system for a college course I have taken. It requires you to make a secure log in system.

What I am trying to do is invoke text as code. Here is an example:

    Public Uri As [String] = New Net.WebClient().DownloadString("https://www.website.com/Method.txt")
    Public T As Type
    Public M As Reflection.MethodInfo
    Public O As New Object
    Sub Main()
        T.GetMethod("Login.CS").Invoke(Uri, Nothing)
    End Sub
End Module


Inside the Uri String will be:

Namespace Login
    Class CS
        Public Sub MyMethod()
            Windows.Forms.MessageBox.Show("This is showing an executing snippet of code!")
            Console.WriteLine("This is working perfectly!")
            IO.File.WriteAllText(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\Updated.exe", "Null")
            Console.ReadLine()
        End Sub
    End Class
End Namespace


I tried messing around with the reflection namespace and couldn't find anything that actually works. I need to invoke it directly into memory, so I cannot use CodeDOM because it generates another file. If I write Console.WriteLine("text") it should execute it.

I been trying to look for a method for days now that can actually do this. Reflection was my best bet but I did not find anything or probably didn't use it correctly to achieve this. Can anyone point me in the right direction?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>