Skip to content
This repository was archived by the owner on Aug 7, 2025. It is now read-only.

Commit 73b12b4

Browse files
committed
Initial upload
0 parents  commit 73b12b4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+3810
-0
lines changed

LICENSE.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# License
2+
3+
***ROTate*** - Encryption tool based on the ROT cipher
4+
5+
Copyright © 2018 by Ralf Kilian
6+
7+
Distributed under the *MIT License*:
8+
9+
```
10+
Permission is hereby granted, free of charge, to any person obtaining a copy
11+
of this software and associated documentation files (the "Software"), to deal
12+
in the Software without restriction, including without limitation the rights
13+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14+
copies of the Software, and to permit persons to whom the Software is
15+
furnished to do so, subject to the following conditions:
16+
17+
The above copyright notice and this permission notice shall be included in all
18+
copies or substantial portions of the Software.
19+
20+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26+
SOFTWARE.
27+
```

README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# *ROTate* <img src="rotate.png" alt="ROTate logo" height="48px" width="48px" align="right"/>
2+
3+
**Table of contents**
4+
5+
* [Definition](#definition)
6+
* [Details](#details)
7+
* [Components](#components)
8+
* [Requirements](#requirements)
9+
* [Documentation](#documentation)
10+
* [Useless facts](#useless-facts)
11+
12+
----
13+
14+
## Definition
15+
16+
The *ROTate* project is a collection of scripts to encrypt and decrypt files using various *ROT* cipher methods.
17+
18+
[Top](#)
19+
20+
## Details
21+
22+
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.
23+
24+
It also comes with a tool to find out which variant and value has been used to encrypt a file.
25+
26+
Due to the fact, that data encrypted with *ROT* methods can be cracked quite easily, they are **not** suitable for encrypting sensible data.
27+
28+
[Top](#)
29+
30+
## Components
31+
32+
### *ROTate* variants
33+
34+
There are three components to encrypt and decrypt files using the *ROT13*, *ROT47* and *ROT128* cipher method.
35+
36+
They also allow using a user-defined rotation value (based on the character set of that cipher method) instead of the default rotation value.
37+
38+
### *ROTate Cracker*
39+
40+
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.
41+
42+
[Top](#)
43+
44+
## Requirements
45+
46+
In order to use *ROTate*, the *Python* framework must be installed on the system.
47+
48+
Depending on which version of the framework you are using:
49+
50+
* *Python* 2.x (version 2.7 or higher is recommended, may also work with earlier versions)
51+
* *Python* 3.x (version 3.2 or higher is recommended, may also work with earlier versions)
52+
53+
[Top](#)
54+
55+
## Documentation
56+
57+
In the corresponding `docs` sub-directories, there are plain text files containing a detailed documentation for each component with further information and usage examples.
58+
59+
[Top](#)
60+
61+
## Useless facts
62+
63+
* The name *ROTate* stands for ***ROT*** *with* ***A**dditional* ***T**ools* *and* ***E**nhancements*.
64+
* The first version uploaded on *GitHub* was *ROTate* 3.0.6 built on March 13<sup>th</sup>, 2018.
65+
* Before uploading, the project has neither been changed nor even touched for more than three years.
66+
67+
[Top](#)

python2/changelog.txt

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
2+
CHANGELOG (ROTate)
3+
4+
Version 3.0.6 (2018-03-13)
5+
6+
+ Added new versions of the Clap and PaVal core modules (replaced the
7+
existing ones).
8+
9+
* Revised (refurbished) all components of the project in general
10+
(neglibible changes).
11+
12+
# Fixed the wildcard bug (certain characters inside the strings to
13+
encrypt and decrypt and will no longer be interpreted as wildcards).
14+
15+
Version 3.0.5 (2015-01-03)
16+
17+
* Revised some code inside the ROTate Cracker core module (negligible
18+
changes).
19+
20+
- Removed unnecessary module imports from the core modules.
21+
22+
Version 3.0.4 (2014-04-03)
23+
24+
+ Added an optional command-line argument to the ROTate Cracker script
25+
to write the integer ordinals of the decrypted string into the
26+
output file.
27+
28+
Version 3.0.3 (2014-03-21)
29+
30+
* Revised (reduced) some code inside the ROTate Cracker core module.
31+
* Revised the ROTate Cracker output file (non-printable characters are
32+
now replaced either with whitespaces or a corresponding notice).
33+
34+
# Fixed the attribute error inside the ROTate Cracker core module when
35+
reading out the major version of the Python framework using Python
36+
version 2.6 or below.
37+
38+
Version 3.0.2 (2014-03-14)
39+
40+
+ Added an error handler to the ROTate scripts in case no command-line
41+
argument parser can be initialized.
42+
43+
* Revised (reduced) some code inside the ROTate Cracker core module.
44+
* Revised the transform methods inside the ROT13, ROT47 and ROT128
45+
core module (reduced some code for increased readability).
46+
47+
Version 3.0.1 (2014-03-07)
48+
49+
* Revised the description of some command-line arguments inside all
50+
ROTate scripts.
51+
* Revised the header of the ROTate Cracker output file (negligible
52+
text changes).
53+
54+
Version 3.0.0 (2014-02-11)
55+
56+
* First official release of this major version.
57+

python2/core/__init__.py

Whitespace-only changes.

python2/core/clap.py

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
#!/usr/bin/env python2
2+
# -*- coding: utf-8 -*-
3+
4+
# ============================================================================
5+
# Clap - Command-line argument parser module
6+
# Copyright (C) 2018 by Ralf Kilian
7+
# Distributed under the MIT License (https://opensource.org/licenses/MIT)
8+
#
9+
# Website: http://www.urbanware.org
10+
# GitHub: https://github.com/urbanware-org/clap
11+
# ============================================================================
12+
13+
__version__ = "1.1.10"
14+
15+
16+
def get_version():
17+
"""
18+
Return the version of this module.
19+
"""
20+
return __version__
21+
22+
23+
class Parser(object):
24+
"""
25+
Project independent command-line argument parser class.
26+
"""
27+
__arg_grp_opt = None
28+
__arg_grp_req = None
29+
__arg_parser = None
30+
__is_argparser = False
31+
__conflict_handler = "resolve" # used by OptionParser, only
32+
33+
def __init__(self):
34+
try:
35+
from argparse import ArgumentParser
36+
self.__arg_parser = ArgumentParser(add_help=False)
37+
self.__arg_grp_req = \
38+
self.__arg_parser.add_argument_group("required arguments")
39+
self.__arg_grp_opt = \
40+
self.__arg_parser.add_argument_group("optional arguments")
41+
self.__is_argparser = True
42+
return
43+
except ImportError:
44+
# Ignore the exception and proceed with the fallback
45+
pass
46+
47+
try:
48+
from optparse import OptionParser
49+
self.__arg_parser = \
50+
OptionParser(conflict_handler=self.__conflict_handler)
51+
self.__arg_grp_req = \
52+
self.__arg_parser.add_option_group("Required arguments")
53+
self.__arg_grp_opt = \
54+
self.__arg_parser.add_option_group("Optional arguments")
55+
return
56+
except ImportError:
57+
# This should never happen
58+
raise ImportError("Failed to initialize an argument parser.")
59+
60+
def add_avalue(self, arg_short, arg_long, arg_help, arg_dest, arg_default,
61+
arg_required):
62+
"""
63+
Add an argument that expects a single user-defined value.
64+
"""
65+
if arg_required:
66+
obj = self.__arg_grp_req
67+
else:
68+
obj = self.__arg_grp_opt
69+
70+
if arg_default is not None:
71+
# Enclose the value with quotes in case it is not an integer
72+
quotes = "'"
73+
try:
74+
arg_default = int(arg_default)
75+
quotes = ""
76+
except ValueError:
77+
pass
78+
79+
if arg_help.strip().endswith(")"):
80+
arg_help = arg_help.rstrip(")")
81+
arg_help += ", default is %s%s%s)" % \
82+
(quotes, str(arg_default), quotes)
83+
else:
84+
arg_help += " (default is %s%s%s)" % \
85+
(quotes, str(arg_default), quotes)
86+
87+
if self.__is_argparser:
88+
if arg_short is None:
89+
obj.add_argument(arg_long, help=arg_help, dest=arg_dest,
90+
default=arg_default, required=arg_required)
91+
else:
92+
obj.add_argument(arg_short, arg_long, help=arg_help,
93+
dest=arg_dest, default=arg_default,
94+
required=arg_required)
95+
else:
96+
if arg_short is None:
97+
obj.add_option(arg_long, help=arg_help, dest=arg_dest,
98+
default=arg_default)
99+
else:
100+
obj.add_option(arg_short, arg_long, help=arg_help,
101+
dest=arg_dest, default=arg_default)
102+
103+
def add_predef(self, arg_short, arg_long, arg_help, arg_dest, arg_choices,
104+
arg_required):
105+
"""
106+
Add an argument that expects a certain predefined value.
107+
"""
108+
if arg_required:
109+
obj = self.__arg_grp_req
110+
else:
111+
obj = self.__arg_grp_opt
112+
113+
if self.__is_argparser:
114+
if arg_short is None:
115+
obj.add_argument(arg_long, help=arg_help, dest=arg_dest,
116+
choices=arg_choices, required=arg_required)
117+
else:
118+
obj.add_argument(arg_short, arg_long, help=arg_help,
119+
dest=arg_dest, choices=arg_choices,
120+
required=arg_required)
121+
else:
122+
if arg_short is None:
123+
obj.add_option(arg_long, help=arg_help, dest=arg_dest,
124+
choices=arg_choices)
125+
else:
126+
# The OptionParser does not print the values to choose from,
127+
# so these have to be added manually to the description of
128+
# the argument first
129+
arg_help += " (choose from "
130+
for item in arg_choices:
131+
arg_help += "'%s', " % item
132+
arg_help = arg_help.rstrip(", ") + ")"
133+
134+
obj.add_option(arg_short, arg_long, help=arg_help,
135+
dest=arg_dest)
136+
137+
def add_switch(self, arg_short, arg_long, arg_help, arg_dest, arg_store,
138+
arg_required):
139+
"""
140+
Add an argument that does not expect anything, but returns a
141+
boolean value.
142+
"""
143+
if arg_required:
144+
obj = self.__arg_grp_req
145+
else:
146+
obj = self.__arg_grp_opt
147+
148+
if arg_store:
149+
arg_store = "store_true"
150+
else:
151+
arg_store = "store_false"
152+
153+
if self.__is_argparser:
154+
if arg_short is None:
155+
obj.add_argument(arg_long, help=arg_help, dest=arg_dest,
156+
action=arg_store, required=arg_required)
157+
else:
158+
obj.add_argument(arg_short, arg_long, help=arg_help,
159+
dest=arg_dest, action=arg_store,
160+
required=arg_required)
161+
else:
162+
if arg_short is None:
163+
obj.add_option(arg_long, help=arg_help, dest=arg_dest,
164+
action=arg_store)
165+
else:
166+
obj.add_option(arg_short, arg_long, help=arg_help,
167+
dest=arg_dest, action=arg_store)
168+
169+
def dependency(self, arg_name, arg_value, dependency):
170+
"""
171+
Check the dependency of a command-line argument.
172+
"""
173+
if dependency is not None:
174+
if arg_value is None or str(arg_value) == "":
175+
raise Exception("The '%s' argument depends on %s'." %
176+
(arg_name, dependency))
177+
178+
def error(self, obj):
179+
"""
180+
Raise an error and cause the argument parser to print the error
181+
message.
182+
"""
183+
if type(obj) == str:
184+
obj = obj.strip()
185+
186+
self.__arg_parser.error(obj)
187+
188+
def parse_args(self):
189+
"""
190+
Parse and return the command-line arguments.
191+
"""
192+
if self.__is_argparser:
193+
args = self.__arg_parser.parse_args()
194+
else:
195+
(args, values) = self.__arg_parser.parse_args()
196+
return args
197+
198+
def print_help(self):
199+
"""
200+
Print the usage, description, argument details and epilog.
201+
"""
202+
self.__arg_parser.print_help()
203+
204+
def set_description(self, string):
205+
"""
206+
Set the description text.
207+
"""
208+
self.__arg_parser.description = string.strip()
209+
210+
def set_epilog(self, string):
211+
"""
212+
Set the epilog text.
213+
"""
214+
self.__arg_parser.epilog = string.strip()
215+
216+
# EOF

0 commit comments

Comments
 (0)