pathfinder

package module
v0.0.0-...-d3070cc Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: MIT Imports: 21 Imported by: 0

README

Pathfinder

This program is a Pathfinder.

What this means is that it's going to listen for messages hidden in several different sources, and maybe act upon them.

This can be useful to bypass censorship, or maybe something else.

You can use keywords (TagMap) or embed arbitrary data with the included packer util.

Disclaimer

This project is meant for EDUCATIONAL PURPOSES ONLY.

Don't use it for illegal activities.

You are the sole responsible for your actions.

Getting Started

See the example on cmd/pathfinder

Usage

./pathfinder <CUE>

Example

example

Prerequisites
  • Go 1.10
  • Twitter OAUTH
Installing

First, download the project to your GOPATH

go get -u github.com/kamushadenes/pathfinder

Then build the binary (or see below to run it properly with Docker)

cd $GOPATH/github.com/kamushadenes/pathfinder
cd cmd/pathfinder
go build

Running the tests

go test -v
Benchmark
go test -v -bench=.

Running

Set the following environment variables, and change them accordingly:

TWITTER_CONSUMER_KEY=xxxx
TWITTER_CONSUMER_SECRET=xxxx
TWITTER_ACCESS_TOKEN=xxx
TWITTER_ACCESS_SECRET=xxx

Roadmap

  • Instagram
  • Facebook
  • YouTube
  • Pinterest
  • Pastebin
  • ???

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllLevels = logrus.AllLevels
View Source
var DebugLevel = logrus.DebugLevel
View Source
var ErrorLevel = logrus.ErrorLevel
View Source
var FatalLevel = logrus.FatalLevel
View Source
var Handle func(p Path)
View Source
var InfoLevel = logrus.InfoLevel
View Source
var Logger *logrus.Logger
View Source
var PanicLevel = logrus.PanicLevel
View Source
var WarnLevel = logrus.WarnLevel

Functions

func AddLogHook

func AddLogHook(hook *LogHook)

func DecodeString

func DecodeString(s string) (string, error)

func EncodeString

func EncodeString(s string) (string, error)

func GetColoredFormatter

func GetColoredFormatter() *prefixed.TextFormatter

func GetJsonLogger

func GetJsonLogger() *logrus.Logger

func GetLogFields

func GetLogFields(m map[string]interface{}) map[string]interface{}

func GetLogLevels

func GetLogLevels(subset string) []logrus.Level

func GetLogger

func GetLogger() *logrus.Logger

func GetPosition

func GetPosition(frameSkip int) (string, string, int)

func Run

func Run(cnf *Config)

func StartTwitter

func StartTwitter()

Types

type Config

type Config struct {
	Pathfinder ConfigPathfinder `yaml:"pathfinder"`
}

func NewConfig

func NewConfig() *Config

func ReadConfig

func ReadConfig(data []byte) (*Config, error)

type ConfigOrigin

type ConfigOrigin struct {
	Enable bool `yaml:"bool"`
}

type ConfigPath

type ConfigPath struct {
	Cue    string `yaml:"cue"`
	Prefix string `yaml:"prefix"`
	Suffix string `yaml:"suffix"`
}

type ConfigPathfinder

type ConfigPathfinder struct {
	Path    ConfigPath              `yaml:"path"`
	TagMap  ConfigTagMap            `yaml:"tagmap"`
	Origins map[string]ConfigOrigin `yaml:"origins"`
}

type ConfigTag

type ConfigTag struct {
	Tag   string `yaml:"tag"`
	Type  string `yaml:"type"`
	Value string `yaml:"value"`
}

type ConfigTagMap

type ConfigTagMap struct {
	Separator string      `yaml:"separator"`
	Trim      string      `yaml:"trim"`
	Tags      []ConfigTag `yaml:"tags"`
}

type DecodeFailed

type DecodeFailed struct {
}

func (DecodeFailed) DecodeFailed

func (e DecodeFailed) DecodeFailed() bool

func (DecodeFailed) Error

func (e DecodeFailed) Error() string

func (DecodeFailed) MaxPayloadSize

func (e DecodeFailed) MaxPayloadSize() bool

func (DecodeFailed) RegexMatchFailed

func (e DecodeFailed) RegexMatchFailed() bool

func (DecodeFailed) Timeout

func (e DecodeFailed) Timeout() bool

type Error

type Error interface {
	error
	Timeout() bool
	MaxPayloadSize() bool
	RegexMatchFailed() bool
	DecodeFailed() bool
}

func NewDecodeFailed

func NewDecodeFailed() Error

func NewMaxPayloadSizeError

func NewMaxPayloadSizeError(cur, max int) Error

func NewRegexMatchFailed

func NewRegexMatchFailed() Error

type LogHook

type LogHook struct {
	Writer    io.Writer
	LogLevels []logrus.Level
	Formatter logrus.Formatter
}

WriterHook is a hook that writes logs of specified LogLevels to specified Writer

func GetLogHook

func GetLogHook(writer io.Writer, logLevels []logrus.Level) *LogHook

func (*LogHook) Fire

func (hook *LogHook) Fire(entry *logrus.Entry) error

Fire will be called when some logging function is called with current hook It will format log entry to string and write it to appropriate writer

func (*LogHook) Levels

func (hook *LogHook) Levels() []logrus.Level

Levels define on which log levels this hook would trigger

type MaxPayloadSizeError

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

func (MaxPayloadSizeError) DecodeFailed

func (e MaxPayloadSizeError) DecodeFailed() bool

func (MaxPayloadSizeError) Error

func (e MaxPayloadSizeError) Error() string

func (MaxPayloadSizeError) MaxPayloadSize

func (e MaxPayloadSizeError) MaxPayloadSize() bool

func (MaxPayloadSizeError) RegexMatchFailed

func (e MaxPayloadSizeError) RegexMatchFailed() bool

func (MaxPayloadSizeError) Timeout

func (e MaxPayloadSizeError) Timeout() bool

type Origin

type Origin interface {
	GetName() string
	FindPath() *Path
	GetMaxPayloadSize() int
	GetPrefix() string
	SetPrefix(s string) error
	GetSuffix() string
	SetSuffix(s string) error
	GetCue() string
	SetCue(s string) error
	Start()
}

type Path

type Path struct {
	Origin          string
	OriginPrefix    string
	OriginSuffix    string
	Time            *time.Time
	FullText        string
	MatchText       string
	DecodedEntities []ConfigTag
	Metadata        map[string]string
}

func HandleArbitrary

func HandleArbitrary(job Path) (Path, error)

func HandleTagged

func HandleTagged(job Path) (Path, error)

func NewPath

func NewPath() *Path

type RegexMatchFailed

type RegexMatchFailed struct {
}

func (RegexMatchFailed) DecodeFailed

func (e RegexMatchFailed) DecodeFailed() bool

func (RegexMatchFailed) Error

func (e RegexMatchFailed) Error() string

func (RegexMatchFailed) MaxPayloadSize

func (e RegexMatchFailed) MaxPayloadSize() bool

func (RegexMatchFailed) RegexMatchFailed

func (e RegexMatchFailed) RegexMatchFailed() bool

func (RegexMatchFailed) Timeout

func (e RegexMatchFailed) Timeout() bool

type Twitter

type Twitter struct {
	ConsumerKey    string `env:"TWITTER_CONSUMER_KEY,required"`
	ConsumerSecret string `env:"TWITTER_CONSUMER_SECRET,required"`
	AccessToken    string `env:"TWITTER_ACCESS_TOKEN,required"`
	AccessSecret   string `env:"TWITTER_ACCESS_SECRET,required"`
	// contains filtered or unexported fields
}

func NewTwitter

func NewTwitter() (*Twitter, error)

func (*Twitter) FindPath

func (t *Twitter) FindPath() *Path

func (*Twitter) GetCue

func (t *Twitter) GetCue() string

func (*Twitter) GetMaxPayloadSize

func (t *Twitter) GetMaxPayloadSize() int

func (*Twitter) GetName

func (t *Twitter) GetName() string

func (*Twitter) GetPrefix

func (t *Twitter) GetPrefix() string

func (*Twitter) GetSuffix

func (t *Twitter) GetSuffix() string

func (*Twitter) SetCue

func (t *Twitter) SetCue(s string) error

func (*Twitter) SetPrefix

func (t *Twitter) SetPrefix(s string) error

func (*Twitter) SetSuffix

func (t *Twitter) SetSuffix(s string) error

func (*Twitter) Start

func (t *Twitter) Start()

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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