misc

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: MIT Imports: 4 Imported by: 1

README

Miscelaneous Examples

Create a cyclic pattern of n length (De Bruijn)

package main

import (
  "fmt"

  "github.com/D3Ext/maldev/misc"
)

func main(){
  pattern := misc.GeneratePattern(1000)
  fmt.Println(pattern)

  // Get offset from some 4bits substring of pattern
  offset := misc.GetOffset("Jeek")
}

Epoch date

package main

import (
  "fmt"

  "github.com/D3Ext/maldev/misc"
)

func main(){
  // Convert date to epoch format
  epoch := misc.DateToEpoch(2023, 1, 8, 11, 23, 0) // DateToEpoch(year, month, day, hour, minute, second int)
  fmt.Println(epoch) // Output: 1673176980

  // Convert epoch to date
  date := misc.EpochToDate(epoch)
  fmt.Println(date) // Output: 2023-1-8 11:23:0
}

Convert text to Leet

package main

import (
  "fmt"

  "github.com/D3Ext/maldev/misc"
)

func main(){
  leet := misc.TextToLeet("This is a test")
  fmt.Println(leet) // Output: 7#¡$ ¡$ @ 73$7
}

Generate random string of n length

package main

import (
  "fmt"

  "github.com/D3Ext/maldev/misc"
)

func main(){
  rand_str := misc.RandomString(10)
  fmt.Println(rand_str)
}

Generate random int of n length

package main

import (
  "fmt"

  "github.com/D3Ext/maldev/misc"
)

func main(){
  rand_int := misc.RandomInt(10)
  fmt.Println(rand_int) // 3894276149
}

Get a random user-agent

  • This function takes a random user-agent between 10 most used ones
package main

import (
  "fmt"

  "github.com/D3Ext/maldev/misc"
)

func main(){
  user_agent := misc.GetRandomAgent()
  fmt.Println(user_agent) // Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToGb added in v0.1.3

func BytesToGb(num int) int

func DateToEpoch

func DateToEpoch(year, month, day, hour, minute, second int) int

func EpochToDate

func EpochToDate(epoch int) string

func GbToBytes added in v0.1.3

func GbToBytes(num int) int

func GeneratePattern

func GeneratePattern(length int) string

func GetPatternOffset

func GetPatternOffset(pattern_str string) int

func GetRandomAgent

func GetRandomAgent() string

func RandomInt

func RandomInt(max int, min int) int

func RandomString

func RandomString(length int) string

func TextToLeet

func TextToLeet(input string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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