Exemplo n.º 1
0
def main():
    parser = optparse.OptionParser(usage=usage, version=Version)
    parser.add_option('-i',
                      '--input',
                      type='string',
                      dest='inputfile',
                      help="File Input Path For Encryption",
                      default=None)

    parser.add_option('-o',
                      '--output',
                      type="string",
                      dest='outputfile',
                      help="File Output Path For Saving Encrypter Cipher",
                      default=".")

    parser.add_option('-p',
                      '--password',
                      type="string",
                      dest='password',
                      help="Provide Password For Encrypting File",
                      default=None)

    parser.add_option('-p',
                      '--password',
                      type="string",
                      dest='password',
                      help="Provide Password For Encrypting File",
                      default=None)

    (options, args) = parser.parse_args()

    # Input Conditions Checkings
    if not options.inputfile or not os.path.isfile(options.inputfile):
        print(" [Error] Please Specify Input File Path")
        exit(0)
    if not options.outputfile or not os.path.isdir(options.outputfile):
        print(" [Error] Please Specify Output Path")
        exit(0)
    if not options.password:
        print(" [Error] No Password Input")
        exit(0)
    inputfile = options.inputfile

    outputfile = os.path.join(
        options.outputfile,
        os.path.basename(options.inputfile).split('.')[0] + '.ssb')
    password = options.password
    base = os.path.basename(inputfile).split('.')[1]
    work = "E"

    ps.FileCipher(inputfile, outputfile, password, work)
    return

    if __name__ == '__main__':
        main()
Exemplo n.º 2
0
def main():
    parser = optparse.OptionParser(usage=usage, version=Version)
    parser.add_option(
        '-i', '--input', type='string', dest='inputfile',
        help="File Input Path For Encryption", default=None
    )

    parser.add_option(
        '-o', '--output', type='string', dest='outputfile',
        help="File Output Path For Saving Encrypter Cipher", default='.'
    )

    parser.add_option(
        '-p', '--password', type='string', dest='password',
        help="Provide Password For Encrypting File", default=None
    )

    (options, args) = parser.parse_args()

    # Input Conditins Checkings
    if not options.inputfile or not os.path.isfile(options.inputfile):
        print("[Error] Please Specify Input File Path")
        exit(0)

    if not options.outputfile or not os.path.isdir(options.outputfile):
        print("[Error] Please Specify Output Path")
        exit(0)

    if not options.password:
        print("[Error] No")
        exit(0)

    inputfile = options.inputfile
    outputfile = options.outputfile
    password = options.password
    work = 'D'
    ps.FileCipher(inputfile, outputfile, password, work)
    return