cyberetrieve

package module
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2024 License: MIT Imports: 9 Imported by: 0

README

Cyber-Retrieve

介绍

Cyber-Retrieve 是使用Go实现的网络空间搜索引擎的第三方包, 用于从中检索信息.

  1. 支持语法自动转换(部分)
  2. 支持多种搜索引擎,目前已经集成
是否集成 名称 地址
Quake https://quake.360.net
Fofa https://fofa.info

使用

安装

go get -u github.com/N0el4kLs/cyberetrieve

使用案例:

import (
    "fmt"

    "github.com/N0el4kLs/cyberetrieve"
    "github.com/N0el4kLs/cyberetrieve/sources"
)

func main() {
	query := sources.Query{
		Query:         `title:"login"`,
		NumberOfQuery: 5,
	}
	session := sources.Session{
		QuakeToken: "xxx-xxx-xxx",
		FofaKey:    "xxx-xxx-xxx",
	}

	engine := cyberetrieve.NewCyberRetrieveEngine(query, session,
		cyberetrieve.WithAutoGrammar(),
		cyberetrieve.WithFofaSearch(),
	)
	if rst, err := engine.RetrieveResult(); err != nil {
		fmt.Println("error:", err)
	} else {
		fmt.Println(rst)
	}
}

更多使用案例可以前往example查看

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CyberRetrieveEngine

type CyberRetrieveEngine struct {
	// Query is the query struct
	// that contains the different engines query to search
	Query *sources.Query
	// contains filtered or unexported fields
}

CyberRetrieveEngine is the main struct for the engine

func NewCyberRetrieveEngine

func NewCyberRetrieveEngine(query sources.Query, session sources.Session, engineOptions ...EngineOption) *CyberRetrieveEngine

NewCyberRetrieveEngine creates a new cyber retrieve engine

func (*CyberRetrieveEngine) RetrieveResult

func (c *CyberRetrieveEngine) RetrieveResult() ([]sources.Result, error)

RetrieveResult this function return the result with []sources.Result slice type

func (*CyberRetrieveEngine) RetrieveWithChannel

func (c *CyberRetrieveEngine) RetrieveWithChannel() (chan sources.Result, error)

RetrieveWithChannel this function return the result with chan Result type

type EngineMode

type EngineMode uint8
const (
	ModeQuake EngineMode = 1 << (8 - 1 - iota)
	ModeFofa
	ModeHunter
)

type EngineOption

type EngineOption func(c *CyberRetrieveEngine)

EngineOption is a type for setting options for the engine

func WithAutoGrammar

func WithAutoGrammar() EngineOption

WithAutoGrammar this function is used to set the auto grammar option

func WithDeepSearch

func WithDeepSearch() EngineOption

WithDeepSearch this function is used to set the deep search option

func WithFofaSearch

func WithFofaSearch() EngineOption

WithFofaSearch this function is used to set the search mode to fofa

func WithHunterSearch

func WithHunterSearch() EngineOption

func WithQuakeSearch

func WithQuakeSearch() EngineOption

WithQuakeSearch this function is used to set the search mode to quake

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL