Coder Social home page Coder Social logo

madneal / gshark Goto Github PK

View Code? Open in Web Editor NEW
818.0 12.0 127.0 245.4 MB

Scan for sensitive information easily and effectively.

License: Apache License 2.0

Go 51.14% JavaScript 9.01% HTML 0.09% SCSS 6.60% Dockerfile 0.13% Smarty 3.61% Vue 29.41%
github go git-leak gitlab golang gorm vue postman

gshark's Introduction

ZH | EN

GgShark logo

GShark

Scan for sensitive information easily and effectively.

GShark Go Report Card Release

The project is based on Go and Vue to build a management system for sensitive information detection. For the full introduction, please refer to articles and videos. For now, all the scans are only targeted to the public environments, not local environments.

For the usage of GShark, please refer to wiki.

Features

  • Support multi-platforms, including GitLab, GitHub, Searchcode, Postman
  • Flexible menu and API permission setting
  • Flexible rules and filter rules
  • Utilize gobuster to brute force subdomain
  • Easily used management system
  • Support for docker deployment

Quick start

Docker

git clone https://github.com/madneal/gshark
cd gshark
docker-compose build && docker-compose up 

Deployment

Requirements

  • Nginx
  • MySQL(version above 8.0)

It's suggested to deploy the frontend project by nginx. Place the dist folder under /var/www/html, modify the nginx.conf (/etc/nginx/nginx.conf for linux) to reverse proxy the backend service. For the detailed deployment videos, refer to bilibili or youtube. For the deployment in windows, refer to here.

Nginx

Modify the nginx.conf:

// config the user accoring to your need
user  www www;
worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    server {
        listen       8080;
        server_name  localhost;

        location / {
            autoindex on;
            root   html;
            index  index.html index.htm;
        }
        location /api/ {
            proxy_set_header Host $http_host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            rewrite ^/api/(.*)$ /$1 break;
            proxy_pass http://127.0.0.1:8888;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
    include servers/*;
}

The deployment work is straightforward. Find the corresponding version zip file from releases.

Unzip and copy the files inside dist to /var/www/html folder of Nginx.

unzip gshark*.zip

Start the Nginx and the Front-End is deployed successfully.

Incremental Deployment

For the incremental deployment, sql.md should be executed for the corresponding database operations.

Server service

For the first time, you need to rename config-temp.yaml to config.yaml.

go build && ./gshark
or
go run main.go

For the scan service, it's necessary to config the corresponding rules. For example, Github or Gitlab rules.

Development

Server

git clone https://github.com/madneal/gshark.git

cd server

go mod tidy

mv config-temp.yaml config.yaml

go build

./gshark

or

go run main.go

Web

cd ../web

npm install

npm run serve

Usage

Add Token

GitHub

To execute the scan task for GitHub, you need to add a GitHub token for crawl information in GitHub. You can generate a token in tokens. Most access scopes are enough. For the GitLab search, remember to add a token too.

iR2TMt.md.png

Postman

Obtain the postman.sid cookie:

image

Rule Configuration

For the Github or Gitlab rule, the rule will be matched by the syntax in the corresponding platforms. Directly, you config what you search at GitHub. You can download the rule import template CSV file, then batch import rules.

image

Filter Configuration

Filter is only addressed to GitHub search now. There are three classes of filters, including extension, keyword, sec_keyword. For extension and keyword, they can used for blacklist or whitelist.

For more information, you can refer to this video.

Configuration

You are supposed to rename config-temp.yaml to config.yaml and config the database information and other information according to your environment.

GitLab Base Url

image

FAQ

  1. Default username and password to login

gshark/gshark

  1. Database initial failed

make sure the version of MySQL is over 5.6. And remove the database before initialing the second time.

  1. go get ./... connection error

It's suggested to enable GOPROXY(refer this article for golang upgrade):

go env -w GOPROXY=https://goproxy.cn,direct
go env -w GO111MODULE=on
  1. When deploying the web to nginx, the page was empty

try to clear the LocalStorage

Resources

Articles

Videos

License

Apache License 2.0

404StarLink 2.0 - Galaxy

GShark 是 404Team 星链计划2.0中的一环,如果对 GShark 有任何疑问又或是想要找小伙伴交流,可以参考星链计划的加群方式。

gshark's People

Contributors

0xzmz avatar dependabot[bot] avatar hackneal avatar johnryk avatar madneal avatar slark-yuxj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gshark's Issues

状态切换有问题

如果已经翻页了,切换转态的时候,比如从未处理切换到已确认,URL拼接有问题

Facing Issue after building

Hey,

I build main.go but after it I am facing
`root@bugdiscloseguy:~/go/src/github.com/neal1991/gshark# go run main.go
[0000] PANIC GShark: open /root/go/src/github.com/neal1991/gshark/conf/app.ini: no such file or directory
panic: (*logrus.Entry) (0xb99a40,0xc42006c2a0)

goroutine 1 [running]:
github.com/sirupsen/logrus.Entry.log(0xc420086320, 0xc4200812c0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/root/go/src/github.com/sirupsen/logrus/entry.go:138 +0x2d2
github.com/sirupsen/logrus.(*Entry).Panic(0xc42006c180, 0xc420065c80, 0x1, 0x1)
/root/go/src/github.com/sirupsen/logrus/entry.go:206 +0xb8
github.com/sirupsen/logrus.(*Entry).Panicln(0xc42006c180, 0xc420065d08, 0x1, 0x1)
/root/go/src/github.com/sirupsen/logrus/entry.go:301 +0xd5
github.com/neal1991/gshark/settings.init.0()
/root/go/src/github.com/neal1991/gshark/settings/settings.go:30 +0x179
exit status 2`

Let me know how to resolve them.

Thanks

实现角色用户权限分离

如同时给A、B用户开通了一个管理权限账号(都有规则管理、仓库管理、github搜索结果管理权限),如何casbin权限控制A、B用户用户看到与操作的数据?

github 规则设置

因为现在已经没有本地搜索,因此之前地那些规则类型可以去掉

APP确认资产

确认资产的时候进一步补充信息,包括开发者,发布日期

json marshal 无法解析时间

  • 存在大量无意义的URL字段,最好对codeResult做一个 format
  • json marshal 只能序列化时间字段
  • 似乎是 Repository 的日期字段都是 nil

运行scan 报错

编译好后,运行scan 报错,运行web正常,报错信息如下:
[0000] INFO GShark: sqlite db: /home/york//misec.db
[0000] INFO GShark: all scan mode
[0000] WARN GShark: There is no valid gitlab token
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x1d0 pc=0xb6fb96]

goroutine 1 [running]:
github.com/neal1991/gshark/util/gitlabsearch.GetProjects(0x0)
/home/york/goProject/src/github.com/neal1991/gshark/util/gitlabsearch/search.go:225 +0x356
github.com/neal1991/gshark/util/gitlabsearch.RunSearchTask(0xc0002f5080, 0x0, 0x0)
/home/york/goProject/src/github.com/neal1991/gshark/util/gitlabsearch/search.go:41 +0x42
github.com/neal1991/gshark/util/gitlabsearch.RunTask(0x384)
/home/york/goProject/src/github.com/neal1991/gshark/util/gitlabsearch/search.go:15 +0x2b
github.com/neal1991/gshark/util.Scan(0xc0002d26e0)
/home/york/goProject/src/github.com/neal1991/gshark/util/scan.go:54 +0x24c
github.com/urfave/cli.HandleAction(0xd0b160, 0xee8a10, 0xc0002d26e0, 0xc0002c4c00, 0x0)
/home/york/goProject/pkg/mod/github.com/urfave/[email protected]/app.go:492 +0x7c
github.com/urfave/cli.Command.Run(0xea10ea, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0xebd19a, 0x1e, 0x0, ...)
/home/york/goProject/pkg/mod/github.com/urfave/[email protected]/command.go:210 +0x991
github.com/urfave/cli.(*App).Run(0xc000269380, 0xc00000e080, 0x2, 0x2, 0x0, 0x0)
/home/york/goProject/pkg/mod/github.com/urfave/[email protected]/app.go:255 +0x6ab
main.main()
/home/york/goProject/src/github.com/neal1991/gshark/main.go:24 +0x354

APP 资产页面

url: app/appid?id=

  • 展示 APP 详细信息
  • 已列表的形式展现
  • css 通过 mian.css 来进行修改

app 资产管理

CREATE TABLE `app_assets` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 
`name` TEXT NULL, 
`description` TEXT NULL, 
`market` TEXT NULL, 
`developer` TEXT NULL, 
`version` TEXT NULL, 
`deploy_date` TEXT NULL, 
`url` TEXT NULL, 
`status` INTEGER NULL, 
`sha256`  TEXT NOT NULL,
`created_time` DATETIME NULL, 
`updated_time` DATETIME NULL)

github.Repository 包含大量无意义URL

包含大量无意义包含 API 的 url

"merges_url":"https://api.github.com/repos/homeii/GxIconDIY/merges",
"milestones_url":"https://api.github.com/repos/homeii/GxIconDIY/milestones{/number}",
"notifications_url":"https://api.github.com/repos/homeii/GxIconDIY/notifications{?since,all,participating}",
"pulls_url":"https://api.github.com/repos/homeii/GxIconDIY/pulls{/number}","
releases_url":"https://api.github.com/repos/homeii/GxIconDIY/releases{/id}",
"stargazers_url":"https://api.github.com/repos/homeii/GxIconDIY/stargazers",

基于角色实现数据控制

这个特性也比较重要,比如不同的用户可以创建属于自己得rule,它只能够看到自己创建的规则的数据。通过casbin得模型似乎也可以实现这个功能。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.