u2semi

package module
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: MIT Imports: 8 Imported by: 0

README

U2semi

A web server running as a honeypot handling any requests.

Tech

  • Go
  • Gorm

Usage

NAME:
   U2semi - A honeypot working as a HTTP server

USAGE:
   U2semi [global options] command [command options] [arguments...]

COMMANDS:
   server, s   Start HTTP server
   version, v  Show version
   help, h     Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h  show help (default: false)
Custom header

You can add items on the header like below.

web:
  port: 80
  headers:
    - key: Server
      value: Apache/2.4.2 (Unix) PHP/4.2.2
Custom content
# create a directory
mkdir db/

# keep empty dir as content
$ find ./content -type d -empty -exec touch {}/.gitkeep \;

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conf

type Conf struct {
	Repo RepoConf `yaml:"repo"`
	Web  WebConf  `yaml:"web"`
}

type DirListPageTemplate

type DirListPageTemplate struct {
	ParentDir string
	Dir       string
	Files     []string
}
type Header struct {
	Key   string `yaml:"key"`
	Value string `yaml:"value"`
}

type MySQLRepoConf

type MySQLRepoConf struct {
	Username string `yaml:"username"`
	Password string `yaml:"password"`
	Hostname string `yaml:"hostname"`
	DB       string `yaml:"db"`
}

type RepoConf

type RepoConf struct {
	Type  RepoType      `yaml:"type"`
	MySQL MySQLRepoConf `yaml:"mysql"`
}

type RepoType

type RepoType string
const (
	RepoTypeNone  RepoType = "none"
	RepoTypeMySQL RepoType = "mysql"
)

type Request

type Request struct {
	Method  string
	URL     string
	Proto   string
	Headers map[string]string
	Body    string
	IPFrom  string
	IPTo    string
}

type RequestRepository

type RequestRepository interface {
	Create(req *Request) error
}

type RootController

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

func NewRootController

func NewRootController(repo RequestRepository, conf *WebConf) *RootController

func (*RootController) HandlerAny

func (c *RootController) HandlerAny(w http.ResponseWriter, r *http.Request)

type WebConf

type WebConf struct {
	Port            int                    `yaml:"port"`
	Headers         []*Header              `yaml:"headers"`
	ContentDir      string                 `yaml:"content_directory"`
	DirListTemplate string                 `yaml:"directory_listing_template"`
	Contents        map[string]*WebContent `yaml:"contents"`
}

type WebContent

type WebContent struct {
	Body string `yaml:"body"`
}

Directories

Path Synopsis
repository

Jump to

Keyboard shortcuts

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