PureBASIC Challenge #2!
Posted: Sun May 15, 2005 12:49 pm
Ok, i've finished the second PureBASIC challenge... this one is HARD
To give you all a little head start, the word is randomly chosen from the server, then it is encrypted with a random alphanumeric string a-z A-Z 0-9
Both the encrypted word and the random alphanumeric string is given to you (the client) and its then down to you to reverse the encryption to try and get the origional word, send it to the server and recive the secret password
The encryption is not one way, it can be reversed but it requires a lot of logic, in the following source code for the client you are given the encryption routine in plain PureBASIC, so you should be able to work it out
P.S. The routine is the CheckKeyword()
Remember, the word is encrypted using the alphanumeric string which is randomized just for you everytime you connect, you can only have 4 or 5 trys (i can't remember :s!) before you must disconnect and reconnect which will give you a new encrypted word and alphanumeric string (I told you brute forcing will be out of the question)
Well good luck, and here is the source code!
Good luck! I think there should be some kind of prize for the first person to PM me the secret from the server, i will think of something
To give you all a little head start, the word is randomly chosen from the server, then it is encrypted with a random alphanumeric string a-z A-Z 0-9
Both the encrypted word and the random alphanumeric string is given to you (the client) and its then down to you to reverse the encryption to try and get the origional word, send it to the server and recive the secret password
The encryption is not one way, it can be reversed but it requires a lot of logic, in the following source code for the client you are given the encryption routine in plain PureBASIC, so you should be able to work it out
P.S. The routine is the CheckKeyword()
Remember, the word is encrypted using the alphanumeric string which is randomized just for you everytime you connect, you can only have 4 or 5 trys (i can't remember :s!) before you must disconnect and reconnect which will give you a new encrypted word and alphanumeric string (I told you brute forcing will be out of the question)
Well good luck, and here is the source code!
Code: Select all
Global alphanum$
#Server = "athecks.com"
#Port = 12000
Procedure.s CheckKeyword(keyword$)
For t = 1 To Len(keyword$)
If Asc(Mid(keyword$, t, 1)) > ASCLN And FindString(alphanum$, Mid(keyword$, t, 1), 0) > 0
Output$ + Bin(Asc(Mid(keyword$, t, 1))+Asc(Mid(keyword$, t-3, 1)))+"1"
ASCLN = Asc(Mid(alphanum$, t, 1))
Else
Output$ + "0"+Bin(Asc(Mid(keyword$, t, 1))+Asc(Mid(keyword$, t-3, 1)))
ASCLN = 0
EndIf
Next t
ProcedureReturn Output$
EndProcedure
If InitNetwork() = 0
MessageRequester("Error", "Can't initialize the network !", 0)
End
EndIf
OpenConsole()
ConsoleTitle("PureBASIC #2 Challenge")
PrintN("Connecting to server...")
ConnID = OpenNetworkConnection(#Server, #Port)
If ConnID
PrintN("Connected to server!")
PrintN("Awaiting Alpha & Word keys")
Repeat
If NetworkClientEvent(ConnID) = 2
RData$ = Space(500)
ReceiveNetworkData(ConnID, @RData$, 500)
If StringField(RData$, 1, " ") = "[#01]"
alphanum$ = StringField(StringField(RData$, 2, " "), 1, ":")
keyword$ = StringField(StringField(RData$, 2, " "), 2, ":")
Debug alphanum$
Debug keyword$
PrintN("Recived keys")
PrintN("Alphakey: "+alphanum$)
PrintN("Keyword: "+keyword$)
PrintN("")
PrintN("Please enter the decoded word:")
password$ = Input()
PrintN("")
SendNetworkString(ConnID, password$)
EndIf
If StringField(RData$, 1, " ") = "[#03]"
PrintN("Recived password correct signal from server")
PrintN("From server: "+Right(RData$, Len(RData$)-6))
EndIf
If StringField(RData$, 1, " ") = "[#04]"
PrintN(Right(RData$, Len(RData$)-6))
PrintN("Please enter the decoded word:")
password$ = Input()
PrintN("")
SendNetworkString(ConnID, password$)
EndIf
If StringField(RData$, 1, " ") = "[#08]"
PrintN("")
PrintN(Right(RData$, Len(RData$)-6))
EndIf
EndIf
Delay(10)
ForEver
Else
PrintN("Connection refused, please contact Tommeh")
EndIf
Good luck! I think there should be some kind of prize for the first person to PM me the secret from the server, i will think of something