vdroy97 Posted January 5, 2013 Posted January 5, 2013 (edited) Hello Friends i am vijay studding in mca, i got a project in to find out key from your personal machine id, i try from long time but i cant solve this. here is given codeImports SystemImports System.IOImports System.ManagementImports System.Windows.FormsNamespace SecurityTest Friend Class productkey ' Methods Public Shared Function [date](ByVal st As String) As Integer Try Dim num As UInt64 = crypto.DecryptString(nconvert.toodec(st)) Dim hashCode As Integer = productkey.genrate.GetHashCode If (hashCode < 0) Then hashCode = (hashCode * -1) End If Return CInt((num - CULng((hashCode * &H5F5E100)))) Catch exception As Exception log.store("default", "Errorinnproductkey2.cs", exception.Message) Return 0 End Try End Function Public Shared Function genrate() As String Try Dim driveLetter As String = Path.GetDirectoryName(Application.ExecutablePath).Substring(0, 1) Dim str2 As String = productkey.getkey(driveLetter, "PNPDeviceID") Dim str3 As String = productkey.getkey(driveLetter, "Caption") Dim str4 As String = productkey.getkey(driveLetter, "Size") If ((((str2 Is Nothing) OrElse (str2 = "")) AndAlso ((str3 Is Nothing) OrElse (str3 = ""))) AndAlso ((str4 Is Nothing) OrElse (str4 = ""))) Then MessageBox.Show("Please Check Yours Installation..") Return "" End If Dim hashCode As Integer = str2.GetHashCode Dim num2 As Integer = str3.GetHashCode Dim num3 As Integer = str4.GetHashCode If (hashCode < 0) Then hashCode = (hashCode * -1) End If If (num2 < 0) Then num2 = (num2 * -1) End If If (num3 < 0) Then num3 = (num3 * -1) End If Dim str5 As String = nconvert.getcode(CULng(hashCode)) Dim str6 As String = nconvert.getcode(CULng(num2)) Dim str7 As String = nconvert.getcode(CULng(num3)) Return String.Concat(New String() { str5, "-", str6, "-", str7 }) Catch exception As Exception log.store("default", "Errorinnproductkey3.cs", exception.Message) Return "" End Try End Function Public Shared Function getkey(ByVal driveLetter As String, ByVal typ As String) As String Try productkey.type = typ productkey._driveLetter = driveLetter.ToUpper If Not productkey._driveLetter.Contains(":") Then productkey._driveLetter = (productkey._driveLetter & ":") End If productkey.matchDriveLetterWithSerial Return productkey._serialNumber Catch exception As Exception log.store("default", "Errorinnproductkey4.cs", exception.Message) Return "" End Try End Function Public Shared Function getValueInQuotes(ByVal inValue As String) As String Try Dim index As Integer = 0 Dim num2 As Integer = 0 index = inValue.IndexOf("""") num2 = inValue.IndexOf("""", CInt((index + 1))) Return inValue.Substring((index + 1), ((num2 - index) - 1)) Catch exception As Exception log.store("default", "Errorinnproductkey7.cs", exception.Message) Return "" End Try End Function Public Shared Sub matchDriveLetterWithSerial() Try Dim searcher As New ManagementObjectSearcher("SELECT * FROM Win32_LogicalDiskToPartition") Dim obj2 As ManagementObject For Each obj2 In searcher.Get Dim str2 As String = productkey.getValueInQuotes(obj2.Item("Dependent").ToString) Dim str As String = productkey.getValueInQuotes(obj2.Item("Antecedent").ToString).Split(New Char() { ","c })(0).Remove(0, 6).Trim If (str2 = productkey._driveLetter) Then Dim searcher2 As New ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive") Dim obj3 As ManagementObject For Each obj3 In searcher2.Get Dim str3 As String If (((obj3.Item("Name").ToString = ("\\.\PHYSICALDRIVE" & str)) And (obj3.Item("InterfaceType").ToString = "USB")) AndAlso (Not str3 = productkey.type Is Nothing)) Then If Not (str3 = "PNPDeviceID") Then If (str3 = "Caption") Then goto Label_0152 End If If (str3 = "Size") Then goto Label_016A End If Else productkey._serialNumber = productkey.parseSerialFromDeviceID(obj3.Item("PNPDeviceID").ToString) End If End If Continue For Label_0152: productkey._serialNumber = obj3.Item("Caption").ToString Continue For Label_016A: productkey._serialNumber = obj3.Item("Size").ToString Next End If Next Catch exception As Exception log.store("default", "Errorinnproductkey5.cs", exception.Message) End Try End Sub Public Shared Function parseSerialFromDeviceID(ByVal deviceId As String) As String Try Dim strArray As String() = deviceId.Split(New Char() { "\"c }) Dim index As Integer = (strArray.Length - 1) Return strArray(index).Split(New Char() { "&"c })(0) Catch exception As Exception log.store("default", "Errorinnproductkey6.cs", exception.Message) Return "" End Try End Function Public Shared Function verify(ByVal st As String) As Boolean Try Dim num As Integer = (((DateTime.Now.Year * &H2710) + (DateTime.Now.Month * 100)) + DateTime.Now.Day) staticstore.date = num Return (((num <= productkey.date(st)) AndAlso (productkey.date(st).ToString.Length = 8)) AndAlso (productkey.date(st).ToString.Substring(0, 3) = "201")) Catch exception As Exception log.store("default", "Errorinnproductkey1.cs", exception.Message) Return False End Try End Function ' Fields Private Shared _driveLetter As String Private Shared _serialNumber As String Private Shared type As String End ClassEnd Namespace'Convert CodeImports SystemNamespace SecurityTest Friend Class nconvert ' Methods Private Shared Function bincode(ByVal st As String) As String Try Dim str As String = "" Select Case st Case "2" str = "00" Exit Select Case "3" str = "00001" Exit Select Case "4" str = "00010" Exit Select Case "5" str = "00011" Exit Select Case "6" str = "00100" Exit Select Case "7" str = "00101" Exit Select Case "8" str = "00110" Exit Select Case "9" str = "00111" Exit Select Case "A" str = "01000" Exit Select Case "B" str = "01001" Exit Select Case "C" str = "01010" Exit Select Case "D" str = "01011" Exit Select Case "E" str = "01100" Exit Select Case "F" str = "01101" Exit Select Case "G" str = "01110" Exit Select Case "H" str = "01111" Exit Select Case "J" str = "10000" Exit Select Case "K" str = "10001" Exit Select Case "L" str = "10010" Exit Select Case "M" str = "10011" Exit Select Case "N" str = "10100" Exit Select Case "P" str = "10101" Exit Select Case "Q" str = "10110" Exit Select Case "R" str = "10111" Exit Select Case "S" str = "11000" Exit Select Case "T" str = "11001" Exit Select Case "U" str = "11010" Exit Select Case "V" str = "11011" Exit Select Case "W" str = "11100" Exit Select Case "X" str = "11101" Exit Select Case "Y" str = "11110" Exit Select Case "Z" str = "11" Exit Select End Select Return str Catch exception As Exception log.store("default", "Errorinnconvert7.cs", exception.Message) Return "" End Try End Function Public Shared Function getcode(ByVal cd As UInt64) As String Try Return nconvert.tohexa(nconvert.tobinary(cd)) Catch exception As Exception log.store("default", "Errorinnconvert1.cs", exception.Message) Return "" End Try End Function Private Shared Function gethex(ByVal st As String) As String Try Dim str As String = "" Select Case st Case "00" str = "2" Exit Select Case "00001" str = "3" Exit Select Case "00010" str = "4" Exit Select Case "00011" str = "5" Exit Select Case "00100" str = "6" Exit Select Case "00101" str = "7" Exit Select Case "00110" str = "8" Exit Select Case "00111" str = "9" Exit Select Case "01000" str = "A" Exit Select Case "01001" str = "B" Exit Select Case "01010" str = "C" Exit Select Case "01011" str = "D" Exit Select Case "01100" str = "E" Exit Select Case "01101" str = "F" Exit Select Case "01110" str = "G" Exit Select Case "01111" str = "H" Exit Select Case "10000" str = "J" Exit Select Case "10001" str = "K" Exit Select Case "10010" str = "L" Exit Select Case "10011" str = "M" Exit Select Case "10100" str = "N" Exit Select Case "10101" str = "P" Exit Select Case "10110" str = "Q" Exit Select Case "10111" str = "R" Exit Select Case "11000" str = "S" Exit Select Case "11001" str = "T" Exit Select Case "11010" str = "U" Exit Select Case "11011" str = "V" Exit Select Case "11100" str = "W" Exit Select Case "11101" str = "X" Exit Select Case "11110" str = "Y" Exit Select Case "11" str = "Z" Exit Select End Select Return str Catch exception As Exception log.store("default", "Errorinnconvert4.cs", exception.Message) Return "" End Try End Function Private Shared Function tobinary(ByVal cd As UInt64) As String Try Dim str As String = "" Do While (cd <> 0) str = ((cd Mod CULng(2)).ToString & str) cd = (cd / CULng(2)) Loop Return str Catch exception As Exception log.store("default", "Errorinnconvert2.cs", exception.Message) Return "" End Try End Function Private Shared Function tohexa(ByVal bin As String) As String Try Dim str As String = "" Dim length As Integer = bin.Length If ((length Mod 5) <> 0) Then Dim num2 As Integer = (length / 5) Dim num3 As Integer = (length - (num2 * 5)) num3 = (5 - num3) Dim i As Integer = 1 Do While (i <= num3) bin = ("0" & bin) i += 1 Loop End If Do While (bin.Length <> 0) Dim st As String = bin.Substring(0, 5) bin = bin.Substring(5) str = (str & nconvert.gethex(st)) Loop Return str Catch exception As Exception log.store("default", "Errorinnconvert3.cs", exception.Message) Return "" End Try End Function Private Shared Function toobinary(ByVal st As String) As String Try Dim str As String = "" Do While (st.Length <> 0) Dim str2 As String = st.Chars(0).ToString str = (str & nconvert.bincode(str2)) st = st.Substring(1) Loop Return str Catch exception As Exception log.store("default", "Errorinnconvert6.cs", exception.Message) Return "" End Try End Function Public Shared Function toodec(ByVal st As String) As UInt64 Try Dim str As String = nconvert.toobinary(st) Dim num As UInt64 = 0 Dim i As Integer = 0 Do While (str.Length <> 0) Dim num3 As UInt64 = (Convert.ToUInt64(str.Chars((str.Length - 1))) - CULng(&H30)) num = (num + (num3 * CULng(Math.Pow(2, CDbl(i)) str = str.Substring(0, (str.Length - 1)) i += 1 Loop Return num Catch exception As Exception log.store("default", "Errorinnconvert5.cs", exception.Message) Return 0 End Try End Function End ClassEnd Namespace'Crypto ClassClass crypto ' Methods Public Shared Function DecryptString(ByVal [me] As UInt64) As UInt64 Try Dim num As UInt64 = ([me] Mod CULng(10)) [me] = ([me] / CULng(10)) Dim num2 As UInt64 = 0 Do While ([me] <> 0) Dim num3 As UInt64 = ([me] Mod CULng(10)) If (num3 < num) Then num3 = (num3 + CULng(10)) End If Dim num4 As UInt64 = (num3 - num) num2 = ((num2 * CULng(10)) + num4) [me] = ([me] / CULng(10)) Loop Return num2 Catch exception As Exception log.store("default", "Errorincrypto2.cs", exception.Message) Return 0 End Try End Function Public Shared Function EncryptString(ByVal [me] As UInt64) As UInt64 Try Dim num As Integer = New Random().Next(9) Dim num2 As UInt64 = 0 Do While ([me] <> 0) Dim num3 As UInt64 = ([me] Mod CULng(10)) Dim num4 As UInt64 = (num3 + num) If (num4 >= 10) Then num4 = (num4 Mod CULng(10)) End If num2 = ((num2 * CULng(10)) + num4) [me] = ([me] / CULng(10)) Loop Return ((num2 * CULng(10)) + num) Catch exception As Exception log.store("default", "Errorincrypto1.cs", exception.Message) Return 0 End Try End Function End ClassEnd Namespace 'Here i try but not success Private Function bincode(ByVal st As String) As String Dim result As String Try Dim str As String = "" Select Case st Case "2" str = "00000" Case "3" str = "00001" Case "4" str = "00010" Case "5" str = "00011" Case "6" str = "00100" Case "7" str = "00101" Case "8" str = "00110" Case "9" str = "00111" Case "A" str = "01000" Case "B" str = "01001" Case "C" str = "01010" Case "D" str = "01011" Case "E" str = "01100" Case "F" str = "01101" Case "G" str = "01110" Case "H" str = "01111" Case "J" str = "10000" Case "K" str = "10001" Case "L" str = "10010" Case "M" str = "10011" Case "N" str = "10100" Case "P" str = "10101" Case "Q" str = "10110" Case "R" str = "10111" Case "S" str = "11000" Case "T" str = "11001" Case "U" str = "11010" Case "V" str = "11011" Case "W" str = "11100" Case "X" str = "11101" Case "Y" str = "11110" Case "Z" str = "11111" End Select result = str Catch exception As Exception result = "" End Try Return result End Function Private Function toobinary(ByVal st As String) As String Dim result As String Try Dim str As String = "" While st.Length <> 0 Dim str2 As String = st(0).ToString() str += bincode(str2) st = st.Substring(1) End While result = str Catch exception As Exception result = "" End Try Return result End Function Public Function DecryptString(ByVal [me] As ULong) As ULong Dim result As ULong Try Dim num As ULong = [me] Mod 10UL [me] /= 10UL Dim num2 As ULong = 0UL While [me] <> 0UL Dim num3 As ULong = [me] Mod 10UL If num3 < num Then num3 += 10UL End If Dim num4 As ULong = num3 - num num2 = num2 * 10UL + num4 [me] /= 10UL End While result = num2 Catch exception As Exception result = 0UL End Try Return result End Function Public Function toodec(ByVal st As String) As ULong Dim result As ULong Try Dim str As String = toobinary(st) Dim num As ULong = 0UL Dim i As Integer = 0 While str.Length <> 0 Dim num2 As ULong = Convert.ToUInt64(str(str.Length - 1)) - 48UL num += num2 * CULng(Math.Pow(2.0, CDec(i))) str = str.Substring(0, str.Length - 1) i += 1 End While result = num Catch exception As Exception result = 0UL End Try Return result End Function Public Function [date](ByVal st As String) As Integer Dim result Try Dim num As ULong = toodec(st) num = DecryptString(num) Dim hashCode As Integer = "RGZCCW-3P2EJBC-3G352ZB".GetHashCode If hashCode < 0 Then hashCode *= -1 End If Dim i2 As Int64 = 103287435787683895 Dim l As Long = CLng(hashCode) l = l * 100000000L Dim ul As ULong = CULng(l) ul = ul - num Dim I As Integer = CInt(ul) result = I 'result = CInt((num - CULng((CLng(hashCode) * 100000000L)))) Catch exception As Exception result = 0 End Try Return result End Function this project generate machine id from usb, and machine id depends product keyhere is my machine id RGZCCW3P2EJBC3G352ZBif any seniour coder solve this kindly sent it to me, or give me suggestion, how i get this key,thanks in advance Edited January 5, 2013 by vdroy97
mArTi Posted January 5, 2013 Posted January 5, 2013 If it's a school project, you should do this by yourself... You are supposed to learn from this, it won't give you magical skills to get it solved by anyone else. You can even debug the codeBy the way, reading it on a forum is terrible for my eyes. 1
vdroy97 Posted January 5, 2013 Author Posted January 5, 2013 If it's a school project, you should do this by yourself... You are supposed to learn from this, it won't give you magical skills to get it solved by anyone else. You can even debug the code By the way, reading it on a forum is terrible for my eyes. Thanks for your advice, by the way, really your eyes terrible, you don not read fully. also you dont know, why people post in the forum. brother i wrote that i studying in mca and find this project cryptography, to find out key for that project, i tried it to resolve it, but i cant. that i post in this forum to suggest me senior coder or help me to find out key, if senior coder solve this and they share his skill, we and specially me to learn more on this. and you also dont know the name of the forum, TUTS 4 YOU. better you search the meaning of this 3 word on dictionary.
mArTi Posted January 5, 2013 Posted January 5, 2013 1/ You are giving a plain source code which is not complete, awful to read, with "Here i try" in the middle and some unknown types ('Dim num As UInt64 = crypto.DecryptString(nconvert.toodec(st))' , crypto ? and even var 'log'). You don't even give an entry point or the way those functions are used.2/ This board has not be made to solve your homework but to help you in reverse engineering. If you really expect an answer (but I doubt anyone will answer), you'll have to say how the code is meant to be used, what did you try/have you done, what is your problem... Here, it's near a crack request (it could even be a serial request).3/ Negative repping me won't give you more answers. By the way, maybe I don't know a lot of things - as Socrates said - but I still can read (maybe it's my fault if there's missing types, no highlighting, no explanation; who knows ?).
vdroy97 Posted January 5, 2013 Author Posted January 5, 2013 (edited) 1/ You are giving a plain source code which is not complete, awful to read, with "Here i try" in the middle and some unknown types ('Dim num As UInt64 = crypto.DecryptString(nconvert.toodec(st))' , crypto ? and even var 'log'). You don't even give an entry point or the way those functions are used.2/ This board has not be made to solve your homework but to help you in reverse engineering. If you really expect an answer (but I doubt anyone will answer), you'll have to say how the code is meant to be used, what did you try/have you done, what is your problem... Here, it's near a crack request (it could even be a serial request).3/ Negative repping me won't give you more answers. By the way, maybe I don't know a lot of things - as Socrates said - but I still can read (maybe it's my fault if there's missing types, no highlighting, no explanation; who knows ?).Sorry For That i miss to post Crypto classHere it is Class crypto ' Methods Public Shared Function DecryptString(ByVal [me] As UInt64) As UInt64 Try Dim num As UInt64 = ([me] Mod CULng(10)) [me] = ([me] / CULng(10)) Dim num2 As UInt64 = 0 Do While ([me] <> 0) Dim num3 As UInt64 = ([me] Mod CULng(10)) If (num3 < num) Then num3 = (num3 + CULng(10)) End If Dim num4 As UInt64 = (num3 - num) num2 = ((num2 * CULng(10)) + num4) [me] = ([me] / CULng(10)) Loop Return num2 Catch exception As Exception log.store("default", "Errorincrypto2.cs", exception.Message) Return 0 End Try End Function Public Shared Function EncryptString(ByVal [me] As UInt64) As UInt64 Try Dim num As Integer = New Random().Next(9) Dim num2 As UInt64 = 0 Do While ([me] <> 0) Dim num3 As UInt64 = ([me] Mod CULng(10)) Dim num4 As UInt64 = (num3 + num) If (num4 >= 10) Then num4 = (num4 Mod CULng(10)) End If num2 = ((num2 * CULng(10)) + num4) [me] = ([me] / CULng(10)) Loop Return ((num2 * CULng(10)) + num) Catch exception As Exception log.store("default", "Errorincrypto1.cs", exception.Message) Return 0 End Try End Function End ClassEnd Namespace end entry point i describe that generate machine id from pendrive like this RGZCCW-3P2EJBC-3G352ZBthis is my machine id. this id generate from usb pendrive, and machine id depends product key. that the programe of cryptography. i am asking to senior coder in .net to dycrypt the coding and help me to using code for that. i am interesting to that logic they used to dycrypt. by the way thank you. Edited January 5, 2013 by vdroy97
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now