-
Notifications
You must be signed in to change notification settings - Fork 33
/
Search-GreyNoise.ps1
75 lines (63 loc) · 3.13 KB
/
Search-GreyNoise.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<#
.SYNOPSIS
Gather Open-Source Intelligence using PowerShell.
.DESCRIPTION
Gather Open-Source Intelligence from GreyNoise using PowerShell.
.EXAMPLE
Search-GreyNoise -Endpoint list | Format-List
status : ok
tags : {VNC_SCANNER_HIGH, PING_SCANNER_LOW, BINGBOT, IIS_WEBDAV_REMOTE_CODE_EXECUTION_CVE_2017_7269...}
.EXAMPLE
Search-GreyNoise -Endpoint tag -Query ADB_WORM | Format-List
tag : ADB_WORM
status : ok
returned_count : 500
records : {@{ip=185.25.196.139; name=ADB_WORM; first_seen=3/22/19 8:55:39 PM; last_updated=3/22/19 8:55:39 PM; confidence=high; intention=malicious; category=worm; metadata=}, @{ip=188.59.135.65;
name=ADB_WORM; first_seen=3/22/19 7:45:27 PM; last_updated=3/22/19 7:45:27 PM; confidence=high; intention=malicious; category=worm; metadata=}, @{ip=203.91.113.41; name=ADB_WORM;
first_seen=3/22/19 11:28:16 AM; last_updated=3/22/19 8:56:34 PM; confidence=high; intention=malicious; category=worm; metadata=}, @{ip=125.59.141.46; name=ADB_WORM; first_seen=3/22/19
9:02:25 AM; last_updated=3/22/19 9:02:25 AM; confidence=high; intention=malicious; category=worm; metadata=}...}
.EXAMPLE
Search-GreyNoise -Endpoint ip -Query 123.193.145.85 | Format-List
ip : 123.193.145.85
status : ok
returned_count : 55
records : {@{name=ADB_WORM; first_seen=3/21/19 7:24:20 PM; last_updated=3/21/19 7:24:20 PM; confidence=high; intention=malicious; category=worm; metadata=}, @{name=MIRAI; first_seen=3/14/19
10:52:10 AM; last_updated=3/14/19 10:52:10 AM; confidence=high; intention=malicious; category=worm; metadata=}, @{name=MIRAI; first_seen=3/11/19 1:20:56 AM; last_updated=3/11/19 1:20:56
AM; confidence=high; intention=malicious; category=worm; metadata=}, @{name=MIRAI; first_seen=3/11/19 1:20:56 AM; last_updated=3/14/19 10:52:10 AM; confidence=high; intention=malicious;
category=worm; metadata=}...}
.LINK
https://github.com/ecstatic-nobel/pOSINT/
#>
function Search-GreyNoise {
[CmdletBinding()]
param(
[Parameter(Mandatory=$false)]
[string]$Key,
[Parameter(Mandatory=$true)]
[ValidateSet("list", "ip", "tag")]
[string]$EndPoint,
[Parameter(Mandatory=$false)]
[ValidateScript({
if ($EndPoint -ne "list") {
$true
} else {
Throw "Value Mismatch Detected: list (Query not needed)."
}
})]
[string]$Query
)
Begin {
Set-SslDefaults
Set-ModuleDefaults
$Uri = "https://api.greynoise.io/v1/query/$EndPoint".ToLower()
if ($EndPoint -ne "list") {
$Query = $Query.ToUpper()
$Body = "@{$EndPoint='$Query';key='$Key'}"
$Method = "POST"
$Uri = "https://api.greynoise.io/v1/query/$EndPoint".ToLower()
$ExtraRequestParams = "-Body $Body"
}
}
Process {Search-Api}
End {Reset-SslDefaults; Write-Verbose "Complete"}
}