惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

B
Blog RSS Feed
C
CERT Recently Published Vulnerability Notes
P
Proofpoint News Feed
Y
Y Combinator Blog
T
The Blog of Author Tim Ferriss
云风的 BLOG
云风的 BLOG
H
Help Net Security
Recorded Future
Recorded Future
The Register - Security
The Register - Security
F
Full Disclosure
N
Netflix TechBlog - Medium
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hackread – Cybersecurity News, Data Breaches, AI and More
爱范儿
爱范儿
Security Archives - TechRepublic
Security Archives - TechRepublic
Simon Willison's Weblog
Simon Willison's Weblog
Cisco Talos Blog
Cisco Talos Blog
I
InfoQ
T
Tenable Blog
T
Tor Project blog
人人都是产品经理
人人都是产品经理
D
DataBreaches.Net
NISL@THU
NISL@THU
Google DeepMind News
Google DeepMind News
博客园 - 叶小钗
B
Blog
V
V2EX
Jina AI
Jina AI
L
LangChain Blog
月光博客
月光博客
W
WeLiveSecurity
U
Unit 42
AWS News Blog
AWS News Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
博客园 - 聂微东
V
Visual Studio Blog
A
Arctic Wolf
T
Tailwind CSS Blog
The Cloudflare Blog
SecWiki News
SecWiki News
S
SegmentFault 最新的问题
Hacker News - Newest:
Hacker News - Newest: "LLM"
宝玉的分享
宝玉的分享
MyScale Blog
MyScale Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
S
Securelist
www.infosecurity-magazine.com
www.infosecurity-magazine.com
腾讯CDC
雷峰网
雷峰网

博客园 - 干炸小黄鱼

timex 处理时间戳 gorm-gen go 雪花算法 golang每日一库--协程池库ants golang每日一库--json解析库gjson python高级编程-asyncio python高级编程-condition python高级编程-event python装饰器-自动重试 EAP系统 go实现实现 SECS/GEM 协议 设备通信协议 SECS go项目使用Jenkins进行CICD go操作ES mongo db聚合查询 go如何使用mongodb Apache ShardingSphere paxos and raft (分布式一致性算法) go使用zookeeper分布式锁以及和redis差异 go使用 seata 示例 Alibaba 分布式事务 Seata go中使用saga go中使用TCC示例 分布式事务TCC 熔断器 Hystrix OR Sentinel k8s下部署consul and etcd Consul OR Etcd 【力扣hot100】双指针-盛水最多的容器 【力扣hot100】滑动窗口-最小覆盖子串 shell脚本合集 分布式id生成器 springboot通用CURD Python PB级检索系统架构设计 rancher 在三台机器搭建k8s集群 python ssh clinet 数据库排序Null值字段靠后/靠前 常规web项目 docker-compose 例子 手搓一个验证码 使用itertools 中的groupby 对字典数组进行分组后排序 使用开源库 geoip2 获取某ip的经纬度地理信息 python中 apscheduler.schedulers.blocking.BlockingScheduler 定时执行任务 简单的python web项目的docker-compose.yml 示例 golang sliver二次开发自定义命令(格式乱后面再调) pydantic做参数校验 基于rancher部署k8s 地理位置相关基础数据 flask migrate时报错 Can't locate revision identified by '3d80e4c025df'
python和sliver交互
干炸小黄鱼 · 2024-08-07 · via 博客园 - 干炸小黄鱼

开源第三方库:https://sliverpy.readthedocs.io/en/latest/getting-started.html#connect-example
代码示例:


import os
import asyncio
from sliver import SliverClientConfig, SliverClient

CONFIG_PATH = os.path.join('../sliver/', 'moloch_127.0.0.1.cfg')


async def main():
    ''' Async client connect example '''
    config = SliverClientConfig.parse_config_file(CONFIG_PATH)
    client = SliverClient(config)
    await client.connect()
    # 获取上线主机列表
    sessions = await client.sessions()
    print(sessions)


if __name__ == '__main__':
    asyncio.run(main())
   

添加自定义功能后需要重新生成pb文件

#!/bin/bash

#virtualenv venv
#source venv/bin/activate
OUT_DIR="./sliver_client/sliver/pb"
IN_DIR="./sliver/protobuf"

rm -rf $OUT_DIR/commonpb
rm -rf $OUT_DIR/sliverpb
rm -rf $OUT_DIR/clientpb
rm -rf $OUT_DIR/rpcpb
# shellcheck disable=SC2028
echo "生成python protobuf文件....\n"
# Common Protobuf
python -m grpc_tools.protoc -I $IN_DIR --python_out=./$OUT_DIR $IN_DIR/commonpb/common.proto

# Sliver Protobuf
python -m grpc_tools.protoc -I $IN_DIR --python_out=./$OUT_DIR $IN_DIR/sliverpb/sliver.proto

# Client Protobuf
python -m grpc_tools.protoc -I $IN_DIR --python_out=./$OUT_DIR $IN_DIR/clientpb/client.proto

# gRPC
python -m grpc_tools.protoc -I $IN_DIR --python_out=./$OUT_DIR --grpc_python_out=./$OUT_DIR $IN_DIR/rpcpb/services.proto

# Re-write commonpb imports
sed -i "" -e \
    "s/from commonpb import common_pb2 as commonpb_dot_common__pb2/from ..commonpb import common_pb2 as commonpb_dot_common__pb2/g" \
    "$OUT_DIR/sliverpb/"*
sed -i "" -e \
    "s/from commonpb import common_pb2 as commonpb_dot_common__pb2/from ..commonpb import common_pb2 as commonpb_dot_common__pb2/g" \
    "$OUT_DIR/clientpb/"*
sed -i "" -e \
    "s/from commonpb import common_pb2 as commonpb_dot_common__pb2/from ..commonpb import common_pb2 as commonpb_dot_common__pb2/g" \
    "$OUT_DIR/rpcpb/"*

# Re-write sliverpb / clientpb imports
sed -i "" -e \
    "s/from sliverpb import sliver_pb2 as sliverpb_dot_sliver__pb2/from ..sliverpb import sliver_pb2 as sliverpb_dot_sliver__pb2/g" \
    "$OUT_DIR/rpcpb/"*
sed -i "" -e \
    "s/from clientpb import client_pb2 as clientpb_dot_client__pb2/from ..clientpb import client_pb2 as clientpb_dot_client__pb2/g" \
    "$OUT_DIR/rpcpb/"*


然后修改 sliver_client/sliver/interactive.py 添加port_scan功能