Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// Basically, C# saves initial value of a variable directly in to the compiled executable
- /// This is how we will save our message in C#
- /// However, you can't directly use a string to make hidden message or use C# string split function
- /// Since they will still compiled as 16bit string. and also, This method only supports 8bit (ASCII) message.
- /// To overcome the 16bit string conversion, we will use byte array since they save 8bit value.
- /// I don't know if this method will also support 16bit+ message by using string directly, however.
- ///
- /// This program contains a message and will act as Console-based String to Byte Array in C# that can be used to generate much more message if you want.
- ///
- /// First, You can use this JavaScript in your browser inspector to convert a string into byte array which you can copy-paste into C# code.
- /// eval('['+(("Your String Here").split("").map(it => it.charCodeAt(0)).toString())+']');
- /// Beware: eval is dangerous and is conquered by Amingwati :)
- using System;
- using System.Collections;
- using System.Text;
- namespace EasterEgg
- {
- class Endog
- { //Endog - Egg in Javanese
- // This byte[] contains : "Kulanuwun and Konichiwa, Stupids for who opens an application in Notepad or Hex Editor." - They clearly open the compiled executable in a text editor in order to view this message
- // Change this to (whatever you want) but as byte array.
- public static byte[] easterEggByteArray = new byte[] { 72, 101, 108, 108, 111, 32, 97, 110, 100, 32, 75, 111, 110, 105, 99, 104, 105, 119, 97, 44, 32, 83, 116, 117, 112, 105, 100, 115, 32, 102, 111, 114, 32, 119, 104, 111, 32, 111, 112, 101, 110, 115, 32, 97, 110, 32, 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 32, 105, 110, 32, 78, 111, 116, 101, 112, 97, 100, 32, 111, 114, 32, 72, 101, 120, 32, 69, 100, 105, 116, 111, 114, 46 };
- // App entry point
- public static void Main(string[] args)
- {
- // Placeholder for argument combination
- string argCombined = "";
- // Loop over the arguments and combine them all into a string
- foreach (string arg in args)
- {
- argCombined = string.Format("{0} {1}", argCombined, arg);
- }
- // Remove white-space in the start and the end of the string
- byte[] bytes = Encoding.ASCII.GetBytes(argCombined.Trim());
- // Convert it to string first before writing the value to console
- // Placeholder for bytestring combination
- string byteString = "";
- // Loop over the bytes
- foreach (byte b in bytes)
- {
- byteString = byteString + b + ", ";
- }
- // Remove the last ", " , byteString.Length is always (total + 1)
- byteString = byteString.Substring(0, byteString.Length - 2);
- // Write utility name
- Console.Clear();
- Console.WriteLine("Hidden Message Generator v1.0 by EmiyaSyahriel (Your name here, but It's actually mine Awkwokowkowk)");
- Console.WriteLine("Copy this line to continue");
- Console.WriteLine("");
- //Actual byte
- Console.WriteLine("byte[] hidden_message = new byte[] {"+byteString+"}; ");
- //let's clear things. A nice habit to clear memory (Have no effect in C# since it was managed by .NET CLR)
- byteString = "";
- argCombined = "";
- bytes = new byte[0];
- // And let GC to collect every unused memory location (they actually already did before). But who know that some will remain?
- GC.Collect();
- }
- }
- }
- /// You can compile this C# file with Visual Studio or with csc.exe (Which come with .NET Framework without installing the full VS)
- /// Ignore all of those warning about unused variables.. Since It was actually used but not in the program itself :P
- /// :: No, it will not happen since unused static will be marked as not unused :)
- ///
- /// After the compilation, you can open the executable in your favorite text editor and Ta-Da... "You now a stupid who open app in Notepad" hahaha (Joke)
- /// You can also examine the "Hidden Message" in WriteLine will be compiled as "H.i.d.d.e.n. .M.e.s.s.a.g.e(b.l.a.b.l.a.b.l.a)" since string is normally compiled as 16bit (2 byte)
- /// If you doubt that this come from comment, No.. Comment will never be put into a compiled executable! (except for a special compiler)
- /// Even this line will never came to the compiled executable if you find it.
- ///
- /// Tested with "csc.exe" of ".NET 3.5" in "Windows 10 Pro 1903"
- /// Ngopi rek (N) 2019 - EmiyaSyahriel.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement