Giter Club home page Giter Club logo

abuse-detector's Introduction

Abuse Detector

This application is for preventing phishing sites are created on Studio.

Requirements

  • Go 1.14.9 >=
  • Docker 2.4.0.0 >=
  • Docker Compose 1.27.4 >=

Usage

Request verification

This API verifies if the site does not include malicious links, such as fishing.

http://localhost:3000/verify?url=https://www.google.com/

The response would look like below if the site is not malicious.

{
    "strategyName": "TransparencyReportVerifyStrategy",
    "link": ["https://www.google.com/"],
    "malicious": false,
    "statusCode": 200,
    "error": {
        "Name": "google-chrome",
        "Err": {}
    }
}

If it's malicious, the response looks like below.

{
    "strategyName": "TransparencyReportVerifyStrategy",
    "link": ["https://zonabn1segura-pe.com/"],
    "malicious": true,
    "statusCode": 200,
    "error": null
}

How to build

go build *.go

How to run production

  1. Create .env based off from .env.default. For API keys required, please refer documents below in this README.
  2. Set API Keys accordingly. For API keys required, please refer documents below in this README.
  3. Run command below.
    docker-compose up
    
    For the initial start, run as below.
    docker-compose up --build
    

How to run for development

  1. Create .env based off from .env.default. For API keys required, please refer documents below in this README.
  2. Set API Keys accordingly. For API keys required, please refer documents below in this README.
  3. Comment out CMD ["./app"] and remove comment of CMD [ "realize", "start" ] instead to enable realize for hot reloading.
  4. Run command below.
    docker-compose up
    
    For the initial start, run as below.
    docker-compose up --build
    

How to run for debugging with IDE, such as Goland

  1. Create .env based off from .env.default. For API keys required, please refer documents below in this README.

  2. Configure COMMON_APP_ENV=, no strings. (Default should be production)

  3. Set API Keys accordingly. For API keys required, please refer documents below in this README.

  4. Comment out CMD ["./app"] and remove comment of CMD [ "realize", "start" ] instead to enable realize for hot reloading.

  5. Spin up servers as below

    Spin up chrome headless server

    docker run -d -p 9222:9222 --rm --name headless-shell --shm-size 2G chromedp/headless-shell
    
  6. Then, right click main.go and debug run on Goland IDE.

How to run all tests

go test -v -race -run=. -bench=. ./...

How to build Docker image

This is how to build and confirm the image is built correctly.

docker build -t studio-abuse-detector .
docker run -p 3000:3000 -d --name studio-abuse-detector studio-abuse-detector:latest
curl localhost:3000

Opearation Related

How to remove all images including running

docker rm -f `docker ps -qa`

How to access an image

docker-compose exec app /bin/sh

Appendix

How to get API key for urlscan.io

  1. Go to https://urlscan.io/ and create an account.
  2. Go to Settings & API and create an API Key
  3. Copy the Key and set it to URLSCAN_API_KEY in the .env file

How to get API key for Google Safe Browsing API

  1. Access to Google API Console and create a project
  2. Create API key in the project.
  3. Look for Google Safe Browsing API in Liberary tab and add it for the API Key created.
  4. Copy the Key and set it to GOOGLE_SAFE_BROWSING_API_KEY in the .env file

Caveat

  • Chrome Headless server in use may need load balancing for a more massive load of access.
  • Test links are real phishing sites for now. They become offline or removed in the short term, so tests highly likely to fail.

abuse-detector's People

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.