#๐Ÿ”’ so i am trying to solve this code and i am stuck please help

72 messages ยท Page 1 of 1 (latest)

quasi marshBOT
#

@waxen harness

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

waxen harness
#

This is the program we believe was used to encode the intercepted message.

some of the retrieved program was damaged (show as &&&&)

Can you use this to figure out how it was encoded and decode it?

Good Luck

import string
import random
from base64 import b64encode, b64decode

secret = '&&&&&&&&&&&&&&' # We don't know the original message or length

secret_encoding = ['step1', 'step2', 'step3']

def step1(s):
_step1 = string.maketrans("zyxwvutsrqponZYXWVUTSRQPONmlkjihgfedcbaMLKJIHGFEDCBA","mlkjihgfedcbaMLKJIHGFEDCBAzyxwvutsrqpo")
return string.translate(s, _step1)

def step2(s): return b64encode(s)

def step3(plaintext, shift=4):
loweralpha = string.ascii_lowercase
shifted_string = loweralpha[shift:] + loweralpha[:shift]
converted = string.maketrans(loweralpha, shifted_string)
return plaintext.translate(converted)

def make_secret(plain, count):
a = '2{}'.format(b64encode(plain))
for count in range(count):
r = random.choice(secret_encoding)
si = secret_encoding.index(r) + 1
_a = globals()r
a = '{}{}'.format(si, _a)
return a

if name == 'main':

print make_secret(secret, count=&&&)

#

this is the code

empty zephyr
#

!code

quasi marshBOT
#
Formatting code on Discord

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

For long code samples, you can use our pastebin.

waxen harness
empty zephyr
#

describe your error.

waxen harness
empty zephyr
#

and now, you have to work backwards, right?

waxen harness
empty zephyr
#

so start by understanding all the steps

#

make a reversed version of them

waxen harness
empty zephyr
#

yes

#

if there's a function that makes A -> B, make something that takes the B and makes it A. B -> A

waxen harness
empty zephyr
#

not really

#

but, it depends on your skill

#

it's more about the logic

waxen harness
empty zephyr
#

its fine focus on the logic ๐Ÿ˜ญ

waxen harness
#

yeah sorry im a lil bit slow just tryna decode this message ๐Ÿ˜ข

#

so i need to reverse the logic

empty zephyr
#

yes

#

and check if you can actually reverse the logoc

waxen harness
empty zephyr
#

I see a random.choice but random is not seeded

#

so you won't be able to reverse it

waxen harness
#

ohh okay so i cant reverse random.choise but i can reverse the other stuff

empty zephyr
#

it will be a blocker

waxen harness
#

ohh so what does this mean i wont be able to reverse it now do i got ot remove reverse.random

empty zephyr
#

do you have the encoded string with you

waxen harness
#

yes i do i will share

empty zephyr
#

is it a part of the question

waxen harness
#

yes it is

empty zephyr
#

or you were allowed to make it too

#

can you post the code again?

#

!paste

quasi marshBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

empty zephyr
#

use the above link

#

just post the code

#

i feel im missing something

#

just wanna cross check if the random is seeded

waxen harness
empty zephyr
#

not the string ๐Ÿ˜ข i meant the code

waxen harness
#

oh sorry il send

empty zephyr
#

you can run a small example program:

import random
a = [1, 2, 3]
print(random.choice(a))

to get a different number on each run

waxen harness
#

yeah i ran a small program

waxen harness
#

does

#

this mena i cna

#

reverse it

empty zephyr
#

no you can't

waxen harness
#

damn so what do i do now to be able to use this as a decoded

waxen harness
empty zephyr
#

idts

#

you might call smone else here

waxen harness
#

or

empty zephyr
#

post the channel name in #python-discussion

waxen harness
#

so i am trying to solve this code to try and decode the message and i am stuck please help

waxen harness
empty zephyr
#

it's fine, consult your professor

#

to seed the random generator

waxen harness
quasi marshBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.