Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to read an .exe file to byte array and then execute it this way? #3

Open
pavelpasha opened this issue Jul 5, 2017 · 1 comment

Comments

@pavelpasha
Copy link

No description provided.

@pavelpasha pavelpasha changed the title Is it posuble to read an .exe file to byte array and then execute this way? Is it possible to read an .exe file to byte array and then execute this way? Jul 5, 2017
@pavelpasha pavelpasha changed the title Is it possible to read an .exe file to byte array and then execute this way? Is it possible to read an .exe file to byte array and then execute it this way? Jul 5, 2017
@NE1W01F
Copy link

NE1W01F commented Jul 15, 2018

well you can turn it in to bytes and then make the bytes in to a file then start it.

string file2 = "bit.exe";
System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
string str = enc.GetString(file2);
StreamWriter f2 = new StreamWriter("bytes");
f2.Write(str);
 f2.Close();
Console.WriteLine("bytes have been put in a file.");
Console.ReadKey();
byte[] file = File.ReadAllBytes("bytes.txt");
File.WriteAllBytes("happy.exe", file);
Console.ReadKey();

I was working on a way if make the bytes in to a txt file that this it can be made back in to a exe. but in you case you need to do this.

string file2 = "you file name.exe";
byte[] file = File.ReadAllBytes("bytes.txt");
File.WriteAllBytes("you new file name.exe", file);

make sure it an exe file. i don't know if it work on other files. This code turns you exe file in to bytes and then uses the bytes to make an copy of the file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants