Update procsnitch dependency

socks-filter
Bruce Leidl 9 years ago
parent 9eeeb59957
commit 79741be8a1

4
Godeps/Godeps.json generated

@ -48,11 +48,11 @@
},
{
"ImportPath": "github.com/subgraph/go-procsnitch",
"Rev": "84754d9af0ff985a28b3e6be743c7d453fda7322"
"Rev": "9ed73dde9f6f84be72aa010394902057ac26b625"
},
{
"ImportPath": "golang.org/x/net/proxy",
"Rev": "2e9cee70ee697e0a2ef894b560dda50dec7dff58"
"Rev": "ef2e00e88c5e0a3569f0bb9df697e9cbc6215fea"
}
]
}

@ -163,7 +163,7 @@ func resolveProcinfo(conns []*connectionInfo) {
}
ss := new(socketStatus)
if err := ss.parseLine(line); err != nil {
log.Warning("Unable to parse line [%s]: %v", line, err)
log.Warningf("Unable to parse line [%s]: %v", line, err)
} /* else {
/*
pid := findPidForInode(ss.inode)

@ -77,7 +77,7 @@ func inodesFromPid(pid int) []uint64 {
for _, n := range readdir(fdpath) {
if link, err := os.Readlink(path.Join(fdpath, n)); err != nil {
if !os.IsNotExist(err) {
log.Warning("Error reading link %s: %v", n, err)
log.Warningf("Error reading link %s: %v", n, err)
}
} else {
if inode := extractSocket(link); inode > 0 {
@ -95,7 +95,7 @@ func extractSocket(name string) uint64 {
val := name[8 : len(name)-1]
inode, err := strconv.ParseUint(val, 10, 64)
if err != nil {
log.Warning("Error parsing inode value from %s: %v", name, err)
log.Warningf("Error parsing inode value from %s: %v", name, err)
return 0
}
return inode
@ -104,13 +104,13 @@ func extractSocket(name string) uint64 {
func readdir(dir string) []string {
d, err := os.Open(dir)
if err != nil {
log.Warning("Error opening directory %s: %v", dir, err)
log.Warningf("Error opening directory %s: %v", dir, err)
return nil
}
defer d.Close()
names, err := d.Readdirnames(0)
if err != nil {
log.Warning("Error reading directory names from %s: %v", dir, err)
log.Warningf("Error reading directory names from %s: %v", dir, err)
return nil
}
return names
@ -123,12 +123,12 @@ func (pi *Info) loadProcessInfo() bool {
exePath, err := os.Readlink(fmt.Sprintf("/proc/%d/exe", pi.Pid))
if err != nil {
log.Warning("Error reading exe link for pid %d: %v", pi.Pid, err)
log.Warningf("Error reading exe link for pid %d: %v", pi.Pid, err)
return false
}
bs, err := ioutil.ReadFile(fmt.Sprintf("/proc/%d/cmdline", pi.Pid))
if err != nil {
log.Warning("Error reading cmdline for pid %d: %v", pi.Pid, err)
log.Warningf("Error reading cmdline for pid %d: %v", pi.Pid, err)
return false
}
for i, b := range bs {
@ -139,18 +139,18 @@ func (pi *Info) loadProcessInfo() bool {
bs, err = ioutil.ReadFile(fmt.Sprintf("/proc/%d/stat", pi.Pid))
if err != nil {
log.Warning("Error reading cmdline for pid %d: %v", pi.Pid, err)
log.Warningf("Error reading cmdline for pid %d: %v", pi.Pid, err)
return false
}
fs := strings.Fields(string(bs))
if len(fs) < 50 {
log.Warning("Unable to parse stat for pid %d: ", pi.Pid)
log.Warningf("Unable to parse stat for pid %d: ", pi.Pid)
return false
}
finfo, err := os.Stat(fmt.Sprintf("/proc/%d", pi.Pid))
if err != nil {
log.Warning("Could not stat /proc/%d: %v", pi.Pid, err)
log.Warningf("Could not stat /proc/%d: %v", pi.Pid, err)
return false
}
sys := finfo.Sys().(*syscall.Stat_t)

@ -106,7 +106,7 @@ func findUNIXSocket(socketFile string) *socketStatus {
}
ss := socketStatus{}
if err := ss.parseUnixProcLine(line); err != nil {
log.Warning("Unable to parse line from /proc/net/%s [%s]: %v", proto, line, err)
log.Warningf("Unable to parse line from /proc/net/%s [%s]: %v", proto, line, err)
continue
}
if ss.remoteInode != 0 {
@ -134,7 +134,7 @@ func findSocket(proto string, matcher func(socketStatus) bool) *socketStatus {
continue
}
if err := ss.parseLine(line); err != nil {
log.Warning("Unable to parse line from /proc/net/%s [%s]: %v", proto, line, err)
log.Warningf("Unable to parse line from /proc/net/%s [%s]: %v", proto, line, err)
continue
}
if matcher(ss) {
@ -203,7 +203,7 @@ func getSocketLines(proto string) []string {
path := fmt.Sprintf("/proc/net/%s", proto)
data, err := ioutil.ReadFile(path)
if err != nil {
log.Warning("Error reading %s: %v", path, err)
log.Warningf("Error reading %s: %v", path, err)
return nil
}
lines := strings.Split(string(data), "\n")

Loading…
Cancel
Save