goca

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2019 License: Apache-2.0 Imports: 19 Imported by: 0

README

Build Status GitHub Issues GitHub tag Go Version License Contribute Yes FOSSA Status

Goca is a FOCA fork written in Go, which is a tool used mainly to find metadata and hidden information in the documents its scans. These documents may be on web pages, and can be downloaded and analyzed with Goca.

It is capable of analyzing a wide variety of documents, with the most common being Microsoft Office, Open Office, or PDF files, although it also analyzes Adobe InDesign or SVG files, for instance.

These documents are searched for using search engines such as:

  • Google
  • Bing
  • DuckDuckGo
  • Yahoo
  • Ask

Then downloads the documents and extracts the EXIF information from graphic files, and a complete analysis of the information discovered through the URL is conducted even before downloading the file.


USAGE

Download built packages from Releases

To build from source, you will need Go installed.

$ export GO111MODULE=on 
$ go get ./...
$ go run goca/goca.go -h

To run Goca from Docker:

$ docker build -t gocaio/goca /path/to/goca
$ docker run gocaio/goca -h

Contributing Guide

Please reade the Contributing guide:


Documentation

Refer to the Official Doc.

License

FOSSA Status

Documentation

Index

Constants

View Source
const UserAgent = "The_Goca_v0.1"

UserAgent defines the UserAgent used by goca

Variables

View Source
var (
	// AppName is the Application name
	AppName string
	// AppVersion is the Application version
	AppVersion string
)
View Source
var (
	PS             ProjectStore
	CurrentProject Project
)
View Source
var (
	// Topics is a list available event topics
	Topics = map[string]string{
		"NewTarget": "topic:new:url",
		"NewOutput": "topic:new:output",
	}
)

Functions

func IsPluginTypeValid

func IsPluginTypeValid(plugType string) bool

IsPluginTypeValid validates plugin against registered plugins

func ListPlugins

func ListPlugins() map[string][]string

ListPlugins list loaded plugins

func PluginRecover

func PluginRecover(plugName, funcName string)

func RegisterPlugin

func RegisterPlugin(name string, plugin Plugin)

RegisterPlugin is a function that allows plugins to get registered in Goca

func StartFolder

func StartFolder(input Input)

StartFolder is the Goca library entrypoint for folders

func StartScrapper added in v0.2.0

func StartScrapper(input Input)

StartScrapper is the Goca library entrypoint for the web scrapper TODO: v0.3.0 (core rewrite) This should been placed on other file/location

func StartTerm

func StartTerm(input Input)

StartTerm is the Goca library entrypoint for terms

Types

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

Controller satisfy the Manager interface

func NewController

func NewController(input Input) *Controller

func NewControllerTest

func NewControllerTest() *Controller

func (*Controller) Publish

func (c *Controller) Publish(topic string, args ...interface{})

func (*Controller) Subscribe

func (c *Controller) Subscribe(topic string, fn interface{}) error

func (*Controller) SubscribeOnce

func (c *Controller) SubscribeOnce(topic string, fn interface{}) error

func (*Controller) Unsubscribe

func (c *Controller) Unsubscribe(topic string, fn interface{}) error

type Input

type Input struct {
	Term      string
	Domain    string
	URL       string
	ListURL   bool
	Folder    string
	FileType  []string
	PagesDork int
	TimeOut   int
	UA        string
	Scrapper  string
}

Input represents the command line arguments

type Manager

type Manager interface {
	Publish(string, ...interface{})
	Subscribe(string, interface{}) error
	SubscribeOnce(string, interface{}) error
	Unsubscribe(string, interface{}) error
}

Manager represents what interface should satisfies a Goca controller

type Output

type Output struct {
	// MainType will set which kind of file represents the Output
	MainType     string  `json:"main_type,omitempty"`
	Target       string  `json:"target,omitempty"`
	CreateDate   string  `json:"create_date,omitempty"`
	ModifyDate   string  `json:"modify_date,omitempty"`
	MetadataDate string  `json:"metadata_date,omitempty"`
	CreatorTool  string  `json:"creator_tool,omitempty"`
	DocumentID   string  `json:"document_id,omitempty"`
	InstanceID   string  `json:"instance_id,omitempty"`
	ContentType  string  `json:"content_type,omitempty"`
	Title        string  `json:"title,omitempty"`
	Lang         string  `json:"lang,omitempty"`
	Producer     string  `json:"producer,omitempty"`
	Genre        string  `json:"genre,omitempty"`
	Artist       string  `json:"artist,omitempty"`
	AlbumArtist  string  `json:"album_artist,omitempty"`
	Album        string  `json:"album,omitempty"`
	Year         string  `json:"year,omitempty"`
	Month        string  `json:"month,omitempty"`
	Day          string  `json:"day,omitempty"`
	Comment      string  `json:"comment,omitempty"`
	Composer     string  `json:"composer,omitempty"`
	Lyrics       string  `json:"lyrics,omitempty"`
	Keywords     string  `json:"keywords,omitempty"`
	Description  string  `json:"description,omitempty"`
	ModifiedBy   string  `json:"modified_by,omitempty"`
	Category     string  `json:"category,omitempty"`
	DiscU        int     `json:"disc_u,omitempty"`
	DiscD        int     `json:"disc_d,omitempty"`
	DiscC        int     `json:"disc_c,omitempty"`
	TrackU       int     `json:"track_u,omitempty"`
	TrackD       int     `json:"track_d,omitempty"`
	TrackC       int     `json:"track_c,omitempty"`
	Duration     string  `json:"duration,omitempty"`
	Version      uint8   `json:"version,omitempty"`
	FrameCount   uint16  `json:"frame_count,omitempty"`
	FrameRate    float32 `json:"frame_rate,omitempty"`
	ImageWidth   float32 `json:"image_width,omitempty"`
	ImageHeight  float32 `json:"image_height,omitempty"`
	Email        string  `json:"email,omitempty"`
}

Output is a flat structure which represents all possible values that Goca can extract. Each plugin will generate one Output per object processed

func NewOutput

func NewOutput() *Output

NewOutput returns a new empty Output structure

type Plugin

type Plugin struct {
	Type    string
	Assoc   []string
	Action  SetupFunc
	Matcher matchers.Matcher
}

Plugin defines the plugin entrypoint

type Project added in v0.2.0

type Project struct {
	ID      bson.ObjectID `boltholdKey:"ID"`
	Name    string
	Created time.Time
	Scans   []bson.ObjectID
}

type ProjectStore added in v0.2.0

type ProjectStore struct {
	DS *bolthold.Store
}

func OpenProjectStore added in v0.2.0

func OpenProjectStore() (ProjectStore, error)

Opens a Project Store

func (ProjectStore) AddScanToProject added in v0.2.0

func (ps ProjectStore) AddScanToProject(name string, scan bson.ObjectID) error

Adds an scan to an existing project

func (ProjectStore) DeleteProject added in v0.2.0

func (ps ProjectStore) DeleteProject(name string) error

Deletes an existing project

func (ProjectStore) GetProject added in v0.2.0

func (ps ProjectStore) GetProject(name string) (Project, error)

Obtain a project

func (ProjectStore) GetProjectList added in v0.2.0

func (ps ProjectStore) GetProjectList() ([]Project, error)

Obtain all projects

func (ProjectStore) GetScan added in v0.2.0

func (ps ProjectStore) GetScan(id bson.ObjectID) (Scan, error)

Gets an scan

func (ProjectStore) NewProject added in v0.2.0

func (ps ProjectStore) NewProject(name string) (Project, error)

Creates a new project

func (ProjectStore) PrintProject added in v0.2.0

func (ps ProjectStore) PrintProject(name string) error

Prints a project

func (ProjectStore) SaveScan added in v0.2.0

func (ps ProjectStore) SaveScan(project string, output *Output) error

Saves an scan associated to a project

type Scan added in v0.2.0

type Scan struct {
	ID       bson.ObjectID `boltholdKey:"ID"`
	Output   Output
	Started  time.Time
	Finished time.Time
}

type SetupFunc

type SetupFunc func(Manager) error

SetupFunc defines how plugin entrypoint looks like

Directories

Path Synopsis
doc
gpx
mp3
odp
ods
odt
pdf
ppt
swf
xls

Jump to

Keyboard shortcuts

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