Created
July 17, 2022 10:40
Revisions
-
quant61 created this gist
Jul 17, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ package main import ( "fmt" "io/ioutil" "os" "strings" ) // TODO: write it in asm func main() { d, _ := os.Open("/proc") pp, _ := d.Readdirnames(9000) for _, p := range pp { b, _ := ioutil.ReadFile(fmt.Sprintf("/proc/%s/maps", p)) ll := strings.Split(string(b), "\n") for _, l := range ll { if strings.Contains(l, "/dev/shm") { fmt.Println(p, l) } } dfd, _ := os.Open(fmt.Sprintf("/proc/%s/fd", p)) fdd, _ := dfd.Readdirnames(9000) dfd.Close() for _, fd := range fdd { lnk, _ := os.Readlink(fmt.Sprintf("/proc/%s/fd/%s", p, fd)) if strings.HasPrefix(lnk, "/dev/shm") { fmt.Println(p, fd, lnk) } } } }