Package: enigma-cli
Author:Cory J. EngdahlEmail:cjengdahl@gmail.comWebpage:http://www.cjengdahl.comLicense:MITDescriptionGerman Enigma Machine Command-Line Tool (EnigmaI, M1, M2, M3, M4 Models).
Replicates the exact functionality of the physical machines used in WWII
with an easy to use command-line interface.Installationenigma requires the installation of thepython3interpreter.  The only third-party package dependency isClick.  If you choose to install via pip, Click will be installed as well.Install with pip:pip installenigma-cliThe source can be cloned fromhttps://github.com/cjengdahl/EnigmaConfigurationJust like an actual Enigma Machine, the simulated machine must be configured before use.  The configuration
serves as the ‘key’.  The same key is used to encrypt and decrypt text. The setup configurations are stored in a config file, which can be modified through the command line interface.  A default configuration is always available, along with a single, modifiable user configuration named ‘User’.  It is required
that the following items are specified before use:Enigma ModelRotors Used (ID)Rotor Start PostionsRotor Ring PostionsReflectorPlugs Inserted In PlugboardPreferencesIn addition to the machine configuration, there are also user preferences that can be set. These include output grouping, newline removal, space handling, space detection, default configuration, state remembrance, and progressbar inclusion.Detailed preference description:Output groupinggroups the output text to the specified number of characters.  Historically, messages where separated by a space every five characters.  This preference is ignored if the space handling preference is set to ‘keep’ or ‘X’.Newline removalreplaces newline characters with a space.  This is only applicable to file input, not encrypting directly from standard input.Space handlingallows the user to specify if spaces should be kept in the cipher text, removed, or replaced with an “X” before encryption.  Historically, it was common to replace spaces with an “X” because the character itself was not commonly used.Space detectiongoes hand in hand with the space replacement.  During the decryption process, if an “X” is found, it is replaced with a space.Thedefault configurationis the configuration that will be loaded automatically every time an enigma command is executed.  By default, the “User” configuration is loaded; however, addition configurations can be specified.The enigma can be placed in astate of remembrance.  With this enabled, for each character encrypted/decrypted the state of the machine is saved the nexted use (i.e. the rotor positions are saved after use)Lastly, the command line can include aprogressbarwhile encrypting or decrypting to show the elapsed progress)Usageenigma [OPTIONS] COMMAND [ARGS]…Commands are listed as follows:encrypt <text>Encrypts text input with Enigma Machine.  All input is converted to uppercase and non-alphabetic characters (with the exception of spaces and newline characters) are removed.  Text is optional and takes priority over file input.Alias:decryptOptions:-s,--spaces[remove | X | keep]Set space handling preference-n,--newlines[True | False]Include newline characters-d,--space-detect[True | False]Convert decrypted Xs to spaces-g,--groupTEXTSet output letter grouping-m,--modelTEXTEnigma machine model-r1,--fastTEXTFast rotor config: id (1-8) , position (1-26), and ring setting (1-26)-r2,--middleTEXTMiddle rotor config: id (1-8) , position (1-26), and ring setting (1-26)-r3,--slowTEXTSlow rotor config: id (1-8) , position (1-26), and ring setting (1-26)-r4,--staticTEXTStatic rotor config: (9 for beta, 10 for gamma), position (1-26), and ring setting (1-26)-r,--reflect[UKW-A|UKW-B|UKW-C|UKW-B_THIN|UKW-C_THIN]Enigma reflector-p,--plugsTEXTPlugs inserted in plugboard (e.g. “AB,XY”)-c,--selectTEXTSelect enigma machine configuration-u,--updateOverwrite config file with invoked preferences, and options-k,--remember[True | False]Remember machine state after encryption-f,--inputFILENAMEPath to input file-o,--outputFILENAMEPath to output fileclearClears all users configurations with the exception of ‘Default’ and ‘User’.delete <configuration>Deletes specified user configuration. Default and User configs can not be deletedlist <configuration>Lists the existing user configurations.  Lists configuration details if specific configuration provided as an argumentnew <configuration>Options:-m,--model[EnigmaI | M2 | M3 | M4]Enigma machine model-r1,--fastTEXTFast rotor config: id (1-8) , position (1-26), and ring setting (1-26)-r2,--middleTEXTMiddle rotor config: id (1-8) , position (1-26), and ring setting (1-26)-r3,--slowTEXTSlow rotor config: id (1-8) , position (1-26), and ring setting (1-26)-r4,--staticTEXTStatic rotor config: (9 for beta, 10 for gamma), position (1-26), and ring setting (1-26)-r,--reflect[UKW-A|UKW-B|UKW-C|UKW-B_THIN|UKW-C_THIN]Enigma reflector-p,--plugsTEXTPlugs inserted in plugboard (e.g. “AB,XY”)prefManages the default preferences.  Invoked options updates preferencesOptions:-s,--spaces[remove | X | keep]Set space handling preference-n,--newlines[True | False]Include newline characters-d,--space-detect[True | False]Convert decrypted Xs to spaces-g,--groupTEXTSet output letter grouping-c,--selectTEXTSelect enigma machine configuration-k,--remember[True | False]Remember machine state after encryption-p,--progess[True | False]Show progressbarreset <configuration>Resets specified configuration to “Default” settings.Basic ExamplesCreate new configuration:$enigmanewconfig1--modelM3--fast1,2,3--middle5,12,23--slow2,17,9--plugsAB,GD,KL,IU--reflectUKW-BEncrypt from standard input:$enigmapref--selectconfig1$enigmaencrypt"Hello World"Encrypting[####################################]  100%CMQYTPZVTSEncrypt from file input, keeping spaces:$enigmaencrypt-f/usr/share/dict/words-o~/Desktop/demo.txtEncrypting[####################################]  100%$less~/Desktop/demo.txtYBPVUBWLEKKWBBDLZSOVDPGRTPSPWZSXDJLKFIRLRFMNAFTQGNKMNTCOBZDJSQDTCVXCAPBTQ...