Replies: 3 comments 1 reply
-
|
Thanks for opening this issue! |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
不如直接跳过他 |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
The problem was solved after re-defining a whois query script using python. The conventional query method is often unable to adapt to the proxy network environment. import socket
import select
import time
def query_whois_socket(domain, server="whois.nic.md", port=43, timeout=5):
"""
Query WHOIS information using socket, simulating ncat request with optimized response time.
Args:
domain (str): Domain to query.
server (str): WHOIS server address.
port (int): WHOIS server port.
timeout (int): Socket timeout in seconds.
Returns:
str: WHOIS query result.
"""
try:
# Create socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setblocking(False)
# Connect to server
try:
s.connect((server, port))
except BlockingIOError:
pass
# Wait for connection
connection_start = time.time()
_, writable, exceptional = select.select([], [s], [s], timeout)
if not writable:
raise socket.timeout("Connection timeout")
if exceptional:
raise Exception("Connection error")
# Send request
s.sendall(f"{domain}\r\n".encode())
# Receive response
response = b""
last_data_time = time.time()
quiet_period = 0.2
while True:
readable, _, _ = select.select([s], [], [], min(0.1, timeout))
if readable:
try:
chunk = s.recv(4096)
if not chunk:
break
response += chunk
last_data_time = time.time()
except (socket.timeout, BlockingIOError):
pass
current_time = time.time()
if response and current_time - last_data_time > quiet_period:
break
if current_time - connection_start > timeout:
break
s.close()
return response.decode('utf-8', errors='ignore')
except Exception as e:
return f"Error occurred: {e}"
def main():
import sys
domain_to_lookup = sys.argv[1] if len(sys.argv) > 1 else "888.md"
start_time = time.time()
whois_info = query_whois_socket(domain_to_lookup, "whois.nic.md", 43, 5)
print(whois_info)
print(f"Query time: {time.time() - start_time:.2f} seconds")
if __name__ == "__main__":
main() |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Checks
Support Request
whois是一个通过tcp协议请求43端口的工具,当启动dae后,whois 通过代理后请求变慢,其实请求已经输出了所有数据,但仍然会阻塞10秒后再结束,请求命令:

whois 888.md等待时间是10秒后结束。
以下是dae的动态日志:

以下是tcpdump抓包dae0网卡的详情:

我发现每次都是卡顿10秒,是固定的,包括查询其他域名,都是阻塞10秒后结束,是有规律的,就不知道是哪里设置出了问题。
dae配置内容如下:
Current Behavior
whois 888.md
whois 888.com
或者:
echo "888.md" | telnet whois.nic.md 43
echo "888.md" | nc whois.nic.md 43
Expected Behavior
结果输出正常,但需要多耗10后才结束,输出结果后不应该等那么长的时间才结束的。
Steps to Reproduce
apt install whois
/usr/bin/dae run --disable-timestamp -c /etc/dae/config.dae
whois 888.md
Environment
Anything else?
No response
Beta Was this translation helpful? Give feedback.
All reactions