Hack Forums
[.NET] How do you make a keygen? - 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: [.NET] How do you make a keygen? (/showthread.php?tid=1181561)



How do you make a keygen? - P.M.W - Apr 3, 2011

I have seen many tutorials on youtube that shows how to when a button is pressed it randomly goes through the keys that you have already entered. Is there a way so that when you press a button it automatically generates a key in the format ** - **** - *** - **** - ** but the * = a random number? Any help would be appreciated. I am noob so long detailed answers would be very good thanks.


* - Pussy Cat - Apr 3, 2011

So you just want it to generate random numbers in that format?


* - P.M.W - Apr 3, 2011

Yes, after a button is pressed :)


* - bryanpt15 - Apr 3, 2011

its fairly hard if you dont know how to make a simple program like a spammer...just saying


* - P.M.W - Apr 3, 2011

Okay I don't know how to do that but I'd love to do this :'(


* - Pussy Cat - Apr 3, 2011

If you just want it to generate random numbers in that format, this should work.
Code
TextBox1.Text = CInt(Int((9999 - 1000 + 1) * Rnd() + 1000)) & "-" & CInt(Int((99 - 100 + 1) * Rnd() + 100)) & "-" & CInt(Int((99 - 10000 + 1) * Rnd() + 10000)) & "-" & CInt(Int((99 - 100 + 1) * Rnd() + 100)) & "-" & CInt(Int((9999 - 1000 + 1) * Rnd() + 1000))



* - sl1ne - Apr 3, 2011

Just generate 4 keys with the lenght you want and then put them into one string. That isn't difficult.


* - Elfinity - Apr 3, 2011

Code
namespace hf
{
    class Program
    {
  static void Main(string[] args)
  {
    System.Random r = new System.Random();
    string str = "";
    int i;
    for (i = 0; i < 4; i++)
    str += r.Next(0,10);
    str += "-";
    for (i = 0; i < 6; i++)
    str += r.Next(0,10);
    str += "-";
    for (i = 0; i < 5; i++)
    str += r.Next(0,10);
    str += "-";
    for (i = 0; i < 6; i++)
    str += r.Next(0,10);
    str += "-";
    for (i = 0; i < 4; i++)
    str += r.Next(0,10);
    System.Console.WriteLine(str);

  }
    }
}
This generates Pseudo-Random numbers from [0,9].With the format you specified " 4 digits - 6 digits - 5 digits -6 digits - 4 digits ".After each iteration it adds the "-".
End Result:
Quote:1457-689226-72695-739804-3852
Press any key to continue . . .




* - P.M.W - Apr 3, 2011

(Apr 3, 2011 05:47 AM)Antti Wrote:  If you just want it to generate random numbers in that format, this should work.
Code
TextBox1.Text = CInt(Int((9999 - 1000 + 1) * Rnd() + 1000)) & "-" & CInt(Int((99 - 100 + 1) * Rnd() + 100)) & "-" & CInt(Int((99 - 10000 + 1) * Rnd() + 10000)) & "-" & CInt(Int((99 - 100 + 1) * Rnd() + 100)) & "-" & CInt(Int((9999 - 1000 + 1) * Rnd() + 1000))
Thank you very much does that mean when I press Button1 though because thats what I was getting at :) but thanks very much :)



(Apr 3, 2011 05:52 AM)Elfinity Wrote:  
Code
namespace hf
{
    class Program
    {
  static void Main(string[] args)
  {
    System.Random r = new System.Random();
    string str = "";
    int i;
    for (i = 0; i < 4; i++)
    str += r.Next(0,10);
    str += "-";
    for (i = 0; i < 6; i++)
    str += r.Next(0,10);
    str += "-";
    for (i = 0; i < 5; i++)
    str += r.Next(0,10);
    str += "-";
    for (i = 0; i < 6; i++)
    str += r.Next(0,10);
    str += "-";
    for (i = 0; i < 4; i++)
    str += r.Next(0,10);
    System.Console.WriteLine(str);

  }
    }
}
This generates Pseudo-Random numbers from [0,9].With the format you specified " 4 digits - 6 digits - 5 digits -6 digits - 4 digits ".After each iteration it adds the "-".
End Result:
Thanks very much im gonna try that :)




* - Pussy Cat - Apr 3, 2011

(Apr 3, 2011 05:53 AM)Deathwing Wrote:  Thank you very much does that mean when I press Button1 though because thats what I was getting at :) but thanks very much :)



Just put the code under a button and add textbox there.


* - 24601 - Apr 3, 2011

If you want to make an actual keygen, you could read this and then try to make it into a vb.net app. It might be a little over your head though, but if anyone else wants it:

KeyGen tut: http://www.mediafire.com/?bb4aavswbronu1a
Whole book: http://www.mediafire.com/?2om0nufjs27vjlg

BTW: this came from a book from

http://www.goldshare.co.uk

and I re-upped them


* - Toby Queef - Apr 3, 2011

(Apr 3, 2011 05:33 AM)Deathwing Wrote:  I have seen many tutorials on youtube that shows how to when a button is pressed it randomly goes through the keys that you have already entered. Is there a way so that when you press a button it automatically generates a key in the format ** - - - - * but the = a random number? Any help would be appreciated. I am noob so long detailed answers would be very good thanks.

If you want letters in there too you can use:

Code
Public Shared Function GenKey(ByVal length As Integer)
  Dim chars, final As New StringBuilder
  Dim r As New Random(Guid.NewGuid.GetHashCode)
  chars.Append("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
  For i = 0 To length - 1
    final.Append(chars(r.Next(1, chars.Length - 1)))
  Next
  Return final.ToString
    End Function

    Sub generateKey()
  Dim key As String = ""
  For i As Integer = 1 To 4
    key += GenKey(4)
  Next
  TextBox1.Text = key.TrimEnd("-")
    End Sub

Just change the lengths to suit you.




* - Stenography - Apr 3, 2011

thank u guys, im making fake youtube programs with aeonhack's themes , i will make fake windows 7 keys ... Yay