random- collection of un-sorted bollocks |
git clone git://git.acid.vegas/random.git |
Log | Files | Refs | Archive |
diskfuck.go (1401B)
1 // DESTROY YOUR LOCAL VPS PROVIDERS NVMe's 2 package main 3 4 import ( 5 "log" 6 "os" 7 "math/rand" 8 ) 9 10 const ( 11 fileName = "fuckfile.dat" 12 fileSize = 1 << 30 // 1 GB 13 ) 14 15 var gutmannPatterns = []byte{ 16 0x55, 0xAA, 0x92, 0x49, 0x24, 0x00, 0xFF, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 17 0x92, 0x49, 0x24, 0x55, 0xAA, 0x00, 0xFF, 0x44, 0x55, 0xAA, 0x92, 0x49, 0x24, 0x00, 0xFF, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 18 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x92, 0x49, 0x24, 0x55, 0xAA, 0x92, 0x49, 0x24, 0x00, 0xFF, 19 } 20 21 func createFile() *os.File { 22 f, err := os.Create(fileName) 23 if err != nil { 24 log.Fatalf("Error creating file: %v", err) 25 } 26 return f 27 } 28 29 func writeFile(f *os.File, data []byte) { 30 _, err := f.Write(data) 31 if err != nil { 32 log.Fatalf("Error writing to file: %v", err) 33 } 34 } 35 36 func main() { 37 for { 38 f := createFile() 39 40 for i := 0; i < 35; i++ { 41 if i < len(gutmannPatterns) { 42 data := make([]byte, fileSize, fileSize) 43 for j := range data { 44 data[j] = gutmannPatterns[i] 45 } 46 writeFile(f, data) 47 } else { 48 data := make([]byte, fileSize, fileSize) 49 for j := range data { 50 data[j] = byte(rand.Intn(256)) 51 } 52 writeFile(f, data) 53 } 54 f.Seek(0, 0) // Reset file pointer to start 55 } 56 57 f.Close() 58 59 err := os.Remove(fileName) 60 if err != nil { 61 log.Fatalf("Error deleting file: %v", err) 62 } 63 } 64 }