-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 73b12b4
Showing
43 changed files
with
3,810 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# License | ||
|
||
***ROTate*** - Encryption tool based on the ROT cipher | ||
|
||
Copyright © 2018 by Ralf Kilian | ||
|
||
Distributed under the *MIT License*: | ||
|
||
``` | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
``` |
This file contains 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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# *ROTate* <img src="rotate.png" alt="ROTate logo" height="48px" width="48px" align="right"/> | ||
|
||
**Table of contents** | ||
|
||
* [Definition](#definition) | ||
* [Details](#details) | ||
* [Components](#components) | ||
* [Requirements](#requirements) | ||
* [Documentation](#documentation) | ||
* [Useless facts](#useless-facts) | ||
|
||
---- | ||
|
||
## Definition | ||
|
||
The *ROTate* project is a collection of scripts to encrypt and decrypt files using various *ROT* cipher methods. | ||
|
||
[Top](#) | ||
|
||
## Details | ||
|
||
The project allows to encrypt and decrypt files using various ROT cipher methods such as *ROT13*, *ROT47*, *ROT128* as well as with enhanced variants based on each character set of these methods. | ||
|
||
It also comes with a tool to find out which variant and value has been used to encrypt a file. | ||
|
||
Due to the fact, that data encrypted with *ROT* methods can be cracked quite easily, they are **not** suitable for encrypting sensible data. | ||
|
||
[Top](#) | ||
|
||
## Components | ||
|
||
### *ROTate* variants | ||
|
||
There are three components to encrypt and decrypt files using the *ROT13*, *ROT47* and *ROT128* cipher method. | ||
|
||
They also allow using a user-defined rotation value (based on the character set of that cipher method) instead of the default rotation value. | ||
|
||
### *ROTate Cracker* | ||
|
||
As already mentioned above, data encrypted with *ROT* methods can be cracked quite easily. This brute force cracker helps to determine which *ROT* variant and rotation value has been used to encrypt a file or string by simply trying all supported variants with all rotation values available. | ||
|
||
[Top](#) | ||
|
||
## Requirements | ||
|
||
In order to use *ROTate*, the *Python* framework must be installed on the system. | ||
|
||
Depending on which version of the framework you are using: | ||
|
||
* *Python* 2.x (version 2.7 or higher is recommended, may also work with earlier versions) | ||
* *Python* 3.x (version 3.2 or higher is recommended, may also work with earlier versions) | ||
|
||
[Top](#) | ||
|
||
## Documentation | ||
|
||
In the corresponding `docs` sub-directories, there are plain text files containing a detailed documentation for each component with further information and usage examples. | ||
|
||
[Top](#) | ||
|
||
## Useless facts | ||
|
||
* The name *ROTate* stands for ***ROT*** *with* ***A**dditional* ***T**ools* *and* ***E**nhancements*. | ||
* The first version uploaded on *GitHub* was *ROTate* 3.0.6 built on March 13<sup>th</sup>, 2018. | ||
* Before uploading, the project has neither been changed nor even touched for more than three years. | ||
|
||
[Top](#) |
This file contains 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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
|
||
CHANGELOG (ROTate) | ||
|
||
Version 3.0.6 (2018-03-13) | ||
|
||
+ Added new versions of the Clap and PaVal core modules (replaced the | ||
existing ones). | ||
|
||
* Revised (refurbished) all components of the project in general | ||
(neglibible changes). | ||
|
||
# Fixed the wildcard bug (certain characters inside the strings to | ||
encrypt and decrypt and will no longer be interpreted as wildcards). | ||
|
||
Version 3.0.5 (2015-01-03) | ||
|
||
* Revised some code inside the ROTate Cracker core module (negligible | ||
changes). | ||
|
||
- Removed unnecessary module imports from the core modules. | ||
|
||
Version 3.0.4 (2014-04-03) | ||
|
||
+ Added an optional command-line argument to the ROTate Cracker script | ||
to write the integer ordinals of the decrypted string into the | ||
output file. | ||
|
||
Version 3.0.3 (2014-03-21) | ||
|
||
* Revised (reduced) some code inside the ROTate Cracker core module. | ||
* Revised the ROTate Cracker output file (non-printable characters are | ||
now replaced either with whitespaces or a corresponding notice). | ||
|
||
# Fixed the attribute error inside the ROTate Cracker core module when | ||
reading out the major version of the Python framework using Python | ||
version 2.6 or below. | ||
|
||
Version 3.0.2 (2014-03-14) | ||
|
||
+ Added an error handler to the ROTate scripts in case no command-line | ||
argument parser can be initialized. | ||
|
||
* Revised (reduced) some code inside the ROTate Cracker core module. | ||
* Revised the transform methods inside the ROT13, ROT47 and ROT128 | ||
core module (reduced some code for increased readability). | ||
|
||
Version 3.0.1 (2014-03-07) | ||
|
||
* Revised the description of some command-line arguments inside all | ||
ROTate scripts. | ||
* Revised the header of the ROTate Cracker output file (negligible | ||
text changes). | ||
|
||
Version 3.0.0 (2014-02-11) | ||
|
||
* First official release of this major version. | ||
|
Empty file.
This file contains 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 |
---|---|---|
@@ -0,0 +1,216 @@ | ||
#!/usr/bin/env python2 | ||
# -*- coding: utf-8 -*- | ||
|
||
# ============================================================================ | ||
# Clap - Command-line argument parser module | ||
# Copyright (C) 2018 by Ralf Kilian | ||
# Distributed under the MIT License (https://opensource.org/licenses/MIT) | ||
# | ||
# Website: http://www.urbanware.org | ||
# GitHub: https://github.com/urbanware-org/clap | ||
# ============================================================================ | ||
|
||
__version__ = "1.1.10" | ||
|
||
|
||
def get_version(): | ||
""" | ||
Return the version of this module. | ||
""" | ||
return __version__ | ||
|
||
|
||
class Parser(object): | ||
""" | ||
Project independent command-line argument parser class. | ||
""" | ||
__arg_grp_opt = None | ||
__arg_grp_req = None | ||
__arg_parser = None | ||
__is_argparser = False | ||
__conflict_handler = "resolve" # used by OptionParser, only | ||
|
||
def __init__(self): | ||
try: | ||
from argparse import ArgumentParser | ||
self.__arg_parser = ArgumentParser(add_help=False) | ||
self.__arg_grp_req = \ | ||
self.__arg_parser.add_argument_group("required arguments") | ||
self.__arg_grp_opt = \ | ||
self.__arg_parser.add_argument_group("optional arguments") | ||
self.__is_argparser = True | ||
return | ||
except ImportError: | ||
# Ignore the exception and proceed with the fallback | ||
pass | ||
|
||
try: | ||
from optparse import OptionParser | ||
self.__arg_parser = \ | ||
OptionParser(conflict_handler=self.__conflict_handler) | ||
self.__arg_grp_req = \ | ||
self.__arg_parser.add_option_group("Required arguments") | ||
self.__arg_grp_opt = \ | ||
self.__arg_parser.add_option_group("Optional arguments") | ||
return | ||
except ImportError: | ||
# This should never happen | ||
raise ImportError("Failed to initialize an argument parser.") | ||
|
||
def add_avalue(self, arg_short, arg_long, arg_help, arg_dest, arg_default, | ||
arg_required): | ||
""" | ||
Add an argument that expects a single user-defined value. | ||
""" | ||
if arg_required: | ||
obj = self.__arg_grp_req | ||
else: | ||
obj = self.__arg_grp_opt | ||
|
||
if arg_default is not None: | ||
# Enclose the value with quotes in case it is not an integer | ||
quotes = "'" | ||
try: | ||
arg_default = int(arg_default) | ||
quotes = "" | ||
except ValueError: | ||
pass | ||
|
||
if arg_help.strip().endswith(")"): | ||
arg_help = arg_help.rstrip(")") | ||
arg_help += ", default is %s%s%s)" % \ | ||
(quotes, str(arg_default), quotes) | ||
else: | ||
arg_help += " (default is %s%s%s)" % \ | ||
(quotes, str(arg_default), quotes) | ||
|
||
if self.__is_argparser: | ||
if arg_short is None: | ||
obj.add_argument(arg_long, help=arg_help, dest=arg_dest, | ||
default=arg_default, required=arg_required) | ||
else: | ||
obj.add_argument(arg_short, arg_long, help=arg_help, | ||
dest=arg_dest, default=arg_default, | ||
required=arg_required) | ||
else: | ||
if arg_short is None: | ||
obj.add_option(arg_long, help=arg_help, dest=arg_dest, | ||
default=arg_default) | ||
else: | ||
obj.add_option(arg_short, arg_long, help=arg_help, | ||
dest=arg_dest, default=arg_default) | ||
|
||
def add_predef(self, arg_short, arg_long, arg_help, arg_dest, arg_choices, | ||
arg_required): | ||
""" | ||
Add an argument that expects a certain predefined value. | ||
""" | ||
if arg_required: | ||
obj = self.__arg_grp_req | ||
else: | ||
obj = self.__arg_grp_opt | ||
|
||
if self.__is_argparser: | ||
if arg_short is None: | ||
obj.add_argument(arg_long, help=arg_help, dest=arg_dest, | ||
choices=arg_choices, required=arg_required) | ||
else: | ||
obj.add_argument(arg_short, arg_long, help=arg_help, | ||
dest=arg_dest, choices=arg_choices, | ||
required=arg_required) | ||
else: | ||
if arg_short is None: | ||
obj.add_option(arg_long, help=arg_help, dest=arg_dest, | ||
choices=arg_choices) | ||
else: | ||
# The OptionParser does not print the values to choose from, | ||
# so these have to be added manually to the description of | ||
# the argument first | ||
arg_help += " (choose from " | ||
for item in arg_choices: | ||
arg_help += "'%s', " % item | ||
arg_help = arg_help.rstrip(", ") + ")" | ||
|
||
obj.add_option(arg_short, arg_long, help=arg_help, | ||
dest=arg_dest) | ||
|
||
def add_switch(self, arg_short, arg_long, arg_help, arg_dest, arg_store, | ||
arg_required): | ||
""" | ||
Add an argument that does not expect anything, but returns a | ||
boolean value. | ||
""" | ||
if arg_required: | ||
obj = self.__arg_grp_req | ||
else: | ||
obj = self.__arg_grp_opt | ||
|
||
if arg_store: | ||
arg_store = "store_true" | ||
else: | ||
arg_store = "store_false" | ||
|
||
if self.__is_argparser: | ||
if arg_short is None: | ||
obj.add_argument(arg_long, help=arg_help, dest=arg_dest, | ||
action=arg_store, required=arg_required) | ||
else: | ||
obj.add_argument(arg_short, arg_long, help=arg_help, | ||
dest=arg_dest, action=arg_store, | ||
required=arg_required) | ||
else: | ||
if arg_short is None: | ||
obj.add_option(arg_long, help=arg_help, dest=arg_dest, | ||
action=arg_store) | ||
else: | ||
obj.add_option(arg_short, arg_long, help=arg_help, | ||
dest=arg_dest, action=arg_store) | ||
|
||
def dependency(self, arg_name, arg_value, dependency): | ||
""" | ||
Check the dependency of a command-line argument. | ||
""" | ||
if dependency is not None: | ||
if arg_value is None or str(arg_value) == "": | ||
raise Exception("The '%s' argument depends on %s'." % | ||
(arg_name, dependency)) | ||
|
||
def error(self, obj): | ||
""" | ||
Raise an error and cause the argument parser to print the error | ||
message. | ||
""" | ||
if type(obj) == str: | ||
obj = obj.strip() | ||
|
||
self.__arg_parser.error(obj) | ||
|
||
def parse_args(self): | ||
""" | ||
Parse and return the command-line arguments. | ||
""" | ||
if self.__is_argparser: | ||
args = self.__arg_parser.parse_args() | ||
else: | ||
(args, values) = self.__arg_parser.parse_args() | ||
return args | ||
|
||
def print_help(self): | ||
""" | ||
Print the usage, description, argument details and epilog. | ||
""" | ||
self.__arg_parser.print_help() | ||
|
||
def set_description(self, string): | ||
""" | ||
Set the description text. | ||
""" | ||
self.__arg_parser.description = string.strip() | ||
|
||
def set_epilog(self, string): | ||
""" | ||
Set the epilog text. | ||
""" | ||
self.__arg_parser.epilog = string.strip() | ||
|
||
# EOF |
Oops, something went wrong.