-
Notifications
You must be signed in to change notification settings - Fork 25
feat: remove deuteroui #176
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
Open
k4rt0fl3r
wants to merge
7
commits into
cybermouflons:dev
Choose a base branch
from
k4rt0fl3r:feat/ctf/remove-deuteroui
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c0b1a7e
delete deuteroui
k4rt0fl3r 4fe80d8
delete pyproject.toml
k4rt0fl3r 9abb976
black formatted
k4rt0fl3r a07b917
resolve utils.py rotn conflict
k4rt0fl3r e7ef087
re-arrange imports to resolve conflict utils.py
k4rt0fl3r b408f32
resolve conflict
k4rt0fl3r dc34a04
resolve unrelated changes
k4rt0fl3r File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,19 @@ | ||
| import logging | ||
| from ovisbot.helpers import chunkify | ||
| import struct | ||
| import string | ||
| import crypt | ||
|
|
||
| from Crypto.Util.number import long_to_bytes, bytes_to_long | ||
| from discord.ext import commands | ||
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
| def rotn_helper(offset, text): | ||
| shifted = string.ascii_lowercase[offset:] + string.ascii_lowercase[:offset] +\ | ||
| string.ascii_uppercase[offset:] + string.ascii_uppercase[:offset] | ||
| shifted_tab = str.maketrans(string.ascii_letters, shifted) | ||
| return text.translate(shifted_tab) | ||
|
|
||
| class Utils(commands.Cog): | ||
| def __init__(self, bot): | ||
|
|
@@ -53,14 +60,59 @@ async def hex2str(self, ctx, param): | |
|
|
||
| @utils.command() | ||
| async def rotn(self, ctx, shift, *params): | ||
| shift = int(shift) | ||
| ''' | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here 🙏
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should be OK now, too :) |
||
| Returns the ROT-n encoding of a message. | ||
| ''' | ||
| msg = ' '.join(params) | ||
| shifted = string.ascii_lowercase[shift:] + string.ascii_lowercase[:shift] +\ | ||
| string.ascii_uppercase[shift:] + string.ascii_uppercase[:shift] | ||
| shifted_tab = str.maketrans(string.ascii_letters, shifted) | ||
| shifted_str = msg.translate(shifted_tab) | ||
| await ctx.send(f"{msg} => {shifted_str}") | ||
| out = 'Original message:\n' + msg | ||
| if shift == "*": | ||
| for s in range(1, 14): | ||
| out += f'\n=[ ROT({s}) ]=\n' | ||
| out += rotn_helper(s, msg) | ||
| else: | ||
| shift = int(shift) | ||
| shifted_str = rotn_helper(shift, msg) | ||
|
|
||
| out += f'\n=[ ROT({shift}) ]=\n' | ||
| out += 'Encoded message:\n' + shifted_str | ||
|
|
||
| for chunk in chunkify(out, 1700): | ||
| await ctx.send("".join(["```", chunk, "```"])) | ||
|
|
||
| @utils.command() | ||
| async def genshadow(self, ctx, cleartext, method = None): | ||
| ''' | ||
| genshadow, generates a UNIX password hash and a corresponding /etc/shadow entry | ||
| and is intended for usage in boot2root environments | ||
|
|
||
| Available hash types: | ||
| + MD5 | ||
| + Blowfish | ||
| + SHA-256 | ||
| + SHA-512 | ||
| ''' | ||
| __methods = { | ||
| "1": crypt.METHOD_MD5, | ||
| "MD5": crypt.METHOD_MD5, | ||
|
|
||
| "2": crypt.METHOD_BLOWFISH, | ||
| "BLOWFISH": crypt.METHOD_BLOWFISH, | ||
|
|
||
| "5": crypt.METHOD_SHA256, | ||
| "SHA256": crypt.METHOD_SHA256, | ||
|
|
||
| "6": crypt.METHOD_SHA512, | ||
| "SHA512": crypt.METHOD_SHA512 | ||
| } | ||
| if method and not method.isnumeric(): | ||
| method = method.upper() | ||
| method = __methods.get(method, None) | ||
|
|
||
| unix_passwd = crypt.crypt(cleartext, method) | ||
| shadow = f"root:{unix_passwd}:0:0:99999:7::" | ||
| await ctx.send(f"{cleartext}:\n" +\ | ||
| f"=> {unix_passwd}\n" +\ | ||
| f"=> {shadow}") | ||
|
|
||
| def setup(bot): | ||
| bot.add_cog(Utils(bot)) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change seems unrelated to the goal of this PR - can you please rebase so it goes away and only the notebook related changes are left? 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be OK now :)