由于ios上的zfuse扫描一直不准确,所以想找一些变成工具来实现扫描
官方网站推荐了两个iOS上的应用: Pythonista: Pyto: 这两个都要钱
后来找到一个 ish shell ,安装地址:https://apps.apple.com/cn/app/ish-shell/id1436902243
源码下载:https://www.right.com.cn/forum/thread-8426633-1-1.html
补充util包源码config.go
package util
import (
"fmt"
"gopkg.in/yaml.v3"
"io/ioutil"
"log"
"strings"
)
// ConfigMap 用于存储解析后的配置项
var ConfigMap map[string]interface{}
// 初始化配置
func init() {
ConfigMap = make(map[string]interface{})
if err := loadConfig("configs/application.yaml"); err != nil {
log.Fatalf("Failed to load configuration: %v", err)
}
}
// loadConfig 读取并解析 YAML 配置文件
func loadConfig(filePath string) error {
// 读取文件内容
data, err := ioutil.ReadFile(filePath)
if err != nil {
return err
}
// 解析 YAML 内容到 ConfigMap
if err := yaml.Unmarshal(data, &ConfigMap); err != nil {
return err
}
return nil
}
// GetNestedConfigValue 根据层级键获取配置值
func GetNestedConfigValue(keys []string, data map[string]interface{}) (interface{}, bool) {
if len(keys) == 0 {
return nil, false
}
key := keys[0]
value, exists := data[key]
if !exists {
return nil, false
}
if len(keys) == 1 {
return value, true
}
// 递归查找嵌套值
nextMap, ok := value.(map[string]interface{})
if !ok {
return nil, false
}
return GetNestedConfigValue(keys[1:], nextMap)
}
// GetConfigValue 根据层级键(如 "some.nested.key")获取配置值
func GetConfigValue(key string) (interface{}, error) {
keys := strings.Split(key, ".")
value, found := GetNestedConfigValue(keys, ConfigMap)
if !found {
return nil, fmt.Errorf("key %s not found in configuration", key)
}
return value, nil
}
源码打包
docker run --rm -v "${PWD}:/app" -w /app -e CGO_ENABLED=0 -e GOOS=linux -e GOARCH=386 -e GOPROXY=https://goproxy.io golang:alpine go build -o ish-go-demo cmd/gin/main.go
打包后的文件为ish-go-demo
通过局域网http服务传到手机上
手机上执行
GOMAXPROCS=1 ./ish-go-demo
之前也参考scriptable写了下代码,发现只支持http,放弃了
下面时scriptable访问百度的代码,仅做记录
// 设置要访问的URL
const url = 'https://www.baidu.com';
// 创建网络请求
const req = new Request(url);
req.method = "GET";
// 发送请求并处理响应
req.loadString().then((response) => {
// 打印获取到的网页内容
console.log(response);
// 如果要在Scriptable中展示结果,可以使用以下方式
const widget = new ListWidget();
const text = widget.addText(response.substring(0, 500)); // 截取部分内容展示
text.textColor = new Color('black');
text.font = Font.boldSystemFont(12);
Script.setWidget(widget);
Script.complete();
} else {
console.error('请求失败');
}
}).catch((error) => {
console.error('There has been a problem with your request operation:', error);
});
