Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UUencode #467

Merged
merged 12 commits into from
Oct 7, 2020
Merged

Add UUencode #467

merged 12 commits into from
Oct 7, 2020

Conversation

malathit
Copy link
Contributor

@malathit malathit commented Oct 3, 2020

Closes #433

@malathit
Copy link
Contributor Author

malathit commented Oct 3, 2020

ciphey -m ciphey/basemods/Decoders/uuencode.py -t "begin 666 <data>
> %:&5L;&\ 
>  
> end
>  "
Result 'hello' (y/N): y
Format used:
  uuencode
Final result: "hello"

@malathit malathit marked this pull request as ready for review October 3, 2020 16:19
@bee-san
Copy link
Member

bee-san commented Oct 3, 2020

Hey! We need tests for this :D

https://github.com/Ciphey/Ciphey/wiki/Testing-your-cracker---decoder

@SkeletalDemise
Copy link
Contributor

SkeletalDemise commented Oct 3, 2020

Hello. This doesn't seem to work for me. I tried putting begin 644 dcode_uuencode 05&AI<R!I<R!A('-E8W)E=``` ` end in a file and giving it to Ciphey, but it wouldn't decode.

I also tried just doing ciphey -t "05&AI<R!I<R!A('-E8W)E=```" but it also wouldn't work. Can you make sure your decoder works?

@bee-san
Copy link
Member

bee-san commented Oct 3, 2020

Hello. This doesn't seem to work for me. I tried putting begin 644 dcode_uuencode 05&AI<R!I<R!A('-E8W)E=``` ` end in a file and giving it to Ciphey, but it wouldn't decode.

I also tried just doing ciphey -t "05&AI<R!I<R!A('-E8W)E=```" but it also wouldn't work. Can you make sure your decoder works?

Ah, that's because it's not actually hooked up to Ciphey. It's not in init.

Note:

⚠️ Warning: This is a step often overlooked. In the Decoding folder there is a file called init.py. Edit this file and add your decoder to it.

In https://github.com/Ciphey/Ciphey/wiki/Adding-your-own-ciphers

Please also add your decoder to init :D

@SkeletalDemise
Copy link
Contributor

Yes you should add it to init.py, but that's not why it doesn't work for me. I added it locally and tested it, and it doesn't work for some reason.

@malathit malathit marked this pull request as draft October 3, 2020 17:53
@malathit
Copy link
Contributor Author

malathit commented Oct 4, 2020

Yes you should add it to init.py, but that's not why it doesn't work for me. I added it locally and tested it, and it doesn't work for some reason.

I have added a test case and in the test case if you see, the encoded text it has new lines(\n). I think the new lines are missing in your input and that is why the decoder was not working. This is how I encoded the input string

cat /tmp/hello.txt 
Hello my name is bee and I like dog and apple and tree
uuencode  -o /tmp/hello1.txt /tmp/hello.txt /dev/stdout
cat /tmp/hello1.txt
begin 644 /dev/stdout
M2&5L;&\@;7D@;F%M92!I<R!B964@86YD($D@;&EK92!D;V<@86YD(&%P<&QE
)(&%N9"!T<F5E
`
end

I tested like this

ciphey -m uuencode.py -f /tmp/hello1.txt
Result 'Hello my name is bee and I like dog and apple and tree' (y/N): y
Format used:
  uuencode
Final result: "Hello my name is bee and I like dog and apple and tree"

Though it is feasible to make a small change in the code to accept the multi line input string using -t option, I am not sure if I need to do that as well.

@bee-san @SkeletalDemise Please advice

@malathit
Copy link
Contributor Author

malathit commented Oct 5, 2020

As suggested by @SkeletalDemise, added the support to decode strings without the begin prefix and end suffix, using the package binascii

@malathit malathit marked this pull request as ready for review October 5, 2020 05:04
@bee-san
Copy link
Member

bee-san commented Oct 6, 2020

Is it possible to have both newlines and no newlines to work? :) How common is new lines in UUencode?

@malathit
Copy link
Contributor Author

malathit commented Oct 6, 2020

Is it possible to have both newlines and no newlines to work? :) How common is new lines in UUencode?

@bee-san looks like the uuencode algorithm encodes data in 45 bytes chunk. If the input length is more than 45 bytes, the algorithm will split the data in 45 bytes chunk and then output each of the 45 bytes chunk in a line. So I guess the new lines are common.

As of now, the code supports input with or without new lines. The only thing though is if the original text is >45 bytes and the input text to ciphey doesn't have the new line, then the code may not work. It will work with a new line though as given below

malathi@my-system > ciphey -m uuencode.py -t 'M2&5L;&\@;7D@;F%M92!I<R!B964@86YD($D@;&EK92!D;V<@86YD(&%P<&QE              
quote> )(&%N9"!T<F5E
quote> '
Result 'Hello my name is bee and I like dog and apple and tree' (y/N): y
Format used:
  uuencode
Final result: "Hello my name is bee and I like dog and apple and tree"

@SkeletalDemise SkeletalDemise changed the title uuencode decoder Add UUencode Oct 7, 2020
@SkeletalDemise SkeletalDemise merged commit a4324f3 into Ciphey:master Oct 7, 2020
@bee-san
Copy link
Member

bee-san commented May 20, 2021

Hey we're changing from MIT to GPLv3 because some of our projects are licensed with that, do you approve? If you do not approve we will be forced to delete your code and rewrite it 😢

By approving of this change, you are agreeing to re-license the code you wrote under GPLv3.

@malathit
Copy link
Contributor Author

malathit commented May 20, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add UUencode decoder
3 participants