浦口区网站建站,霸州市网站建设,福州网站建设服务商,如何改变网站的排版需要和Oracle交互的密码学脚本一般都需要借助pwn库的帮助#xff0c;今天切换了python版本后#xff0c;出现了一个异常#xff08;OSError: Int or String expected#xff0c;详细异常见文章#xff09;#xff0c;查阅一下源码后简单的解决了这个问题#xff0c;在此… 需要和Oracle交互的密码学脚本一般都需要借助pwn库的帮助今天切换了python版本后出现了一个异常OSError: Int or String expected详细异常见文章查阅一下源码后简单的解决了这个问题在此分享一下。 文章目录 问题环境与描述解决方案 问题环境与描述
SageMath 10.1Python 3.11.1pwntools 4.11.1
关键代码
from pwn import *process remote(127.0.0.1, 7777)报错
File ~/.sage/local/lib/python3.11/site-packages/pwnlib/tubes/remote.py:77, in remote.__init__(self, host, port, fam, typ, ssl, sock, ssl_context, ssl_args, sni, *args, **kwargs)75 fam self._get_family(fam)76 try:
--- 77 self.sock self._connect(fam, typ)78 except socket.gaierror as e:79 if e.errno ! socket.EAI_NONAME:File ~/.sage/local/lib/python3.11/site-packages/pwnlib/tubes/remote.py:103, in remote._connect(self, fam, typ)100 timeout self.timeout102 with self.waitfor(Opening connection to %s on port %s % (self.rhost, self.rport)) as h:
-- 103 for res in socket.getaddrinfo(self.rhost, self.rport, fam, typ, 0, socket.AI_PASSIVE):104 self.family, self.type, self.proto, _canonname, sockaddr res106 if self.type not in [socket.SOCK_STREAM, socket.SOCK_DGRAM]:File /private/var/tmp/sage-10.1-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/socket.py:962, in getaddrinfo(host, port, family, type, proto, flags)959 # We override this function since we want to translate the numeric family960 # and socket type values to enum constants.961 addrlist []
-- 962 for res in _socket.getaddrinfo(host, port, family, type, proto, flags):963 af, socktype, proto, canonname, sa res964 addrlist.append((_intenum_converter(af, AddressFamily),965 _intenum_converter(socktype, SocketKind),966 proto, canonname, sa))OSError: Int or String expected解决方案
报错是因为Sage把数字转成Long int类型了而pwntools需要的是Int或者String类型的只需要在代码里对数字进行显示的强转即可。
解决代码如下
from pwn import *process remote(127.0.0.1,int(7777))ATFWUS 2024-01-08