mirror of
https://github.com/mgeeky/Penetration-Testing-Tools.git
synced 2024-11-24 03:21:37 +01:00
fix
This commit is contained in:
parent
3182913737
commit
50a1ca3572
@ -25,6 +25,7 @@ def opts(argv):
|
|||||||
parser.add_argument('filename', help='Payload file that we wish to rename.')
|
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('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('-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()
|
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.')
|
print('[!] Input filename does not have extension! You must point this script to the existing file having some original extension.')
|
||||||
sys.exit(1)
|
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
|
return args
|
||||||
|
|
||||||
def main(argv):
|
def main(argv):
|
||||||
@ -97,9 +103,12 @@ OUTPUT:
|
|||||||
#
|
#
|
||||||
# Using manual bytes copy cause I was having some weird issues with shutil.copy()
|
# Using manual bytes copy cause I was having some weird issues with shutil.copy()
|
||||||
#
|
#
|
||||||
with open(old, 'rb') as oldfile:
|
if not args.dryrun:
|
||||||
with open(new, 'wb') as newfile:
|
with open(old, 'rb') as oldfile:
|
||||||
newfile.write(oldfile.read())
|
with open(new, 'wb') as newfile:
|
||||||
|
newfile.write(oldfile.read())
|
||||||
|
else:
|
||||||
|
print('Dry run. Did not rename the actual file.')
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main(sys.argv)
|
main(sys.argv)
|
||||||
|
Loading…
Reference in New Issue
Block a user