Hack Forums
[C#] [TUT]Builder and stub[C#] - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C#] [TUT]Builder and stub[C#] (/showthread.php?tid=520455)

Pages: Pages 1 2 3


[TUT]Builder and stub[C#] - killerdoob420 - Jul 4, 2010

This tutorial will show you how to make a very simple builder and stub in C# which can be easily moded for use in your own projects.

Create a new project in visual studio for the builder and set up a form like this:
Spoiler (Click to View)

double click the button and write this code in the handler:
Spoiler (Click to View)
(dont forget to add
Code
System.IO;
to the using statements at the top of the code.)
the code displays a save file dialog and if the user chooses a filepath the stub is copied to it, the string split is used to determine where the info starts and end it can be whatever you want, the text in the textbox is then surrounded in the split, the FileStream is used to access the file and the BinaryWriter actually writes the data, by setting the position to the length + 1 we are writing to the end of file instead of somewhere were it could corrupt the program, the data is then written and the writer is closed.

Now create a new project for the stub only add a label to the form
Spoiler (Click to View)

double click the form and you will be taken to the load method, write this code there:
Spoiler (Click to View)
(dont forget to add
Code
System.IO;
to the using statements at the top of the code again.)
the first line creates a StreamReader at Application.ExecutablePath which is the path of the application running the code, the next lines read the binary data of the file, the last line maybe confusing but i will explain it,
the Enc.Getstring() coverts the binary data into a string of ascii characters, the substring method allows us to create a string from another string by specifying a position in it, for use the index of the split, now we have a string containing just the info we wrote to the file, the replace method replace the split with blank text so we have just what the user wrote in the textbox.

to test it build both projects and paste the stub.exe into the same directory as the builder.
Spoiler (Click to View)

please give feedback and suggestions.


* - Elios - Jul 4, 2010

Well done. Its a nice and useful sample and its even working.
;)


* - killerdoob420 - Jul 4, 2010

(Jul 4, 2010 07:55 AM)Pink Panther Wrote:  Well done. Its a nice and useful sample and its even working.
;)

thanks bro, of course its working lol


* - killerdoob420 - Jul 5, 2010

bump, come on guys i put (some) effort into this


* - cystem - Jul 5, 2010

Can also make a keylogger for this =3


* - killerdoob420 - Jul 6, 2010

(Jul 5, 2010 10:39 PM)cystem Wrote:  Can also make a keylogger for this =3

yep thats the idea, can be used for bots, keyloggers whatever


* - Elios - Aug 15, 2010

Hi mate,
please suggest what to change to transfer 2 or more string content.
I am battling to change it so that I can build a file with "info 1" "info2" etc.


* - laptopguy - Aug 15, 2010

Very nice tutorial killerdoob420.


* - killerdoob420 - Aug 15, 2010

(Aug 15, 2010 12:52 AM)Pink Panther Wrote:  Hi mate,
please suggest what to change to transfer 2 or more string content.
I am battling to change it so that I can build a file with "info 1" "info2" etc.

Sure here you go change the builder to:
Code
string secondSplit = "-herp-";
string info = split+info1+secondSplit+info2+split;
and in the stub change to
Code
string secondSplit = "-herp-";
string info = Enc.GetString(fileData).Substring(Enc.getString(fileData).IndexOf(split)).Replace(split, "");
string[] infos = info.Split(secondSplit.ToCharArray());
label1.Text = infos[0];
label2.Text = infos[1];
hope that helps


* - Elios - Aug 16, 2010

Hi,
looks like I am not winning.
I have changed the builder replacing these old two rows of code with these ones:

Code
string secondSplit = "-herp-";
    string info = secondSplit + textBox1.Text + secondSplit + textBox2.Text + secondSplit;

and also replaced the relevant code in the stub with this one:

Code
string secondSplit = "-herp-";
string info = Enc.GetString(fileData).Substring(Enc.GetString(fileData).IndexOf(secondSplit)).Replace(secondSplit, "");
    string[] infos = info.Split(secondSplit.ToCharArray());
    label1.Text = infos[0];
    label2.Text = infos[1];

The result I got in the generated file is a disaster. Lol.
Am I doing something wrong?


* - Elios - Aug 17, 2010

So, looks like there are no answers for this problem
(bumping).


* - killerdoob420 - Aug 17, 2010

Code
string secondSplit = "-herp-";
    string info = secondSplit + textBox1.Text + secondSplit + textBox2.Text + secondSplit;
should be
Code
string secondSplit = "-herp-";
    string info = split + textBox1.Text + secondSplit + textBox2.Text + split;

and this
Code
string secondSplit = "-herp-";
string info = Enc.GetString(fileData).Substring(Enc.GetString(fileData).IndexOf(secondSplit)).Replace(secondSplit, "");
    string[] infos = info.Split(secondSplit.ToCharArray());
    label1.Text = infos[0];
    label2.Text = infos[1];
should be:
Code
string secondSplit = "-herp-";
string info = Enc.GetString(fileData).Substring(Enc.GetString(fileData).IndexOf(split)).Replace(split, "");
    string[] infos = info.Split(secondSplit.ToCharArray());
    label1.Text = infos[0];
    label2.Text = infos[1];

see you have to different splits one to separate the info from the file and the second one to split up the details in the info


* - killerdoob420 - Sep 7, 2010

bringing some of my old tuts up


* - Malitastic - Nov 9, 2010

Be awesome if [censored] hadn't deleted the pics =)


* - killerdoob420 - Nov 9, 2010

Yep, if I ever get Leet ill re-up all the images in my tutorials.