import os
import random
os.getcwd()
extension = input("What's the extension of the file names you want to change ? \nexample : .mp4 or .jpg \n")
for f in os.listdir():
fname , fext = os.path.splitext(f)
if fext==extension:
fname = str(random.randint(1,100000000))
newname= "{}{}".format(fname,fext)
os.rename(f,newname)
just learning guys 😁
DO NOT DEAL WITH THIS MEMBER
Aug 24, 2017 07:58 PM
(This post was last modified: Aug 24, 2017 07:58 PM by Vana.)
Use "php" or "code" tags to preserve indentation when posting code.
PHP Code
<?php import os import random
os.getcwd()
extension = input("What's the extension of the file names you want to change ? \nexample : .mp4 or .jpg \n") for f in os.listdir(): fname , fext = os.path.splitext(f) if fext==extension: fname = str(random.randint(1,100000000)) newname= "{}{}".format(fname,fext) os.rename(f,newname)
Yea, actually forgot them but learned them from you in the first place , thanks
Aug 25, 2017 06:04 AM
(This post was last modified: Aug 25, 2017 06:05 AM by vorticalbox.)
Because sod readability
PHP Code
<?php #!/urs/bin/python3 import os import random
extension = input("What's the extension of the file names you want to change ? \nexample : .mp4 or .jpg \n") [os.rename(f,str(random.randint(1,10**6))+os.path.splitext(f)[1]) for f in os.listdir() if os.path.splitext(f)[1] == extension]
¸„»°'´¸„»°'´Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est ¸„»°'´`'°«„¸`'°«„¸¸„»°'´
You guys know he's trying to create some form of ransomware, right?
Skype messages are NOT valid evidence, and here's why.
(Aug 25, 2017 06:45 AM)Ensky Wrote: You guys know he's trying to create some form of ransomware, right?
I heard renaming files or removing their extension is a good ransomware.
Either way the script would be open for anyone to see.
¸„»°'´¸„»°'´Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est ¸„»°'´`'°«„¸`'°«„¸¸„»°'´
Aug 25, 2017 11:26 PM
(This post was last modified: Aug 25, 2017 11:49 PM by Lukos1234.)
(Aug 25, 2017 06:45 AM)Ensky Wrote: You guys know he's trying to create some form of ransomware, right?
Wuuuuut ? I'm a beginner man , didn't even think of it , but now that you say it 😈 😈 😁
(Aug 25, 2017 06:04 AM)vorticalbox Wrote: Because sod readability
PHP Code
<?php #!/urs/bin/python3 import os import random
extension = input("What's the extension of the file names you want to change ? \nexample : .mp4 or .jpg \n") [os.rename(f,str(random.randint(1,10**6))+os.path.splitext(f)[1]) for f in os.listdir() if os.path.splitext(f)[1] == extension]
This isn't good practice. The beauty of Python is in its readability, one liners are nice and all, but this isn't a good way to do things.
(Aug 26, 2017 03:42 AM)emento Wrote: This isn't good practice. The beauty of Python is in its readability, one liners are nice and all, but this isn't a good way to do things.
I know I just let trying to one liner things
¸„»°'´¸„»°'´Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est ¸„»°'´`'°«„¸`'°«„¸¸„»°'´
(Aug 25, 2017 06:04 AM)vorticalbox Wrote: Because sod readability
PHP Code
<?php #!/urs/bin/python3 import os import random
extension = input("What's the extension of the file names you want to change ? \nexample : .mp4 or .jpg \n") [os.rename(f,str(random.randint(1,10**6))+os.path.splitext(f)[1]) for f in os.listdir() if os.path.splitext(f)[1] == extension]
I just had involuntary nervous twitches.
(Aug 26, 2017 05:08 AM)nOrr Wrote: I just had involuntary nervous twitches.
Next time I'll add a trigger warning :P
¸„»°'´¸„»°'´Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est ¸„»°'´`'°«„¸`'°«„¸¸„»°'´
Aug 26, 2017 09:45 AM
(This post was last modified: Aug 26, 2017 02:09 PM by Eagle 95.)
(Aug 26, 2017 05:51 AM)vorticalbox Wrote: Next time I'll add a trigger warning :P
🤝
[warn]
@Lukos123:
If you are interested in renaming files to random strings instead of numbers, you may use module 'strgen'
To generate 12 letter random string:
Code import strgen
strgen.StringGenerator('[\1]{12}').render()
Aug 28, 2017 04:47 AM
(This post was last modified: Aug 28, 2017 04:49 AM by NoAimNoGame.)
Nice Code man.
PHP Code
<?php import os Kys = input("What do you want to do? : ") if Kys == 'kys': os.system('KYS!') print('No such command but you killed yourself anyway')
Malware Collection: - Written in Python. (PM for Details)
Ded Kills PC Permanently. Also written in Python. (PM for Details)
(Aug 27, 2017 11:56 AM)zer0dev Wrote: @Lukos123:
If you are interested in renaming files to random strings instead of numbers, you may use module 'strgen'
To generate 12 letter random string:
Code import strgen
strgen.StringGenerator('[\1]{12}').render()
thanks a lot 🤝
|