Sliver 二开准备

cs被杀麻了,最近打算看看一下sliver的源码进行一下二开,这篇是记录遇到的一些问题

编译sliver

Windows下

官方说用MingW,但是我自己用他带的make不行,

image

下载make

搜了一下,记录编译make的过程:直接 传送门 下载需要的版本,比如这里下4.4的。

image

编译make

下载解压之后进入目录,打开build_w32.bat这个文件:

image

在34行将gunmake改为make

image

如果电脑没有visual studio的环境的话就会缺少MSVC,直接运行这个脚本会报错:

.\build_w32.bat

Creating GNU Make for Windows 9X/NT/2K/XP/Vista/7/8/10

No MSVC compiler available.
Please run vcvarsall.bat and/or configure your Path.

没下载的话就直接跳转下载 传送门。安装时勾选c/c++程序完成后再次运行就可以了。

image

然后会在当前目录下产生一个名为 WinRel 的目录, 这个目录下就有编译好的make。

image

添加环境变量不赘述,之后新开一个powershell查看,能显示版本即成功了。

image

尝试编译

然后先试着编译一遍,结果就碰壁。

image

Linux下

这提示环境变量里面没有uname,奶奶滴这个makefile居然不适用Windows。换到Ubuntu里面直接就可以了。

image

下载超时问题

但是我免费的魔法太硕了一下卡直接断掉,换用fastgithub也是相当的折磨人。但是可以用镜像站去替换GitHub的连接,比如下面是我已经替换了的,对国内的下载很友好,有需要的自己替换掉./go-asset.sh中对应这里的部分。

echo "-----------------------------------------------------------------"
echo " Garble"
echo "-----------------------------------------------------------------"

echo "curl -L --fail --output $OUTPUT_DIR/linux/$GO_ARCH_1/garble https://github.com/moloch--/garble/releases/download/v$GARBLE_VER/garble_linux"
curl -L --fail --output $OUTPUT_DIR/linux/$GO_ARCH_1/garble https://githubfast.com/moloch--/garble/releases/download/v$GARBLE_VER/garble_linux
echo "curl -L --fail --output $OUTPUT_DIR/linux/$GO_ARCH_2/garble https://github.com/moloch--/garble/releases/download/v$GARBLE_VER/garble_linux-$GO_ARCH_2"
curl -L --fail --output $OUTPUT_DIR/linux/$GO_ARCH_2/garble https://githubfast.com/moloch--/garble/releases/download/v$GARBLE_VER/garble_linux-$GO_ARCH_2
echo "curl -L --fail --output $OUTPUT_DIR/windows/$GO_ARCH_1/garble.exe https://github.com/moloch--/garble/releases/download/v$GARBLE_VER/garble_windows.exe"
curl -L --fail --output $OUTPUT_DIR/windows/$GO_ARCH_1/garble.exe https://githubfast.com/moloch--/garble/releases/download/v$GARBLE_VER/garble_windows.exe
echo "curl -L --fail --output $OUTPUT_DIR/darwin/$GO_ARCH_1/garble https://github.com/moloch--/garble/releases/download/v$GARBLE_VER/garble_macos-$GO_ARCH_1"
curl -L --fail --output $OUTPUT_DIR/darwin/$GO_ARCH_1/garble https://githubfast.com/moloch--/garble/releases/download/v$GARBLE_VER/garble_macos-$GO_ARCH_1
echo "curl -L --fail --output $OUTPUT_DIR/darwin/$GO_ARCH_2/garble https://github.com/moloch--/garble/releases/download/v$GARBLE_VER/garble_macos-$GO_ARCH_2"
curl -L --fail --output $OUTPUT_DIR/darwin/$GO_ARCH_2/garble https://githubfast.com/moloch--/garble/releases/download/v$GARBLE_VER/garble_macos-$GO_ARCH_2


echo "-----------------------------------------------------------------"
echo " Shikata ga nai (ノ ゜Д゜)ノ ︵ 仕方がない"
echo "-----------------------------------------------------------------"

# Linux (amd64)
echo "curl -L --fail --output $OUTPUT_DIR/linux/$GO_ARCH_1/sgn.zip https://github.com/moloch--/sgn/releases/download/v$SGN_VER/sgn_linux-$GO_ARCH_1.zip"
curl -L --fail --output $OUTPUT_DIR/linux/$GO_ARCH_1/sgn.zip https://githubfast.com/moloch--/sgn/releases/download/v$SGN_VER/sgn_linux-$GO_ARCH_1.zip

# Linux (arm64)
echo "curl -L --fail --output $OUTPUT_DIR/linux/$GO_ARCH_2/sgn.zip https://github.com/moloch--/sgn/releases/download/v$SGN_VER/sgn_linux-$GO_ARCH_2.zip"
curl -L --fail --output $OUTPUT_DIR/linux/$GO_ARCH_2/sgn.zip https://githubfast.com/moloch--/sgn/releases/download/v$SGN_VER/sgn_linux-$GO_ARCH_2.zip

# Windows (amd64)
echo "curl -L --fail --output $OUTPUT_DIR/windows/$GO_ARCH_1/sgn.zip https://github.com/moloch--/sgn/releases/download/v$SGN_VER/sgn_windows-$GO_ARCH_1.zip"
curl -L --fail --output $OUTPUT_DIR/windows/$GO_ARCH_1/sgn.zip https://githubfast.com/moloch--/sgn/releases/download/v$SGN_VER/sgn_windows-$GO_ARCH_1.zip

# MacOS (amd64)
echo "curl -L --fail --output $OUTPUT_DIR/darwin/$GO_ARCH_1/sgn.zip https://github.com/moloch--/sgn/releases/download/v$SGN_VER/sgn_macos-$GO_ARCH_1.zip"
curl -L --fail --output $OUTPUT_DIR/darwin/$GO_ARCH_1/sgn.zip https://githubfast.com/moloch--/sgn/releases/download/v$SGN_VER/sgn_macos-$GO_ARCH_1.zip

# MacOS (arm64)
echo "curl -L --fail --output $OUTPUT_DIR/darwin/$GO_ARCH_2/sgn.zip https://github.com/moloch--/sgn/releases/download/v$SGN_VER/sgn_macos-$GO_ARCH_2.zip"
curl -L --fail --output $OUTPUT_DIR/darwin/$GO_ARCH_2/sgn.zip https://githubfast.com/moloch--/sgn/releases/download/v$SGN_VER/sgn_macos-$GO_ARCH_2.zip

# end
echo -e "clean up: $WORK_DIR"
rm -rf $WORK_DIR
echo -e "\n[*] All done\n"

更换之后速度就显著提升了,之前一个压缩包甚至能耗一个小时。

image

等待完成:

image

解决报错

但是一跑居然有报错,是数组越界。

image

看看源代码,跟进到/server/rpc/rpc.go的90行,是获取主要,次要,修订版本。这里应该是semVer这个变量他值的获取有问题,跟进SemanticVersion(),这个函数无非就是将版本号字符串分割成整数切片,他的调用也都是用来显示的,唯一的传值就是全局的Version。

image

不过反正这里的版本检查也是要去掉的,我这里直接将次要和修订版本号改成了硬编码的1,2来解决问题。编译过一次之后就快很多了,几十秒就编译好了且能够正常运行:

image

后续就是自由发挥了,比如内置机器人推送等等功能,这个后续改完了再发文章出来。

posted @ 2023-12-20 20:07  lockly  阅读(342)  评论(0编辑  收藏  举报