V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  263  ›  全部回复第 4 页 / 共 10 页
回复总数  197
1  2  3  4  5  6  7  8  9  10  
普通版现在只能导 180 天,想要导出一年只能付费。或者之前就每 180 天导出备份一次
skip_name_resolve
2024-07-15 15:17:59 +08:00
回复了 aizya 创建的主题 程序员 求助,有什么办法能够控制 cmd/powershell 进行 ssh 自动化登录?
import subprocess
import requests


def get_otp(dynamic_code):
api_url = 'https://api.example.com/get_otp'
response = requests.post(api_url, json={'dynamic_code': dynamic_code})
return response.json()['otp']


ssh_process = subprocess.Popen(
['ssh', '[email protected]'],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
universal_newlines=True,
)

dynamic_code = ''
while True:
output = ssh_process.stdout.readline()
if 'Dynamic code:' in output:
dynamic_code = output.split('Dynamic code:')[1].strip()
break

otp = get_otp(dynamic_code)

ssh_process.stdin.write(f'{otp}\n')
ssh_process.stdin.flush()

while True:
output = ssh_process.stdout.readline()
print(output.strip())
if 'Last login:' in output:
print("登录成功!")
break
elif 'Permission denied' in output:
print("登录失败!")
break

ssh_process.stdin.close()
ssh_process.stdout.close()
ssh_process.stderr.close()


CLAUDE 3.5 SONNET
2024-07-15 13:14:23 +08:00
回复了 aizya 创建的主题 程序员 求助,有什么办法能够控制 cmd/powershell 进行 ssh 自动化登录?
import paramiko
import hashlib
import base64
import getpass

def get_host_key_fingerprint(hostname, port=22):
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())

try:
client.connect(hostname, port=port, username='dummy', password='dummy')
except:
pass

key = client.get_transport().get_remote_server_key()
fingerprint = hashlib.sha256(key.get_fingerprint()).hexdigest()

client.close()
return ':'.join(a+b for a,b in zip(fingerprint[::2], fingerprint[1::2]))

def ssh_login_with_otp(hostname, username, password, otp_func):
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())

# 获取 fingerprint
fingerprint = get_host_key_fingerprint(hostname)
print(f"Host key fingerprint: {fingerprint}")

# 验证 fingerprint
if input("Verify fingerprint (y/n): ").lower() != 'y':
print("Fingerprint verification failed")
return

# 获取动态密码
otp = otp_func()

try:
client.connect(hostname, username=username, password=password+otp)
print("Login successful!")

# 执行命令
stdin, stdout, stderr = client.exec_command('ls -l')
print(stdout.read().decode())

except Exception as e:
print(f"Login failed: {str(e)}")

finally:
client.close()

# 模拟获取动态密码的函数
def get_otp():
return input("Enter OTP: ")

# 使用示例
hostname = 'example.com'
username = 'your_username'
password = getpass.getpass("Enter password: ")

ssh_login_with_otp(hostname, username, password, get_otp)


gpt yyds
2024-07-15 10:27:01 +08:00
回复了 HeiHeiDe 创建的主题 问与答 iOS 游戏 APP 接入实名认证
首先你要有版号、软著,然后接入中宣部实名认证系统
https://developers.weixin.qq.com/community/minigame/doc/000ecaf1354190701d0c53f7a5b401
2024-07-08 16:27:41 +08:00
回复了 leeyijie 创建的主题 宽带症候群 上海电信现在大流量用户拨号会分到 116.网段
电信换新设备了,老的还没完全下架,目前可以通过 PPPoE Scan 查看对端设备,如果有多个设备,可以指定 AC Name 拨号,还能获取到老的 IP 段。
iTop
2024-04-25 13:45:56 +08:00
回复了 tangtang369 创建的主题 汽车 新能源汽车驻车状态下空调的正确使用方法
特斯拉直接开露营模式
你点一下左下角的 Open Resource Monitor 不就好了
2024-04-04 14:59:05 +08:00
回复了 BNineCoding 创建的主题 汽车 新车停车场纠结,求老司机指点迷津
车就是个工具,怎么便利怎么来。
2024-03-26 17:18:14 +08:00
回复了 drclairvoyant 创建的主题 macOS macOS 更新后启动台图标被打乱
只用默认排序
defaults write com.apple.dock ResetLaunchPad -bool true && killall Dock
前往目录:/Library/Preferences/SystemConfiguration
保留:com.apple.Boot.plist ,其余的全部删除
重启

再改
首先直接用光猫接电脑,测速。排除是否联通的问题。
@kemo 因为运维人少,工资低
2024-01-17 14:01:48 +08:00
回复了 messiah163 创建的主题 iCloud Mac OS 隔空投送到手机总是会上传 iCloud,怎么取消
iOS17 新功能不在同一个 Wi-Fi 就会通过 iCloud 来传,在同一个 Wi-Fi 就不会,而且之前不在同一个 Wi-Fi 是不能隔空投送的。iOS 17 设置-通用-隔空投送-超出范围可以关闭该功能。
2024-01-15 16:07:33 +08:00
回复了 Bay0net 创建的主题 NAS 强迫症快要被逼死了
可以看下 ~/.SynologyDrive/data/session/1/conf/blacklist.filter 的内容,过滤规则是否正确
2024-01-02 12:33:33 +08:00
回复了 cmmulxuk 创建的主题 NGINX NGINX 反代 ws 总是失败,麻烦大佬帮忙看下配置
多半是 /ws 这个路径的锅
2023-11-23 17:03:41 +08:00
回复了 zapll 创建的主题 推广 不过了, ChatGPT Plus 免费送
多谢 OP
4w7g8Ug5K7zVLx7c4urZvH
1  2  3  4  5  6  7  8  9  10  
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   2049 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 33ms · UTC 12:48 · PVG 20:48 · LAX 05:48 · JFK 08:48
Developed with CodeLauncher
♥ Do have faith in what you're doing.