files

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2024 License: MIT Imports: 10 Imported by: 0

README

File Examples

Get file content

package main

import (
  "fmt"
  "log"

  "github.com/D3Ext/maldev/src/files"
)

func main(){
  content, err := files.GetFileContent("/path/to/file.txt")
  if err != nil {
    log.Fatal(err)
  }

  fmt.Println(content)
}

Check if file exists

package main

import (
  "fmt"

  "github.com/D3Ext/maldev/src/file"
)

func main(){
  check := files.Exists("/path/to/file")
  fmt.Println(check) // true or false
}

Check if path is a file

package main

import (
  "fmt"

  "github.com/D3Ext/maldev/src/files"
)

func main(){
  check := files.IsFile("/path/to/file")
  fmt.Println(check)
}

Check if path is a directory

package main

import (
  "fmt"

  "github.com/D3Ext/maldev/src/files"
)

func main(){
  check := files.IsDir("/path/to/dir")
  fmt.Println(check)
}

Copy a file or dir recursively

package main

import (
  "log"

  "github.com/D3Ext/maldev/src/files"
)

func main(){
  err := files.Copy("/path/to/file.txt", "/path/to/destination")
  if err != nil {
    log.Fatal(err)
  }
}

Move a file or dir

package main

import (
  "log"

  "github.com/D3Ext/maldev/src/files"
)

func main(){
  err := files.Move("/path/to/file.txt", "/path/to/destination/file.txt")
  if err != nil {
    log.Fatal(err)
  }
}

Wipe a file or directory (antiforensics)

package main

import (
  "log"

  "github.com/D3Ext/maldev/src/files"
)

func main(){
  err = files.Wipe("file.txt")
  if err != nil {
    log.Fatal(err)
  }
}

Timestomping

package main

import (
  "log"

  "github.com/D3Ext/maldev/src/files"
)

func main(){
  err := files.Timestomp("file.txt", 5) // func Timestomp(filename string, count int) (error)
  if err != nil {
    log.Fatal(err)
  }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(src string, dst string) error

func Exists

func Exists(src string) bool

func GetContent

func GetContent(src string) (string, error)

func IsDir

func IsDir(src string) (bool, error)

func IsFile

func IsFile(src string) (bool, error)

func Move

func Move(src string, dst string) error

func Timestomp

func Timestomp(src string, count int) error

func Wipe

func Wipe(src string) error

func WriteContent

func WriteContent(filename string, text string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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