python的util函数

winkar_utils的Python项目详细描述


安装

pip install winkar_utils

python的实用程序

链接

为iterable添加链式枚举支持

importutilsrange(10).map(lambdax:x**2) \
      .filter(lambdax:x>10) \
      .take(5) \
      .reduce(lambdax,y:x+y)

编码

为str添加其他编码

importutilsprint"asd".encode("bin")# => 011000010111001101100100print"011000010111001101100100".decode("bin")# => asd

并发

并发编码的实用程序

fromutils.concurrentimportmultiThread@multiThread(10)# the param indicate how many threads to startdefox(x):returnxox(range(10))# this will run concurrently# param should be a collection of orgin param type

对数

日志实用程序

importloggingfromutils.logimportstream_handler,formatter,loggerlogger.warn("test")# the logger has been set level to warn# use formatter as its default output format# and will only print to stdoutlogger.setLevel(logging.INFO)# change log levellogger.name="test"# change logger name

因子

fromutils.factorimportfactorfactor(130)# => [2,5,13]factor(131)# => [1,131]

它还将向path添加一个factor命令,如linux

有用的第三方库

一个非常有用的集成pwn库。

Pwntools github repo

只能通过pip安装。

frompwnimport*context(arch='i386',os='linux')r=remote('exploitme.example.com',31337)# EXPLOIT CODE GOES HEREr.send(asm(shellcraft.sh()))r.interactive()

libformatstr

专门用于格式字符串攻击的库。

用PIP安装。

importsysfromlibformatstrimportFormatStraddr=0x08049580system_addr=0x080489a3p=FormatStr()p[addr]=system_addr# buf is 14th argument, 4 bytes are already printedsys.stdout.write(p.payload(14,start_len=4))

fnmatch

支持bash样式通配符的库。

使用pip安装

fromfnmatchimportfnmatchfnmatch("target","tar*")# => truefnmatch("target","TARG.T")# => false

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java为引用变量指定默认值   java在2D数组中旋转innersquare   java将hashmap键值与int进行比较   java程序中的并发监视器陷入死锁   安卓 java。lang.NoClassDefFoundError:java。awt。光标   java有没有更好的方法来引用包含对象的对象?   如何在Java编程中循环代码块   java如何在Junit5中使用Serenity?   java使用ANTLR识别JavaScript文件中的全局变量声明   EJB查询对象生成的java视图SQL?   java查找股票报价的范围   java错误:(453,69)不允许使用字符串类型(在值为“”的“活动\u水平\u边距”处)   java安装的环境变量   amazon web服务在使用awssdkjava上载到S3存储桶时发生直接错误   java在Android的ArrayList中添加相等的值   尝试打开MyEclipse Enterprise Workbench时出现ide“无法创建java虚拟机”错误   java如何使用单元格指定的行和列更改jTable的单元格颜色?   java如何等待文件从系统目录复制到具有根访问权限的外部存储