networkCmd

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HTTPServerCmd = &cobra.Command{
	Use:   "http-server",
	Short: "Start a simple HTTP/HTTPS file server for the current directory",
	Long: `Serves files from the current directory over HTTP or HTTPS.
It can also be configured to accept file uploads via PUT requests.
When TLS is enabled, it generates a self-signed certificate.

Examples:
  # Serve current directory on http://0.0.0.0:8000
  anbu http-server

  # Serve on a different address and port
  anbu http-server -l 127.0.0.1:9090

  # Enable file uploads (e.g., curl -T file.txt http://localhost:8000/file.txt)
  anbu http-server -u

  # Serve over HTTPS with a self-signed certificate
  anbu http-server -t`,
	Run: func(cmd *cobra.Command, args []string) {
		options := &anbuNetwork.HTTPServerOptions{
			ListenAddress: httpServerFlags.listenAddress,
			EnableUpload:  httpServerFlags.enableUpload,
			EnableTLS:     httpServerFlags.enableTLS,
		}
		server := &anbuNetwork.HTTPServer{
			Options: options,
		}
		err := server.Start()
		if err != nil {
			log.Fatal().Err(err).Msg("Failed to start HTTP server")
		}
		defer server.Stop()
	},
}
View Source
var IPInfoCmd = &cobra.Command{
	Use:     "ip-info",
	Aliases: []string{"ip"},
	Short:   "Display local network interface and public IP information",
	Long: `Shows details about local network interfaces, including IPv4 addresses,
subnet masks, and MAC addresses. It also fetches and displays public IP
information, including geolocation data from ipinfo.io.

Examples:
  # Display local IPv4 and public IP information
  anbu ip-info

  # Include local IPv6 addresses in the output
  anbu ip-info -6`,
	Run: func(cmd *cobra.Command, args []string) {
		ipv6, _ := cmd.Flags().GetBool("ipv6")
		anbuNetwork.GetLocalIPInfo(ipv6)
	},
}
View Source
var TunnelCmd = &cobra.Command{
	Use:     "tunnel",
	Aliases: []string{},
	Short:   "Create TCP or SSH tunnels between local and remote endpoints",
	Long: `Provides tools for network tunneling.

Subcommands:
  tcp:   Create a simple TCP tunnel. Forwards traffic from a local port to a remote address.
  ssh:   Create an SSH forward tunnel. Forwards a local port to a remote address through an SSH server.
  rssh:  Create an SSH reverse tunnel. Forwards a remote port on an SSH server back to a local address.

Examples:
  # Forward local port 8080 to example.com:80
  anbu tunnel tcp -l localhost:8080 -r example.com:80

  # Forward local port 3306 to a database through an SSH jump host
  anbu tunnel ssh -l localhost:3306 -r db.internal:3306 -s jump.host:22 -u user -k ~/.ssh/id_rsa

  # Expose a local service (e.g., RDP on 3389) on a remote server's port 8001
  anbu tunnel rssh -l localhost:3389 -r 0.0.0.0:8001 -s remote.server:22 -u user -p "password"`,
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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