diff --git a/phishing/DancingRightToLeft.py b/phishing/DancingRightToLeft.py index d7e4cf2..57a1f08 100644 --- a/phishing/DancingRightToLeft.py +++ b/phishing/DancingRightToLeft.py @@ -25,6 +25,7 @@ def opts(argv): parser.add_argument('filename', help='Payload file that we wish to rename.') parser.add_argument('decoy_extension', help='Extension that we wish our payload to mimic via RTLO') parser.add_argument('-p', '--padding', default=' ', help='If current file extension length is different than decoy extension length, pad filename with this character. Default: space.') + parser.add_argument('-n', '--dryrun', action='store_true', help='Dry run. Do not rename file, just show how it would look like.') args = parser.parse_args() @@ -37,6 +38,11 @@ def opts(argv): print('[!] Input filename does not have extension! You must point this script to the existing file having some original extension.') sys.exit(1) + if not args.dryrun: + if not os.path.isfile(args.filename): + print('[!] Input file does not exist!') + sys.exit(1) + return args def main(argv): @@ -97,9 +103,12 @@ OUTPUT: # # Using manual bytes copy cause I was having some weird issues with shutil.copy() # - with open(old, 'rb') as oldfile: - with open(new, 'wb') as newfile: - newfile.write(oldfile.read()) + if not args.dryrun: + with open(old, 'rb') as oldfile: + with open(new, 'wb') as newfile: + newfile.write(oldfile.read()) + else: + print('Dry run. Did not rename the actual file.') if __name__ == '__main__': main(sys.argv)