继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

python命令行脚本

qq_邪_4
关注TA
已关注
手记 2
粉丝 5
获赞 0

图片描述

copy命令脚本:

import os
import optparse

def main():
parse = optparse.OptionParser(“usage%prog " + “-i -c -o “)
parse.add_option(”-i”, dest=“iname”, type=“string”, help=“specify img file”)
parse.add_option(”-c", dest=“cname”, type=“string”, help=“specify compress File”)
parse.add_option("-o", dest=“oname”, type=“string”, help=“specify outname”)

(options, args) = parse.parse_args()
if (options.iname == None) | (options.cname == None):
    print(parse.usage)
else:
    iname = options.iname
    cname = options.cname
    oname = options.oname
    p = os.popen("copy /b %s+%s %s" % (iname,cname,oname))
    print(p.read())

if name == “main”:
main()


图片描述

暴力破解脚本:
import optparse
import zipfile
from threading import Thread

def check_pwd(zf,pwd):
try:
zf = zipfile.ZipFile(zf)
zf.extractall(pwd=pwd.encode(“ascii”))
print(“found password %s” % pwd)
except Exception as e:
print(e)

def zip() :
parse = optparse.OptionParser(“usage%prog -f -d “)
parse.add_option(”-f”, dest=“fname”, help=“get zip file”)
parse.add_option("-d", dest=“dname”, help=“get dictionary”)
(options,args) = parse.parse_args()
if (options.fname == None) | (options.dname == None) :
print(parse.usage)
else:
fname = options.fname
dname = options.dname
f=open(dname)
for line in f.readlines():
pwd = line.strip(’\n’)
print(“Try password %s” % pwd)
t = Thread(target=check_pwd, args=(fname, pwd))
t.start()

if name == “main”:
zip()

打开App,阅读手记
0人推荐
发表评论
随时随地看视频慕课网APP