git

package
v0.0.0-...-564ba19 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2018 License: Apache-2.0 Imports: 16 Imported by: 0

README

git

NOTE

Requires libgit2 to run we need to install it or figure a way to statically build it into git2go

Here is the alpine package: https://pkgs.alpinelinux.org/package/v3.6/main/aarch64/libgit2

Example

Clone maliceio/registry

package main

import (
	"github.com/maliceio/engine/registry/git"
	"github.com/sirupsen/logrus"
)

func init() {
	logrus.SetLevel(logrus.DebugLevel)
}

func main() {
	err := git.CloneRegistry()
	if err != nil {
		logrus.Fatal(err)
	}
	err = git.PullRegistry()
	if err != nil {
		logrus.Fatal(err)
	}
}
DEBU[0000] malice registry has been cloned into: ~/.malice/registry
DEBU[0000] good signature from: blacktop <blacktop@users.noreply.github.com>
DEBU[0000] malice registry has been updated

Get malice plugin metrics

package main

import "github.com/maliceio/engine/registry/git"

func main() {
	git.GetMetricsForRepo("")
}
plugin: fileinfo, stars: 9
plugin: yara, stars: 9
plugin: exe, stars: 7
plugin: nsrl, stars: 4
plugin: virustotal, stars: 4
plugin: office, stars: 4
plugin: pdf, stars: 4
plugin: windows-defender, stars: 3
plugin: floss, stars: 3
plugin: malice-alpine, stars: 2
plugin: fprot, stars: 2
plugin: bro, stars: 2
plugin: javascript, stars: 2
plugin: go-plugin-utils, stars: 2
plugin: totalhash, stars: 2
plugin: fsecure, stars: 1
plugin: team-cymru, stars: 1
plugin: threat-expert, stars: 1
plugin: sophos, stars: 1
plugin: anubis, stars: 1
plugin: archive, stars: 1
plugin: comodo, stars: 1
plugin: clamav, stars: 1
plugin: bitdefender, stars: 1
plugin: avg, stars: 1
plugin: avast, stars: 1
plugin: shadow-server, stars: 1
plugin: avira, stars: 1
plugin: zoner, stars: 1
plugin: escan, stars: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func CloneRegistry

func CloneRegistry() error

CloneRegistry clones the maliceio/registry repo and verifies it's signature

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func PullRegistry

func PullRegistry() error

PullRegistry updates registry repo

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

Types

type RepoMetric

type RepoMetric struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	Stars       int    `json:"stars,omitempty"`
	Forks       int    `json:"forks,omitempty"`
	Watchers    int    `json:"watchers,omitempty"`
}

RepoMetric the repo metrics struct

func GetMetricsForOrg

func GetMetricsForOrg(org string) (RepoMetric, error)

GetMetricsForOrg reads org metrics from Github API

func GetMetricsForUser

func GetMetricsForUser(user string) (RepoMetric, error)

GetMetricsForUser reads user metrics from Github API

Jump to

Keyboard shortcuts

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