forked from Velocidex/velociraptor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
309 additions
and
47 deletions.
There are no files selected for viewing
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Linux.Applications.Docker.Info | ||
description: Get Dockers info by connecting to its socket. | ||
parameters: | ||
- name: dockerSocket | ||
description: | | ||
Docker server socket. You will normally need to be root to connect. | ||
default: /var/run/docker.sock | ||
sources: | ||
- precondition: | | ||
SELECT OS From info() where OS = 'linux' | ||
queries: | ||
- LET data = SELECT parse_json(data=Content) as JSON | ||
FROM http_client(url=dockerSocket + ":unix/info") | ||
- SELECT JSON.ID as ID, | ||
JSON.Containers as Containers, | ||
JSON.ContainersRunning as ContainersRunning, | ||
JSON.ContainersPaused as ContainersPaused, | ||
JSON.ContainersStopped as ContainersStopped, | ||
JSON.Images as Images, | ||
JSON.Driver as Driver, | ||
JSON.MemoryLimit as MemoryLimit, | ||
JSON.SwapLimit as SwapLimit, | ||
JSON.KernelMemory as KernelMemory, | ||
JSON.CpuCfsPeriod as CpuCfsPeriod, | ||
JSON.CpuCfsQuota as CpuCfsQuota, | ||
JSON.CPUShares as CPUShares, | ||
JSON.CPUSet as CPUSet, | ||
JSON.IPv4Forwarding as IPv4Forwarding, | ||
JSON.BridgeNfIptables as BridgeNfIptables, | ||
JSON.BridgeNfIp6tables as BridgeNfIp6tables, | ||
JSON.OomKillDisable as OomKillDisable, | ||
JSON.LoggingDriver as LoggingDriver, | ||
JSON.CgroupDriver as CgroupDriver, | ||
JSON.KernelVersion as KernelVersion, | ||
JSON.OperatingSystem as OperatingSystem, | ||
JSON.OSType as OSType, | ||
JSON.Architecture as Architecture, | ||
JSON.NCPU as NCPU, | ||
JSON.MemTotal as MemTotal, | ||
JSON.HttpProxy as HttpProxy, | ||
JSON.HttpsProxy as HttpsProxy, | ||
JSON.NoProxy as NoProxy, | ||
JSON.Name as Name, | ||
JSON.ServerVersion as ServerVersion, | ||
JSON.DockerRootDir as DockerRootDir | ||
FROM data |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Linux.Applications.Docker.Version | ||
description: Get Dockers version by connecting to its socket. | ||
parameters: | ||
- name: dockerSocket | ||
description: | | ||
Docker server socket. You will normally need to be root to connect. | ||
default: /var/run/docker.sock | ||
sources: | ||
- precondition: | | ||
SELECT OS From info() where OS = 'linux' | ||
queries: | ||
- LET data = SELECT parse_json(data=Content) as JSON | ||
FROM http_client(url=dockerSocket + ":unix/version") | ||
- SELECT JSON.Version as Version, | ||
JSON.ApiVersion as ApiVersion, | ||
JSON.MinAPIVersion as MinAPIVersion, | ||
JSON.GitCommit as GitCommit, | ||
JSON.GoVersion as GoVersion, | ||
JSON.Os as Os, | ||
JSON.Arch as Arch, | ||
JSON.KernelVersion as KernelVersion, | ||
JSON.BuildTime as BuildTime | ||
FROM data |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Linux.Sys.CPUTime | ||
description: | | ||
Displays information from /proc/stat file about the time the cpu | ||
cores spent in different parts of the system. | ||
parameters: | ||
- name: procStat | ||
default: /proc/stat | ||
sources: | ||
- precondition: | | ||
SELECT OS From info() where OS = 'linux' | ||
queries: | ||
- LET raw = SELECT * FROM split_records( | ||
filenames=procStat, | ||
regex=' +', | ||
columns=['core', 'user', 'nice', 'system', | ||
'idle', 'iowait', 'irq', 'softirq', | ||
'steal', 'guest', 'guest_nice']) | ||
WHERE core =~ 'cpu.+' | ||
- SELECT core AS Core, | ||
atoi(string=user) as User, | ||
atoi(string=nice) as Nice, | ||
atoi(string=system) as System, | ||
atoi(string=idle) as Idle, | ||
atoi(string=iowait) as IOWait, | ||
atoi(string=irq) as IRQ, | ||
atoi(string=softirq) as SoftIRQ, | ||
atoi(string=steal) as Steal, | ||
atoi(string=guest) as Guest, | ||
atoi(string=guest_nice) as GuestNice FROM raw |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Linux.Sys.Crontab | ||
description: | | ||
Displays parsed information from crontab. | ||
parameters: | ||
- name: cronTabGlob | ||
default: /etc/crontab,/etc/cron.d/**,/var/at/tabs/**,/var/spool/cron/**,/var/spool/cron/crontabs/** | ||
sources: | ||
- precondition: | | ||
SELECT OS From info() where OS = 'linux' | ||
queries: | ||
- | | ||
LET raw = SELECT * FROM foreach( | ||
row={ | ||
SELECT FullPath from glob(globs=split(string=cronTabGlob, sep=",")) | ||
}, | ||
query={ | ||
SELECT FullPath, data, parse_string_with_regex( | ||
string=data, | ||
regex=[ | ||
/* Regex for event (Starts with @) */ | ||
"^(?P<Event>@[a-zA-Z]+)\\s+(?P<Command>.+)", | ||
/* Regex for regular command. */ | ||
"^(?P<Minute>[^\\s]+)\\s+"+ | ||
"(?P<Hour>[^\\s]+)\\s+"+ | ||
"(?P<DayOfMonth>[^\\s]+)\\s+"+ | ||
"(?P<Month>[^\\s]+)\\s+"+ | ||
"(?P<DayOfWeek>[^\\s]+)\\s+"+ | ||
"(?P<Command>.+)$"]) as Record | ||
/* Read lines from the file and filter ones that start with "#" */ | ||
FROM split_records( | ||
filenames=FullPath, | ||
regex="\n", columns=["data"]) WHERE not data =~ "^\\s*#" | ||
}) WHERE Record.Command | ||
- | | ||
SELECT Record.Event AS Event, | ||
Record.Minute AS Minute, | ||
Record.Hour AS Hour, | ||
Record.DayOfMonth AS DayOfMonth, | ||
Record.Month AS Month, | ||
Record.DayOfWeek AS DayOfWeek, | ||
Record.Command AS Command, | ||
FullPath AS Path | ||
FROM raw |
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
This file was deleted.
Oops, something went wrong.
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package functions | ||
|
||
import ( | ||
"context" | ||
"strconv" | ||
vql_subsystem "www.velocidex.com/golang/velociraptor/vql" | ||
vfilter "www.velocidex.com/golang/vfilter" | ||
) | ||
|
||
type _ToIntArgs struct { | ||
String string `vfilter:"required,field=string"` | ||
} | ||
|
||
type _ToInt struct{} | ||
|
||
func (self _ToInt) Call( | ||
ctx context.Context, | ||
scope *vfilter.Scope, | ||
args *vfilter.Dict) vfilter.Any { | ||
arg := &_ToIntArgs{} | ||
err := vfilter.ExtractArgs(scope, args, arg) | ||
if err != nil { | ||
scope.Log("%s: %s", self.Name(), err.Error()) | ||
return vfilter.Null{} | ||
} | ||
|
||
result, _ := strconv.Atoi(arg.String) | ||
return result | ||
} | ||
|
||
func (self _ToInt) Name() string { | ||
return "atoi" | ||
} | ||
|
||
func init() { | ||
vql_subsystem.RegisterFunction(&_ToInt{}) | ||
} |
Oops, something went wrong.