Skip to content

Instantly share code, notes, and snippets.

@jacquerie
Last active October 28, 2023 16:09
Show Gist options
  • Star 20 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save jacquerie/cfb8a56636e2b9e12f51 to your computer and use it in GitHub Desktop.
Save jacquerie/cfb8a56636e2b9e12f51 to your computer and use it in GitHub Desktop.
How to decode the message at the end of Google Foobar
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import base64
MESSAGE = '''
EUYQGhMMSx0cU0FIU1MCFAQPG01NQ0gTAEICChUGBxZTRVxBSQoZFQYKHQpKSUNURhcVEgoUFR1I
SltDSBkBTRwKEAgQHxFCSkFJDgkJCgoGCkMLAQBGUklUQhMPAgAJCgYLV0MOSR0VAxAaABZBQVRP
TRICCRVIAk5IEg4dVFRfRkYZBgRARBI=
'''
KEY = 'jacopo.notarstefano'
result = []
for i, c in enumerate(base64.b64decode(MESSAGE)):
result.append(chr(ord(c) ^ ord(KEY[i % len(KEY)])))
print ''.join(result)
@psp65
Copy link

psp65 commented Aug 6, 2018

Line #16:
result.append(chr(c ^ ord(KEY[i % len(KEY)])))

(ord(c)) is creating error.

@maguttag
Copy link

#You probably have python 3

import base64

MESSAGE = '''
FkAGARcCAh4UUlROQUAKFRAVAEZLTUAWGxgNAgwAABFTQV1NQBAHAAQCAAIRU1hBQAgBExsGFRRK R09UUwgJDhUQEB0DCwhAWVRTAAQFDhACEQwCAxNSVE5BQBgJGRsXCgIJQFlUUxMGDwUcAAdGR1dH UgcVBwJKS1VTEg4ISkdPVFMWDgNGUgk=
'''

KEY = 'yourusername'

result = []
for i, c in enumerate(base64.b64decode(MESSAGE)):
result.append(chr(c ^ ord(KEY[i % len(KEY)])))

print(''.join(result))

@Warriorroxus
Copy link

#You probably have python 3

import base64

MESSAGE = '''
FkAGARcCAh4UUlROQUAKFRAVAEZLTUAWGxgNAgwAABFTQV1NQBAHAAQCAAIRU1hBQAgBExsGFRRK R09UUwgJDhUQEB0DCwhAWVRTAAQFDhACEQwCAxNSVE5BQBgJGRsXCgIJQFlUUxMGDwUcAAdGR1dH UgcVBwJKS1VTEg4ISkdPVFMWDgNGUgk=
'''

KEY = 'yourusername'

result = []
for i, c in enumerate(base64.b64decode(MESSAGE)):
result.append(chr(c ^ ord(KEY[i % len(KEY)])))

print(''.join(result))

bro but only user name (key) also giving error

@RahulKamma0369
Copy link

import base64
from itertools import cycle

message = input("Enter the encrypted message: ")

key = bytes(input("Enter your Google username: "), "utf8")

print(bytes(a ^ b for a, b in zip(base64.b64decode(message), cycle(key))))

@0x1h0b
Copy link

0x1h0b commented May 16, 2020

bro can you tell me what's the use of that decoded message ?

@RahulKamma0369
Copy link

bro can you tell me what's the use of that decoded message ?

it's just a congratulation message and there is no use of it other than that

@HitanshuGedam
Copy link

I got a dictionary after decoding the encrypted text.
It is this -> b"{'success' : 'great', 'colleague' : 'esteemed', 'efforts' : 'incredible', 'achievement' : 'unlocked', 'rabbits' : 'safe', 'foo' : 'win!'}"
what does this mean??

@azmatsiddique
Copy link

azmatsiddique commented Jul 9, 2020

####python2 code

import base64

MESSAGE = '''
EUYQGhMMSx0cU0FIU1MCFAQPG01NQ0gTAEICChUGBxZTRVxBSQoZFQYKHQpKSUNURhcVEgoUFR1I
SltDSBkBTRwKEAgQHxFCSkFJDgkJCgoGCkMLAQBGUklUQhMPAgAJCgYLV0MOSR0VAxAaABZBQVRP
TRICCRVIAk5IEg4dVFRfRkYZBgRARBI=
'''

KEY = 'jacopo.notarstefano'

result = []
for i, c in enumerate(base64.b64decode(MESSAGE)):
result.append(chr(ord(c) ^ ord(KEY[i % len(KEY)])))

print ''.join(result)

i also got same dictionary:
{'success' : 'great', 'colleague' : 'esteemed', 'efforts' : 'incredible', 'achievement' : 'unlocked', 'rabbits' : 'safe', 'foo' : 'win!'}

@jaltmayerpizzorno
Copy link

It's just a final challenge...

@shash-1511
Copy link

I also got this-

{'success' : 'great', 'colleague' : 'esteemed', 'efforts' : 'incredible', 'achievement' : 'unlocked', 'rabbits' : 'safe', 'foo' : 'win!'}

@AwokeKnowing
Copy link

I also got same. in 2016

@SakshamWebTeasor
Copy link

where can i find the key?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment