当前位置: 首页 > news >正文

手机网站开发学习关键词查询工具软件

手机网站开发学习,关键词查询工具软件,南宁营销网站建设,服装页面设计的网站1、背景 利用gitleaks扫描git仓库或者文件 GitHub上有比较详细的教程,但是由于每个人的安装环境不同,坑很多,网上能查到的有效信息也比较少。这里就以我坑很多的环境为例,捋一下步骤。 GitHub - gitleaks/gitleaks: Protect an…

1、背景

利用gitleaks扫描git仓库或者文件

GitHub上有比较详细的教程,但是由于每个人的安装环境不同,坑很多,网上能查到的有效信息也比较少。这里就以我坑很多的环境为例,捋一下步骤。

GitHub - gitleaks/gitleaks: Protect and discover secrets using Gitleaks 🔑

2、步骤

# MacOS
brew install gitleaks# Docker (DockerHub)
docker pull zricethezav/gitleaks:latest
docker run -v ${path_to_host_folder_to_scan}:/path zricethezav/gitleaks:latest [COMMAND] --source="/path" [OPTIONS]# Docker (ghcr.io)
docker pull ghcr.io/gitleaks/gitleaks:latest
docker run -v ${path_to_host_folder_to_scan}:/path ghcr.io/gitleaks/gitleaks:latest [COMMAND] --source="/path" [OPTIONS]# From Source (make sure `go` is installed)
git clone https://github.com/gitleaks/gitleaks.git
cd gitleaks
make build

(1)安装brew

没有用docker,因为本来linux环境里之前就装好brew了。这个装起来也挺烦的,但是考虑到我用过其他很多扫描工具,install的时候也常用brew,所以就装了。一举多得。

首先,手动克隆 Homebrew 的代码库:

bash复制代码git clone https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git ~/.linuxbrew/Homebrew

然后,创建一些必要的目录并将 Homebrew 添加到你的 PATH 中:

bash复制代码mkdir ~/.linuxbrew 
mkdir ~/.linuxbrew/bin 
ln -s ~/.linuxbrew/Homebrew/bin/brew ~/.linuxbrew/bin 
echo 'export PATH="$HOME/.linuxbrew/bin:$PATH"' >> ~/.bashrc 
source ~/.bashrc
brew update
brew --version  # 确认是否安装好了

可能会有的报错:

①Updating Homebrew... Error: Failed to download https://formulae.brew.sh/api/cask.jws.json!

这可能与网络连接或访问权限有关。

# 切换 Homebrew 主仓库到清华大学镜像
git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git# 切换 Homebrew 核心库到清华大学镜像
git -C "$(brew --repo)/Library/Taps/homebrew/homebrew-core" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git# 切换 Homebrew Cask 库到清华大学镜像
git -C "$(brew --repo)/Library/Taps/homebrew/homebrew-cask" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git# 重新更新 Homebrew
brew update

②fatal: cannot change to '/home/iot/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core': No such file or directory

这个错误表明 Homebrew 的核心库 (homebrew-core) 还没有被正确克隆或安装。通常情况下,Homebrew 会在第一次安装时自动下载和配置这些库,但由于你的安装过程遇到了一些问题,所以这个目录可能还没有被创建。

可以手动克隆 homebrew-core 仓库到正确的位置,克隆完成后,重新设置远程镜像地址:

mkdir -p "$(brew --repo)/Library/Taps/homebrew/"
git clone https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git -C "$(brew --repo)/Library/Taps/homebrew/homebrew-core" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

更新

brew update
brew install gitleaks

(2)brew install gitleaks

可能会有的报错:

①Error: gitleaks: Failed to download resource "glibc--bootstrap-binutils" Download failed: https://github.com/Homebrew/glibc-bootstrap/releases/download/1.0.0/bootstrap-binutils-2.38.tar.gz或者Error: gitleaks: Failed to download resource "glibc--bootstrap-gcc" Download failed: https://github.com/Homebrew/glibc-bootstrap/releases/download/1.0.0/bootstrap-gcc-9.5.0.tar.gz,。还是网络权限问题,如果镜像多次连接不上,有网络问题报错比如尝试直接从源代码编译安装:

brew install gitleaks --build-from-source

(3)git clone https://github.com/gitleaks/gitleaks.git

如果还是装不上,尝试手动(官网教程的第四条):

这里因为又要连github,网络不通畅就多试几次,我大概试了8次左右吧。

(4)make build

打开进入安装好的gitleaks目录,输入指令make build

可能会有的报错:

①go fmt ./... go: github.com/BobuSumisu/aho-corasick@v1.0.3: Get https://proxy.golang.org/github.com/%21bobu%21sumisu/aho-corasick/@v/v1.0.3.mod: dial tcp 142.250.217.113:443: connect: connection refused make: *** [Makefile:13: format] Error 1

这个错误表明 go fmt 过程中尝试从 proxy.golang.org 下载依赖包时,因网络问题(例如连接被拒绝)而失败。通常这是由于网络限制、代理设置或防火墙问题导致无法访问外部资源。

1. 设置 Go Modules 代理
可以尝试设置 Go 的代理为国内的代理服务,这通常可以解决网络访问问题。你可以通过以下命令设置 Go Modules 的代理:
export GOPROXY=https://goproxy.cn,direct

再次 make build

②build github.com/zricethezav/gitleaks/v8: cannot load embed: malformed module path "embed": missing dot in first path element make: *** [Makefile:13: format] Error 1

这个错误提示 embed 包无法加载,原因是 Go 的版本过低,因为 embed 包是在 Go 1.16 中引入的。如果你正在使用较低版本的 Go,这个包会导致构建失败。

解决方案:升级GO版本

首先,确认你当前使用的 Go 版本是否为 1.16 及以上。

go version

如果 Go 版本低于 1.16,可以使用以下命令更新 Go

sudo apt update
sudo apt install golang-go

如果已经装了brew也可以尝试

brew update
brew upgrade go

③更新的时候返回golang-go is already the newest version

在这种情况下,你可以手动下载并安装最新版本的 Go。需要先卸载旧版本,再下载新的:

sudo apt remove golang-go
sudo apt remove --auto-remove golang-go
wget https://go.dev/dl/go1.21.1.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.21.1.linux-amd64.tar.gz# 将 Go 的二进制文件路径添加到系统环境变量 PATH 中
export PATH=$PATH:/usr/local/go/bin

④如果用brew upgrade go,要确保之前在brew已经装过了go,否则可能报错Error: go not installed

执行:

brew install go

成功的话会显示Summary……

⑤如果安装完成go version还是没有更新,可能是环境变脸没有配置

编辑你的 .bashrc.zshrc 文件,添加以下内容:

export PATH=$PATH:/home/linuxbrew/.linuxbrew/bin

保存更改

source ~/.bashrc  # 或 `source ~/.zshrc`,取决于你使用的 shell

⑥go fmt ./... go: updates to go.mod needed; to update it: go mod tidy make: *** [Makefile:13: format] Error 1

go.mod 需要更新。

gitleaks 项目根目录下运行以下命令:

go mod tidy# 之后再运行make build 

⑥出现 gitleaks: command not found 错误,可能是因为 gitleaks 可执行文件没有添加到系统的 PATH 中。

  • 编辑 ~/.bashrc~/.zshrc 文件:
nano ~/.bashrc # 或者 nano ~/.zshrc
  • 在文件末尾添加以下行,将 gitleaks 目录添加到 PATH 中:

    export PATH=$PATH:/path/to/gitleaks   # 这里改成自己的安装路径
  • 保存并重新加载 shell 配置:

source ~/.bashrc # 或者 source ~/.zshrc

(5)开始扫描

具体的指令官方也给出了

Usage:gitleaks [command]Available Commands:completion  generate the autocompletion script for the specified shelldetect      detect secrets in codehelp        Help about any commandprotect     protect secrets in codeversion     display gitleaks versionFlags:-b, --baseline-path string       path to baseline with issues that can be ignored-c, --config string              config file pathorder of precedence:1. --config/-c2. env var GITLEAKS_CONFIG3. (--source/-s)/.gitleaks.tomlIf none of the three options are used, then gitleaks will use the default config--exit-code int              exit code when leaks have been encountered (default 1)-h, --help                       help for gitleaks-l, --log-level string           log level (trace, debug, info, warn, error, fatal) (default "info")--max-target-megabytes int   files larger than this will be skipped--no-color                   turn off color for verbose output--no-banner                  suppress banner--redact                     redact secrets from logs and stdout-f, --report-format string       output format (json, csv, junit, sarif) (default "json")-r, --report-path string         report file-s, --source string              path to source (default ".")-v, --verbose                    show verbose output from scanUse "gitleaks [command] --help" for more information about a command.

我这里以扫描一个本地文件为例:

如果要在终端里面展示扫描结果,--no-git后面加上 --verbose

如果要把结果保存到本地加上--report-path

http://www.yayakq.cn/news/568463/

相关文章:

  • 网站降权wordpress 企业网站制作
  • 苏州网站建设优化过哦做网站产品搜索展示实现
  • 服务器在国外未备案网站网页制作基础教程第二版葛艳玲
  • 浙江建设网站公司招聘网站建设人员
  • 建设个人银行网站网站开发晋升空间 路径
  • 手工艺品网站建设方案苏州网站建设渠道
  • 公司网站怎么做才能吸引人怎么用dw做网站
  • 做网站和做app西地那非片能延时多久
  • 网站全局搜索如何做制作一个网站怎么做
  • 建个网站大概需要多久一个网站同时做竞价和seo
  • 广西地矿建设集团网站网站 规划
  • 首都博物馆 网站建设常见的网络营销的方式有哪些
  • 能在线做初中题的网站用校园网如何搭建WordPress
  • 网站页面设计公司电话网站开发技术可行性分析怎么写
  • 网站建设论文选题谷歌推广外包
  • 长沙个人做网站广告设计公司产品
  • 网站建设优化推广排名清远新闻最新
  • 网站加app建设网站功能建设描述书
  • 广东粤建设计院网站网站开发的完整流程
  • 网页建站专业公司网站搭建教程视频
  • 手机怎么做自己的网站重庆市建设工程信息网、
  • 网站建设价格与方案wordpress的评论
  • 360网站拦截做酒店网站建设必要性
  • 杭州新网站建设方案广州做淘宝的化妆品网站
  • 网站导航设计分析邯郸网站设计开发公司
  • 网站建设项目组织图ip可以用wordpress
  • 制作网站的基本步骤是社交主题 wordpress
  • 个人建网站首选什么域名好h5制作软件推荐
  • wordpress iis7 伪静态规则神马快速排名优化工具
  • 站酷设计师网站南山网站制作联系电话