Hack Forums
[C#] need help with the output code 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#] need help with the output code C#? (/showthread.php?tid=6095977)



need help with the output code C#? - Saddam4live - Jul 18, 2020

what is the output for this code ?
string str2 = Conversions.ToString(123) + "\x0001\x001e" + Conversions.ToString(Strings.Chr(246)) + "\x0003\r$\x0003\n" + Conversions.ToString(Strings.Chr(227)) + "\r" + Conversions.ToString(Strings.Chr(244)) + "%" + Conversions.ToString(Strings.Chr(230)) + "\x001e5";

what is the value of var str2?
str2=????


RE: need help with the output code C#? - VENI - Jul 18, 2020

You can solve this yourself, here are the steps:
1. Create a new console app in visualStudio in C#(Dont forget to add a reference to Microsoft.VisualBasic)
2. Copy and paste that code you provided into the console app and simply print the result.

For example,
string str2 = string str2 = Conversions.ToString(123) + "\x0001\x001e" + Conversions.ToString(Strings.Chr(246)) + "\x0003\r$\x0003\n" + Conversions.ToString(Strings.Chr(227)) + "\r" + Conversions.ToString(Strings.Chr(244)) + "%" + Conversions.ToString(Strings.Chr(230)) + "\x001e5";
Console.WriteLine(str2);

or if you want to write it to a file do whatever you want with it like File.WriteAllText(output.txt, str2);


RE: need help with the output code C#? - iolaka - Jul 18, 2020

(Jul 18, 2020 07:23 PM)ribthegreat992 Wrote:  You can solve this yourself, here are the steps:
1. Create a new console app in visualStudio in C#(Dont forget to add a reference to Microsoft.VisualBasic)
2. Copy and paste that code you provided into the console app and simply print the result.

For example,
string str2 = string str2 = Conversions.ToString(123) + "\x0001\x001e" + Conversions.ToString(Strings.Chr(246)) + "\x0003\r$\x0003\n" + Conversions.ToString(Strings.Chr(227)) + "\r" + Conversions.ToString(Strings.Chr(244)) + "%" + Conversions.ToString(Strings.Chr(230)) + "\x001e5";
Console.WriteLine(str2);

or if you want to write it to a file do whatever you want with it like File.WriteAllText(output.txt, str2);

Use linqpad instead of creating new console projects every time you want to run short snippets/test code.


RE: need help with the output code C#? - VENI - Jul 18, 2020

(Jul 18, 2020 09:04 PM)iolaka Wrote:  Use linqpad instead of creating new console projects every time you want to run short snippets/test code.

This should be easier to use https://dotnetfiddle.net/


RE: need help with the output code C#? - greasyAlessandra - Jul 19, 2020

123ö
$
ã
ô%æ5

it is your output!!


RE: need help with the output code C#? - SaketSaket - Jul 19, 2020

(Jul 18, 2020 09:04 PM)iolaka Wrote:  Use linqpad instead of creating new console projects every time you want to run short snippets/test code.

Yes... it's really good...


RE: need help with the output code C#? - Saddam4live - Jul 19, 2020

thank you for every one replies ......

But when i execute the code in C# it gives me Error ?


(Jul 18, 2020 07:23 PM)N0P-RE Wrote:  You can solve this yourself, here are the steps:
1. Create a new console app in visualStudio in C#(Dont forget to add a reference to Microsoft.VisualBasic)
2. Copy and paste that code you provided into the console app and simply print the result.

For example,
string str2 = string str2 = Conversions.ToString(123) + "\x0001\x001e" + Conversions.ToString(Strings.Chr(246)) + "\x0003\r$\x0003\n" + Conversions.ToString(Strings.Chr(227)) + "\r" + Conversions.ToString(Strings.Chr(244)) + "%" + Conversions.ToString(Strings.Chr(230)) + "\x001e5";
Console.WriteLine(str2);

or if you want to write it to a file do whatever you want with it like File.WriteAllText(output.txt, str2);
this is the full code i need to know to know the password ?
public static string getconnection(string path, typeconn type)
{
string str;
try
{
switch (type)
{
case typeconn.acc2007:
return ("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\"" + path.ToString() + "\";Jet OLEDB:Database Password=123123");

case typeconn.acc2003:
{
string str2 = Conversions.ToString(0x7b) + "\x0001\x001e" + Conversions.ToString(Strings.Chr(0xf6)) + "\x0003\r$\x0003\n" + Conversions.ToString(Strings.Chr(0xe3)) + "\r" + Conversions.ToString(Strings.Chr(0xf4)) + "%" + Conversions.ToString(Strings.Chr(230)) + "\x001e5";
return ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\"" + path.ToString() + "\";Persist Security Info=True;Jet OLEDB:Database Password='" + str2 + "';");
}
}
}
catch (Exception exception1)
{
ProjectData.SetProjectError(exception1);
str = Conversions.ToString(false);
ProjectData.ClearProjectError();
}
return str;
}


(Jul 18, 2020 09:11 PM)N0P-RE Wrote:  This should be easier to use https://dotnetfiddle.net/
Look to the full code
I need to open 2003.mdb database

public static string getconnection(string path, typeconn type)
{
string str;
try
{
switch (type)
{
case typeconn.acc2007:
return ("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\"" + path.ToString() + "\";Jet OLEDB:Database Password=123123");

case typeconn.acc2003:
{
string str2 = Conversions.ToString(0x7b) + "\x0001\x001e" + Conversions.ToString(Strings.Chr(0xf6)) + "\x0003\r$\x0003\n" + Conversions.ToString(Strings.Chr(0xe3)) + "\r" + Conversions.ToString(Strings.Chr(0xf4)) + "%" + Conversions.ToString(Strings.Chr(230)) + "\x001e5";
return ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\"" + path.ToString() + "\";Persist Security Info=True;Jet OLEDB:Database Password='" + str2 + "';");
}
}
}
catch (Exception exception1)
{
ProjectData.SetProjectError(exception1);
str = Conversions.ToString(false);
ProjectData.ClearProjectError();
}
return str;
}


RE: need help with the output code C#? - Maxie - Jul 19, 2020

Seemingly the string contains characters that are not readable by humans such as SOH, line feed and carriage return.

I would programmatically put it in your clipboard so that you don't mess up. Especially since some IDEs might convert linefeed or carriage return to a combination of both. There might also be other conversion by the IDE.