Giter Club home page Giter Club logo

chargen-go's Introduction

Chargen-Go

Chargen protocol implementation as per RFC 864 and RFC 865. Ipv6 friendly.

Client also has ability to spoof source IPs for chargen DDoS amplication attacks.

A Cli tool chargen-go, provides the ability to stand up a server and use a client.

Installation

go get -u github.com/rek7/chargen-go

Install cli tool to $GOPATH/bin

go install github.com/rek7/chargen-go

Cli Command

$ ~/go/bin/chargen-go
chargen - Wrapper for github.com/rek7/chargen-go library to stand up a server or run a client.

Usage:
  chargen [command]

Available Commands:
  client      Chargen UDP/TCP client
  completion  Generate the autocompletion script for the specified shell
  help        Help about any command
  server      Chargen TCP/UDP client

Flags:
  -h, --help   help for chargen

Use "chargen [command] --help" for more information about a command.

Server Example

TCP

package main

import (
	"net"

	"github.com/rek7/chargen-go/pkg/chargen"
)

func main() {
	ln, err := net.Listen("tcp", ":19")
	if err != nil {
		// handle error
	}
	server := chargen.NewServer()
	server.ServeTCP(ln)
}

UDP

package main

import (
    "net"

    "github.com/rek7/chargen-go/pkg/chargen"
)

func main() {
    ln, err := net.ListenUDP("udp", &net.UDPAddr{
        Port: 19,
        IP:   net.ParseIP("0.0.0.0"),
    })
    if err != nil {
        // handle error
    }
    server := chargen.NewServer()
    server.ServeUDP(ln)
}

Client Example

package main

import (
    "fmt"
    "net"

    "github.com/rek7/chargen-go/pkg/chargen"
)

func main() {
    client, err := chargen.NewClient("tcp", "127.0.0.1:19")
    if err != nil {
        // handle error
    }
    defer client.Close()

    // Used to spoof Source IP for amplification attacks. Leave a blank IP if you want it to randomly
    // generate a public ip.
    client.UpdateSrcIP(net.IP("192.168.1.1"))

    // Specify 0 to generate a packet random within the size 1-512 bytes.
    client.Write(0)

    for {
        line, err := client.Read()
        if err != nil {
            // handle error
        }
        fmt.Println(string(line))
    }
}

chargen-go's People

Contributors

rek7 avatar cowsaymoe avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.