-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUse-Onyphe.psm1
6163 lines (5570 loc) · 245 KB
/
Use-Onyphe.psm1
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#
# Created by: lucas.cueff[at]lucas-cueff.com
#
# v0.92 :
# - manage new search APIs
# - code refactoring
# - fix file export for new categories and properties
# - manage proxy connection
# - manage API key storage with encryption in a config file
# - add paging feature on search and info functions
# - add tag filter
# v0.93 :
# - add local stat function
# v0.94 :
# - manage new apis (ctl, sniffer, onionscan, md5)
# - use userinfos API to collect APIs and search filters
# - rewrite get-onyphe info function to simplify the code
# - update invoke-apionyphedatascan with only a single parameter
# v0.95 :
# - fix HTTP error on invoke-onyphe when no network is available
# - add datashot management
# - add function to export datashot to picture file
# - fix Get-OnypheInfoFromCSV
# - update Export-OnypheInfoToFile
# v0.96 :
# - add new filtering function for search request
# - add Get-OnypheSearchFunctions function
# - update Invoke-APIOnypheSearch and Search-OnypheInfo functions
# - replace SimpleSearchfilter parameter with SimpleSearchfilter
# - replace SimpleSearchValue parameter with SearchValue
# - add FunctionFilter and FunctionValue parameters
# - update Get-OnypheInfoFromCSV to manage new filter function in search request
# - add new alias Get-OnypheInfoFromCSV
# v0.97 :
# - code improvement
# - add beta switch to use beta interface of onyphe instead of production one
# - improve paging parameters
# - add advancedfilter option to Search-onyphe to manage multiple filter functions input
# - add onionshot category to datashot export function
# v0.98 :
# - update paging regex to support more than 1000 pages
# v0.99 :
# - replace $env:appdata with $home for Linux and Powershell Core compatibility
# - create new function to request APIv2 (Invoke-OnypheAPIV2) and managing api key as new header etc...
# - rename previous function to request APIv1 (Invoke-OnypheAPIV1) and fix Net.WebException management for Powershell core
# - create new functions to deal with Onyphe Alert APIs (Invoke-APIOnypheListAlert, Invoke-APIOnypheDelAlert, Invoke-APIOnypheAddAlert)
# - create new functions for managing the Onyphe Alert (Get-OnypheAlertInfo, Set-OnypheAlertInfo)
# v1.0 :
# - fix rate limiting issue on paging
# - manage new API in Export-OnypheInfoToFile
# v1.1 :
# - add new APIv2, migrate from APIv1 to full APIv2
# - remove temporary fix for empty array in APIv2
# - update deserialization of psobject
# v1.2 : Last public release
# - add bulk API
# - update code to optimize file export (decrease memory to write file directly)
# - update object type to PSOnyphe
# - update inputobject parameter to InputOnypheObject
# - fix various bug found
#
# released on 11/2021
# v1.3 : Last public release
# - add whois simple API
# - update bulk APIs
# - add simple best APIs
# - minor improvement
# - new aliases : Export-OnypheBulkSimple, Export-OnypheBulkSummary
# - new functions : Export-OnypheBulkInfo, Export-OnypheBulkSummaryInfo
# - updated functions : Get-OnypheInfo
#
#'(c) 2018-2021 lucas-cueff.com - Distributed under Artistic Licence 2.0 (https://opensource.org/licenses/artistic-license-2.0).'
# dev : comment on fonction missing
<#
.SYNOPSIS
commandline interface to use onyphe.io web service
.DESCRIPTION
use-onyphe.psm1 module provides a commandline interface to onyphe.io web service.
.EXAMPLE
C:\PS> import-module use-onyphe.psm1
#>
Function Get-OnypheStatsFromObject {
<#
.SYNOPSIS
Get Some stats (count, total, min, max, average) for one or multiple properties of a onyphe result powershell object
.DESCRIPTION
Get Some stats (count, total, min, max, average) for one or multiple properties of a onyphe result powershell object
.PARAMETER InputOnypheObject
-InputOnypheObject PSCustomObject{Onyphe result PSCustomObject}
Onyphe object used for the stat
.PARAMETER AdvancedFacets
-AdvancedFacets ARRAY{list of onyphe objects' properties}
Onyphe result object's property requested for the stat (results = on object per property requested)
.PARAMETER Facets
-Facets string{onyphe objects' property}
Onyphe result object's property requested for the stat
.OUTPUTS
TypeName: PSOnyphe
.EXAMPLE
Search SynScan info and request stats for 'ip','port','tag' and 'organization' properties
C:\PS> Search-OnypheInfo -AdvancedSearch @('country:FR','port:23','os:Linux') -SearchType synscan | Get-OnypheStatsFromObject -AdvancedFacets @('ip','port','tag','organization')
.EXAMPLE
Search SynScan info and request stats for 'ip' property
C:\PS> $onypheobj = Search-OnypheInfo -AdvancedSearch @('country:FR','port:23','os:Linux') -SearchType synscan
C:\PS> Get-OnypheStatsFromObject -Facets 'ip' -InputOnypheObject $onypheobj
#>
[cmdletbinding()]
Param (
[parameter(ValueFromPipelineByPropertyName=$true,ValueFromPipeline=$true,Mandatory=$true)]
[ValidateScript({$_ -is [System.Management.Automation.PSCustomObject]})]
[array]$InputOnypheObject,
[parameter(Mandatory=$false)]
[ValidateNotNullOrEmpty()]
[Array]$AdvancedFacets
)
DynamicParam
{
$ParameterNameFilter = 'Facets'
$RuntimeParameterDictionary = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary
$AttributeCollection2 = New-Object System.Collections.ObjectModel.Collection[System.Attribute]
$ParameterAttribute2 = New-Object System.Management.Automation.ParameterAttribute
$ParameterAttribute2.ValueFromPipeline = $false
$ParameterAttribute2.ValueFromPipelineByPropertyName = $false
$ParameterAttribute2.Mandatory = $false
$AttributeCollection2.Add($ParameterAttribute2)
$arrSet = Get-OnypheCliFacets
$ValidateSetAttribute2 = New-Object System.Management.Automation.ValidateSetAttribute($arrSet)
$AttributeCollection2.Add($ValidateSetAttribute2)
$RuntimeParameter2 = New-Object System.Management.Automation.RuntimeDefinedParameter($ParameterNameFilter, [string], $AttributeCollection2)
$RuntimeParameterDictionary.Add($ParameterNameFilter, $RuntimeParameter2)
return $RuntimeParameterDictionary
}
Process {
$Facets = $PsBoundParameters[$ParameterNameFilter]
if (!$Facets -and !$AdvancedFacets) {
Write-Verbose -Message "both AdvancedFacets and Facets options are empty, please use at least one of this parameter to set the facets to be used for the stats"
throw "Please provide a valid facets option"
}
$script:results = @()
$script:TemplateFacetObject = new-object psobject -Property @{
'Onyphe-Facet' = $null
'Onyphe-Property-value' = $null
'Onyphe-Property-Count' = $null
}
If ($AdvancedFacets) {
foreach ($facet in $AdvancedFacets) {
$tmp = $InputOnypheObject.results."$($Facet)" | sort-object | get-unique
$script:AllFacetObjects = @()
foreach ($object in $tmp) {
$tmpobj = $script:TemplateFacetObject | Select-Object *
$tmpobj.'Onyphe-Property-value' = $object
if (($InputOnypheObject.results | Where-Object {$_."$($Facet)" -eq "$($object)"}).count) {
$tmpobj.'Onyphe-Property-Count' = ($InputOnypheObject.results | Where-Object {$_."$($Facet)" -eq "$($object)"}).count
} Else {
$tmpobj.'Onyphe-Property-Count' = 1
}
$tmpobj.'Onyphe-Facet' = $facet
$script:AllFacetObjects += $tmpobj
}
$tmpmeasureobj = $script:AllFacetObjects.'Onyphe-Property-Count' | measure-object -Sum -Maximum -Minimum -Average
$script:results += New-Object psobject -Property @{
Stats = $script:AllFacetObjects
Count = $tmpmeasureobj.Count
Sum = $tmpmeasureobj.Sum
Min = $tmpmeasureobj.Minimum
Max = $tmpmeasureobj.Maximum
Average = $tmpmeasureobj.Average
}
}
} Else {
$script:AllFacetObjects = @()
$tmp = $InputOnypheObject.results."$($Facets)" | sort-object | get-unique
foreach ($object in $tmp) {
$tmpobj = $script:TemplateFacetObject | Select-Object *
$tmpobj.'Onyphe-Property-value' = $object
if (($InputOnypheObject.results | Where-Object {$_."$($Facets)" -eq "$($object)"}).count) {
$tmpobj.'Onyphe-Property-Count' = ($InputOnypheObject.results | Where-Object {$_."$($Facets)" -eq "$($object)"}).count
} Else {
$tmpobj.'Onyphe-Property-Count' = 1
}
$tmpobj.'Onyphe-Facet' = $Facets
$script:AllFacetObjects += $tmpobj
}
$tmpmeasureobj = $script:AllFacetObjects.'Onyphe-Property-Count' | measure-object -Sum -Maximum -Minimum -Average
$script:results = New-Object psobject -Property @{
Stats = $script:AllFacetObjects
Count = $tmpmeasureobj.Count
Sum = $tmpmeasureobj.Sum
Min = $tmpmeasureobj.Minimum
Max = $tmpmeasureobj.Maximum
Average = $tmpmeasureobj.Average
}
}
$results
}
}
Function Get-OnypheInfoFromCSV {
<#
.SYNOPSIS
Get IP information from onyphe.io web service using as an input a CSV file containing all information
.DESCRIPTION
get various ip data information from onyphe.io web service using as an input a csv file (; separator)
.PARAMETER fromcsv
-fromcsv string{full path to csv file}
automate onyphe.io request for multiple IP request
.PARAMETER APIKey
-APIKey string{APIKEY}
set your APIKEY to be able to use Onyphe API.
.PARAMETER csvdelimiter
-csvdelimiter string{csv separator}
set your csv separator. default is ;
.OUTPUTS
TypeName: System.Management.Automation.PSCustomObject
.EXAMPLE
Request info for several IP information from a csv formated file and your API key is already set as global variable
C:\PS> Get-onypheinfofromcsv -fromcsv .\input.csv
.EXAMPLE
Request info for several IP information from a csv formated file and set the API key as global variable
C:\PS> Get-onypheinfofromcsv -fromcsv .\input.csv -apikey "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
.EXAMPLE
Request info for several IP information from a csv formated file using ',' separator and set the API key as global variable
C:\PS> Get-onypheinfofromcsv -fromcsv .\input.csv -apikey "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -csvdelimiter ","
#>
[cmdletbinding()]
Param (
[parameter(Mandatory=$true)]
[ValidateScript({test-path "$($_)"})]
$fromcsv,
[parameter(Mandatory=$false)]
[ValidateLength(40,40)]
[string]$APIKey,
[parameter(Mandatory=$false)]
$csvdelimiter
)
process {
$Script:Result = @()
if ($APIKey) {
Set-OnypheAPIKey -APIKEY $APIKey | out-null
}
if (!$csvdelimiter) {$csvdelimiter = ";"}
if (($fromcsv -is [System.String]) -and (test-path $fromcsv)) {
$csvcontent = import-csv $fromcsv -delimiter $csvdelimiter
} ElseIf (($fromcsv -is [System.Management.Automation.PSCustomObject]) -and $fromcsv.'API-Input') {
$csvcontent = $fromcsv
} Else {
write-verbose -message "provide a valid csv file as input or valid System.Management.Automation.PSCustomObject object"
write-verbose -message "please use the following column in your file : ip, searchtype, datascanstring"
throw "please provide a valid csv file as input or valid System.Management.Automation.PSCustomObject object"
}
$APISearchEntries = $csvcontent | where-object {$_.API -eq "Search"}
foreach ($entry in $APISearchEntries) {
$params = @{
SearchType = $entry.'search-category'
Wait = 3
}
if ($entry.'Search-Request'.contains("+")) {
$tmparray = $entry.'Search-Request'.split("+")
$params.add('AdvancedSearch',$tmparray)
} else {
$params.add('AdvancedSearch',@($entry.'Search-Request'))
}
if ($entry.'Filter-Request') {
if ($entry.'Filter-Request'.contains("+")) {
$tmparray = $entry.'Filter-Request'.split("+")
$params.add('AdvancedFilter',$tmparray)
} else {
$params.add('AdvancedFilter', $entry.'Filter-Request')
}
}
if ($entry.'Page') {
$params.add('Page', $entry.'Page')
}
$Script:Result += Search-OnypheInfo @params
}
$SummaryEntries = $csvcontent | where-object {($_.API -eq "IP") -or ($_.API -eq "Domain") -or ($_.API -eq "HostName")}
foreach ($entry in $SummaryEntries) {
$Script:Result += Get-OnypheSummary -SummaryAPIType $entry.API -SearchValue $entry.'API-Input' -wait 3
}
$SimpleEntries = $csvcontent | where-object {($_.API -ne "IP") -and ($_.API -ne "Domain") -and ($_.API -ne "HostName") -and ($_.API -ne "Search")}
foreach ($entry in $SimpleEntries) {
if ($entry.Best -eq "True") {
$Script:Result += Get-OnypheInfo -Category $entry.API -SearchValue $entry.'API-Input' -best -wait 3
} else {
$Script:Result += Get-OnypheInfo -Category $entry.API -SearchValue $entry.'API-Input' -wait 3
}
}
$Script:Result
}
}
Function Export-OnypheInfo {
<#
.SYNOPSIS
main function/cmdlet - Export Search information on onyphe.io web service using search export API
.DESCRIPTION
main function/cmdlet - Export Search information on onyphe.io web service using search export API
send HTTP request to onyphe.io web service and convert back JSON information to a powershell custom object
.PARAMETER InputOnypheObject
-InputOnypheObject PSOnyphe object
used a PSOnyphe object generated with Search-Onyphe as input
.PARAMETER AdvancedSearch
-AdvancedSearch ARRAY{filter:value,filter:value}
Search with multiple criterias
.PARAMETER AdvancedFilter
-AdvancedFilter ARRAY{filter:value,filter:value}
Filter with multiple criterias
.PARAMETER SearchValue
-SearchValue STRING{value}
string to be searched with -SearchFilter parameter
.PARAMETER SearchFilter
-SearchFilter STRING{Get-OnypheSearchFilters}
Filter to be used with string set with SearchValue parameter
.PARAMETER Category
-Category STRING{Get-OnypheSearchCategories}
Search Type or Category
.PARAMETER FilterFunction
-FilterFunction String{Get-OnypheSearchFunctions}
Filter search function
.PARAMETER FilterValue
-FilterValue String
value to use as input for FilterFunction
.PARAMETER APIKey
-APIKey string{APIKEY}
set your APIKEY to be able to use Onyphe API.
.PARAMETER Wait
-Wait int{second}
wait for x second before sending the request to manage rate limiting restriction
.PARAMETER UseBetaFeatures
-UseBetaFeatures switch
use test.onyphe.io to use new beat features of Onyphe
.PARAMETER SaveInfoAsFile
-SaveInfoAsFile string
full path to file where json data will be exported.
.OUTPUTS
TypeName: System.Management.Automation.PSCustomObject
.EXAMPLE
AdvancedSearch with multiple criteria/filters
Search with datascan for all IP matching the criteria : Apache web server listening on 443 tcp port hosted on Windows and export data to myexport.json
C:\PS> Export-OnypheInfo -AdvancedSearch @("product:Apache","port:443","os:Windows") -Category datascan -SaveInfoAsFile .\myexport.json
.EXAMPLE
simple search with one filter/criteria
Search with threatlist for all IP matching the criteria : all IP from russia tagged by threat lists and export data to myexport.json
C:\PS> Export-OnypheInfo -SearchValue RU -Category threatlist -SearchFilter country -SaveInfoAsFile .\myexport.json
.EXAMPLE
AdvancedSearch with multiple criteria/filters and set the API key
Search with datascan for all IP matching the criteria : Apache web server listening on 443 tcp port hosted on Windows and export data to myexport.json
C:\PS> Export-OnypheInfo -AdvancedSearch @("product:Apache","port:443","os:Windows") -Category datascan -apikey "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -SaveInfoAsFile .\myexport.json
.EXAMPLE
simple search with one filter/criteria and use a server filter to retrieve only objects indexed since 2 month
Search with threatlist for all IP matching the criteria : all IP from russia tagged by threat lists and export data to myexport.json
C:\PS> Export-OnypheInfo -SearchValue RU -Category threatlist -SearchFilter country -FilterFunction monthago -FilterValue "2" -SaveInfoAsFile .\myexport.json
.EXAMPLE
filter the result and show me only the answer with os property not null for threatlist category for all Russia and export data to myexport.json
C:\PS> Export-OnypheInfo -SearchValue RU -Category threatlist -SearchFilter country -FilterFunction exist -FilterValue os -SaveInfoAsFile .\myexport.json
.EXAMPLE
filter the results using multiple filters (only os property known and from all organization like *company*) for tcp port 3389 opened in russia and export data to myexport.json
C:\PS> Export-onyphe -AdvancedFilter @("wildcard:organization,*company*","exists:os") -AdvancedSearch @("country:RU","port:3389") -Category datascan -SaveInfoAsFile .\myexport.json
.EXAMPLE
search from onyphe using search-onyphe and pipe the object to export the content to a json file using export-onyphe
C:\PS> Search-onyphe -AdvancedFilter @("wildcard:organization,*company*","exists:os") -AdvancedSearch @("country:RU","port:3389") -Category datascan | Export-onyphe -SaveInfoAsFile .\myexport.json
#>
[cmdletbinding()]
param(
[parameter(ValueFromPipelineByPropertyName=$true,ValueFromPipeline=$true,Mandatory=$false,Position=12)]
[ValidateScript({($_ -is [System.Management.Automation.PSCustomObject]) -or ($_ -is [Deserialized.System.Management.Automation.PSCustomObject])})]
[array]$InputOnypheObject,
[parameter(Mandatory=$false,Position=2)]
[ValidateNotNullOrEmpty()]
[string]$SearchValue,
[parameter(Mandatory=$false,Position=5)]
[ValidateNotNullOrEmpty()]
[string[]]$FilterValue,
[parameter(Mandatory=$false,Position=6)]
[ValidateNotNullOrEmpty()]
[Array]$AdvancedSearch,
[parameter(Mandatory=$false,Position=8)]
[ValidateLength(40,40)]
[string]$APIKey,
[parameter(Mandatory=$false,Position=7)]
[int]$wait,
[parameter(Mandatory=$false,Position=9)]
[switch]$UseBetaFeatures,
[parameter(Mandatory=$false,Position=10)]
[ValidateNotNullOrEmpty()]
[Array]$AdvancedFilter,
[parameter(Mandatory=$true,Position=11)]
[string]$SaveInfoAsFile
)
DynamicParam
{
$ParameterNameType = 'SearchType'
$RuntimeParameterDictionary = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary
$AttributeCollection = New-Object System.Collections.ObjectModel.Collection[System.Attribute]
$ParameterAttribute = New-Object System.Management.Automation.ParameterAttribute
$ParameterAttribute.ValueFromPipeline = $false
$ParameterAttribute.ValueFromPipelineByPropertyName = $false
$ParameterAttribute.Mandatory = $false
$ParameterAttribute.Position = 1
$AttributeCollection.Add($ParameterAttribute)
$arrSet = Get-OnypheSearchCategories
$ValidateSetAttribute = New-Object System.Management.Automation.ValidateSetAttribute($arrSet)
$AttributeCollection.Add($ValidateSetAttribute)
$ParameterNameAlias = New-Object System.Management.Automation.AliasAttribute -ArgumentList @("Category")
$AttributeCollection.Add($ParameterNameAlias)
$RuntimeParameter = New-Object System.Management.Automation.RuntimeDefinedParameter($ParameterNameType, [string], $AttributeCollection)
$RuntimeParameterDictionary.Add($ParameterNameType, $RuntimeParameter)
$ParameterNameFilter = 'SearchFilter'
$AttributeCollection2 = New-Object System.Collections.ObjectModel.Collection[System.Attribute]
$ParameterAttribute2 = New-Object System.Management.Automation.ParameterAttribute
$ParameterAttribute2.ValueFromPipeline = $false
$ParameterAttribute2.ValueFromPipelineByPropertyName = $false
$ParameterAttribute2.Mandatory = $false
$ParameterAttribute2.Position = 3
$AttributeCollection2.Add($ParameterAttribute2)
$arrSet = Get-OnypheSearchFilters
$ValidateSetAttribute2 = New-Object System.Management.Automation.ValidateSetAttribute($arrSet)
$AttributeCollection2.Add($ValidateSetAttribute2)
$RuntimeParameter2 = New-Object System.Management.Automation.RuntimeDefinedParameter($ParameterNameFilter, [string], $AttributeCollection2)
$RuntimeParameterDictionary.Add($ParameterNameFilter, $RuntimeParameter2)
$ParameterNameFunction = 'FilterFunction'
$AttributeCollection3 = New-Object System.Collections.ObjectModel.Collection[System.Attribute]
$ParameterAttribute3 = New-Object System.Management.Automation.ParameterAttribute
$ParameterAttribute3.ValueFromPipeline = $false
$ParameterAttribute3.ValueFromPipelineByPropertyName = $false
$ParameterAttribute3.Mandatory = $false
$ParameterAttribute3.Position = 4
$AttributeCollection3.Add($ParameterAttribute3)
$arrSet = Get-OnypheSearchFunctions
$ValidateSetAttribute3 = New-Object System.Management.Automation.ValidateSetAttribute($arrSet)
$AttributeCollection3.Add($ValidateSetAttribute3)
$RuntimeParameter3 = New-Object System.Management.Automation.RuntimeDefinedParameter($ParameterNameFunction, [string], $AttributeCollection3)
$RuntimeParameterDictionary.Add($ParameterNameFunction, $RuntimeParameter3)
return $RuntimeParameterDictionary
}
Process {
if (!($InputOnypheObject)) {
$SearchType = $PsBoundParameters[$ParameterNameType]
$SearchFilter = $PsBoundParameters[$ParameterNameFilter]
$SearchFunction = $PsBoundParameters[$ParameterNameFunction]
if ((!($SearchValue) -and !($AdvancedSearch)) -or !($SearchType)) {
Throw "SearchValue or AdvancedSearch parameters and SearchType parameter are mandatory"
}
$params = @{
SearchType = $SearchType
}
if ($APIKey) {Set-OnypheAPIKey -APIKey $APIKey | out-null}
if ($wait) {start-sleep -s $wait}
if ($SearchFilter -and !($SearchValue)) {
throw "please use the SearchValue parameter when using SearchFilter parameter or used AdvancedSearch instead"
}
if ($SearchFunction -and !($FilterValue)) {
throw "please use the FilterValue parameter when using FilterFunction parameter"
}
if ($AdvancedSearch) {
$params.add('AdvancedSearch',$AdvancedSearch)
} elseif ($SearchValue) {
$params.add('SearchValue',$SearchValue)
$params.add('SearchFilter',$SearchFilter)
}
if ($AdvancedFilter) {
$params.add('AdvancedFilter',$AdvancedFilter)
} elseif ($SearchFunction) {
$params.add('FilterFunction', $SearchFunction)
$params.add('FilterValue',$FilterValue)
}
if ($UseBetaFeatures) {
$params.add('UseBetaFeatures', $true)
}
$params.add('FuncInput', $PsBoundParameters)
} else {
if ($InputOnypheObject.'cli-func_input') {
$params = $InputOnypheObject.'cli-func_input'.clone()
$params.add('FuncInput', $InputOnypheObject.'cli-func_input'.clone())
if ($params.Page) {
$params.remove('Page')
}
} else {
throw "invalid input object, missing property cli-func_input"
}
}
$params.add('OutFile', $SaveInfoAsFile)
Invoke-APIOnypheExport @params
}
}
Function Export-OnypheBulkSummaryInfo {
<#
.SYNOPSIS
main function/cmdlet - Export Search information on onyphe.io web service using bulk APIs
.DESCRIPTION
main function/cmdlet - Export Search information on onyphe.io web service using bulk APIs
bulk APIs use input file containing ip, domain or hostname and sends back streamed json as result.
.PARAMETER APIKey
-APIKey string{APIKEY}
set your APIKEY to be able to use Onyphe API.
.PARAMETER Wait
-Wait int{second}
wait for x second before sending the request to manage rate limiting restriction
.PARAMETER SaveInfoAsFile
-SaveInfoAsFile string
full path to file where json data will be exported.
.PARAMETER FilePath
-FilePath string
full path to file to be imported to the bulk API.
.PARAMETER BulkAPISummary
-BulkAPISummary string {Get-OnypheSummaryAPIName}
Bulk API to be used : ip, domain, hostname
.OUTPUTS
TypeName: System.Management.Automation.PSCustomObject
.EXAMPLE
export summary IP information into Json file using myfile.txt as source IPs file
C:\PS> Export-OnypheBulkInfo -FilePath .\myfile.txt -SaveInfoAsFile .\results.json -SearchType ip
.EXAMPLE
export summary domain information into Json file using myfile.txt as source domains file
C:\PS> Export-OnypheBulkInfo -FilePath .\myfile.txt -SaveInfoAsFile .\results.json -SearchType domain
.EXAMPLE
export summary hostname information into Json file using myfileip.txt as source hostnames file
C:\PS> Export-OnypheBulkInfo -FilePath .\myfile.txt -SaveInfoAsFile .\results.json -SearchType hostname
.EXAMPLE
export summary hostname information into object using myfileip.txt as source hostnames file
C:\PS> Export-OnypheBulkInfo -FilePath .\myfile.txt -SaveInfoAsFile .\results.json -SearchType hostname
#>
[cmdletbinding()]
param(
[parameter(Mandatory=$true)]
[ValidateScript({test-path "$($_)"})]
[string]$FilePath,
[parameter(Mandatory=$false)]
[string]$SaveInfoAsFile,
[parameter(Mandatory=$false)]
[ValidateLength(40,40)]
[string]$APIKey,
[parameter(Mandatory=$false)]
[int]$wait
)
DynamicParam
{
$ParameterNameType = 'SearchType'
$RuntimeParameterDictionary = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary
$AttributeCollection = New-Object System.Collections.ObjectModel.Collection[System.Attribute]
$ParameterAttribute = New-Object System.Management.Automation.ParameterAttribute
$ParameterAttribute.ValueFromPipeline = $false
$ParameterAttribute.ValueFromPipelineByPropertyName = $false
$ParameterAttribute.Mandatory = $true
$ParameterAttribute.Position = 2
$AttributeCollection.Add($ParameterAttribute)
$arrSet = Get-OnypheSummaryAPIName
$ValidateSetAttribute = New-Object System.Management.Automation.ValidateSetAttribute($arrSet)
$AttributeCollection.Add($ValidateSetAttribute)
$ParameterNameAlias = New-Object System.Management.Automation.AliasAttribute -ArgumentList @("BulkAPISummary")
$AttributeCollection.Add($ParameterNameAlias)
$RuntimeParameter = New-Object System.Management.Automation.RuntimeDefinedParameter($ParameterNameType, [string], $AttributeCollection)
$RuntimeParameterDictionary.Add($ParameterNameType, $RuntimeParameter)
return $RuntimeParameterDictionary
}
Process {
$SearchType = $PsBoundParameters[$ParameterNameType]
if ($wait) {start-sleep -s $wait}
if ($APIKey) {Set-OnypheAPIKey -APIKey $APIKey | out-null}
if (!($SaveInfoAsFile)) {
$outputAsObject = $true
$SaveInfoAsFile = [System.IO.Path]::GetTempFileName()
remove-item -path $SaveInfoAsFile -force
}
$params = @{
OutFile = $SaveInfoAsFile
FilePath = $FilePath
}
if (test-path function:\"Invoke-APIBulkSummaryOnyphe$($Searchtype)") {
$responsestream = invoke-expression "Invoke-APIBulkSummaryOnyphe$($Searchtype) `@params"
} else {
throw "Bulk Summary API $($Searchtype) not implemented yet in this version of Use-Onyphe pwsh module"
}
if ($outputAsObject -and (test-path $SaveInfoAsFile)) {
get-content $SaveInfoAsFile | convertfrom-json
}
}
}
Function Export-OnypheBulkInfo {
<#
.SYNOPSIS
main function/cmdlet - Export Search information on onyphe.io web service using bulk simple APIs
.DESCRIPTION
main function/cmdlet - Export Search information on onyphe.io web service using bulk simple APIs
bulk APIs use input file containing ip sends back streamed json as result.
.PARAMETER APIKey
-APIKey string{APIKEY}
set your APIKEY to be able to use Onyphe API.
.PARAMETER Wait
-Wait int{second}
wait for x second before sending the request to manage rate limiting restriction
.PARAMETER SaveInfoAsFile
-SaveInfoAsFile string
full path to file where json data will be exported.
.PARAMETER FilePath
-FilePath string
full path to file to be imported to the bulk simple APIs.
.PARAMETER Category
-Category string {Get-OnypheBulkCategories}
Bulk Simple Category to be used : ctl,datascan,datashot,geoloc,inetnum,pastries,resolver,sniffer,synscan,threatlist,topsite,vulnscan,whois
.PARAMETER Best
-Best switch
Enable Best mode for Simple API
.OUTPUTS
TypeName: System.Management.Automation.PSCustomObject
.EXAMPLE
export ctl information into Json file using myfile.txt as source IPs file
C:\PS> Export-OnypheBulkInfo -FilePath .\myfile.txt -SaveInfoAsFile .\results.json -Category ctl
.EXAMPLE
export datascan information into Json file using myfile.txt as source IPs file
C:\PS> Export-OnypheBulkInfo -FilePath .\myfile.txt -SaveInfoAsFile .\results.json -Category datascan
.EXAMPLE
export threatlist information into Json file using myfileip.txt as source IPs file
C:\PS> Export-OnypheBulkInfo -FilePath .\myfile.txt -SaveInfoAsFile .\results.json -Category threatlist
.EXAMPLE
export threatlist information into object file using myfileip.txt as source IPs file
C:\PS> Export-OnypheBulkInfo -FilePath .\myfile.txt -Category threatlist
#>
[cmdletbinding()]
param(
[parameter(Mandatory=$true)]
[ValidateScript({test-path "$($_)"})]
[string]$FilePath,
[parameter(Mandatory=$false)]
[string]$SaveInfoAsFile,
[parameter(Mandatory=$false)]
[switch]$Best,
[parameter(Mandatory=$false)]
[ValidateLength(40,40)]
[string]$APIKey,
[parameter(Mandatory=$false)]
[int]$wait
)
DynamicParam
{
$ParameterNameType = 'Category'
$RuntimeParameterDictionary = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary
$AttributeCollection = New-Object System.Collections.ObjectModel.Collection[System.Attribute]
$ParameterAttribute = New-Object System.Management.Automation.ParameterAttribute
$ParameterAttribute.ValueFromPipeline = $false
$ParameterAttribute.ValueFromPipelineByPropertyName = $false
$ParameterAttribute.Mandatory = $true
$ParameterAttribute.Position = 2
$AttributeCollection.Add($ParameterAttribute)
$arrSet = Get-OnypheBulkCategories
$ValidateSetAttribute = New-Object System.Management.Automation.ValidateSetAttribute($arrSet)
$AttributeCollection.Add($ValidateSetAttribute)
$ParameterNameAlias = New-Object System.Management.Automation.AliasAttribute -ArgumentList @("BulkCategory")
$AttributeCollection.Add($ParameterNameAlias)
$RuntimeParameter = New-Object System.Management.Automation.RuntimeDefinedParameter($ParameterNameType, [string], $AttributeCollection)
$RuntimeParameterDictionary.Add($ParameterNameType, $RuntimeParameter)
return $RuntimeParameterDictionary
}
Process {
$Category = $PsBoundParameters[$ParameterNameType]
if ($wait) {start-sleep -s $wait}
if ($APIKey) {Set-OnypheAPIKey -APIKey $APIKey | out-null}
if (!($SaveInfoAsFile)) {
$outputAsObject = $true
$SaveInfoAsFile = [System.IO.Path]::GetTempFileName()
remove-item -path $SaveInfoAsFile -force
}
$params = @{
OutFile = $SaveInfoAsFile
FilePath = $FilePath
}
if ($Best.IsPresent) {
if ((Get-OnypheSimpleBestAPIName) -contains $Category) {
if (test-path function:\"Invoke-APIBulkSimpleBestOnyphe$($Category)") {
$responsestream = invoke-expression "Invoke-APIBulkSimpleBestOnyphe$($Category) `@params"
} else {
throw "Simple Best API $($Category) not implemented yet in this version of Use-Onyphe pwsh module"
}
} else {
throw "Simple Best API $($Category) not available on Onyphe"
}
} else {
if ((get-OnypheSimpleAPIName) -contains $Category) {
if (test-path function:\"Invoke-APIBulkSimpleOnyphe$($Category)") {
$responsestream = invoke-expression "Invoke-APIBulkSimpleOnyphe$($Category) `@params"
} else {
throw "Simple API $($Category) not implemented yet in this version of Use-Onyphe pwsh module"
}
} else {
throw "Simple API $($Category) not available on Onyphe"
}
}
if ($outputAsObject -and (test-path $SaveInfoAsFile)) {
get-content $SaveInfoAsFile | convertfrom-json
}
}
}
Function Search-OnypheInfo {
<#
.SYNOPSIS
main function/cmdlet - Search for IP information on onyphe.io web service using search API
.DESCRIPTION
main function/cmdlet - Search for IP information on onyphe.io web service using search API
send HTTP request to onyphe.io web service and convert back JSON information to a powershell custom object
.PARAMETER AdvancedSearch
-AdvancedSearch ARRAY{filter:value,filter:value}
Search with multiple criterias
.PARAMETER AdvancedFilter
-AdvancedFilter ARRAY{filter:value,filter:value}
Filter with multiple criterias
.PARAMETER SearchValue
-SearchValue STRING{value}
string to be searched with -SearchFilter parameter
.PARAMETER SearchFilter
-SearchFilter STRING{Get-OnypheSearchFilters}
Filter to be used with string set with SearchValue parameter
.PARAMETER Category
-Category STRING{Get-OnypheSearchCategories}
Search Type or Category
.PARAMETER FilterFunction
-FilterFunction String{Get-OnypheSearchFunctions}
Filter search function
.PARAMETER FilterValue
-FilterValue String
value to use as input for FilterFunction
.PARAMETER APIKey
-APIKey string{APIKEY}
set your APIKEY to be able to use Onyphe API.
.PARAMETER Page
-page string{page number}
go directly to a specific result page (1 to 1000)
you can set a list of page using x-y like 1-100 to read the first 100 pages
.PARAMETER Wait
-Wait int{second}
wait for x second before sending the request to manage rate limiting restriction
.PARAMETER UseBetaFeatures
-UseBetaFeatures switch
use test.onyphe.io to use new beat features of Onyphe
.OUTPUTS
TypeName: System.Management.Automation.PSCustomObject
.EXAMPLE
AdvancedSearch with multiple criteria/filters
Search with datascan for all IP matching the criteria : Apache web server listening on 443 tcp port hosted on Windows
C:\PS> Search-OnypheInfo -AdvancedSearch @("product:Apache","port:443","os:Windows") -Category datascan
.EXAMPLE
simple search with one filter/criteria
Search with threatlist for all IP matching the criteria : all IP from russia tagged by threat lists
C:\PS> Search-OnypheInfo -SearchValue RU -Category threatlist -SearchFilter country
.EXAMPLE
AdvancedSearch with multiple criteria/filters and set the API key
Search with datascan for all IP matching the criteria : Apache web server listening on 443 tcp port hosted on Windows
C:\PS> Search-OnypheInfo -AdvancedSearch @("product:Apache","port:443","os:Windows") -Category datascan -apikey "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
.EXAMPLE
simple search with one filter/criteria and request page 2 of the results
Search with threatlist for all IP matching the criteria : all IP from russia tagged by threat lists
C:\PS> Search-OnypheInfo -SearchValue RU -Category threatlist -SearchFilter country -page "2"
.EXAMPLE
simple search with one filter/criteria and use a server filter to retrieve only objects indexed since 2 month
Search with threatlist for all IP matching the criteria : all IP from russia tagged by threat lists
C:\PS> Search-OnypheInfo -SearchValue RU -Category threatlist -SearchFilter country -FilterFunction monthago -FilterValue "2"
.EXAMPLE
filter the result and show me only the answer with os property not null for threatlist category for all Russia
C:\PS> Search-OnypheInfo -SearchValue RU -Category threatlist -SearchFilter country -FilterFunction exist -FilterValue os
.EXAMPLE
filter the results using multiple filters (only os property known and from all organization like *company*) for tcp port 3389 opened in russia
C:\PS> search-onyphe -AdvancedFilter @("wildcard:organization,*company*","exists:os") -AdvancedSearch @("country:RU","port:3389") -Category datascan
#>
[cmdletbinding()]
param(
[parameter(ValueFromPipelineByPropertyName=$true,ValueFromPipeline=$true,Mandatory=$false,Position=2)]
[ValidateNotNullOrEmpty()]
[string]$SearchValue,
[parameter(Mandatory=$false,Position=5)]
[ValidateNotNullOrEmpty()]
[string[]]$FilterValue,
[parameter(Mandatory=$false,Position=6)]
[ValidateNotNullOrEmpty()]
[Array]$AdvancedSearch,
[parameter(Mandatory=$false,Position=8)]
[ValidateLength(40,40)]
[string]$APIKey,
[parameter(Mandatory=$false,Position=9)]
[ValidateScript({($_ -match "^((?!0)\d+)$") -or ($_ -match "^((?!0)\d+)(-)((?!0)\d+)$")})]
[string[]]$Page,
[parameter(Mandatory=$false,Position=7)]
[int]$wait,
[parameter(Mandatory=$false,Position=10)]
[switch]$UseBetaFeatures,
[parameter(Mandatory=$false,Position=11)]
[ValidateNotNullOrEmpty()]
[Array]$AdvancedFilter
)
DynamicParam
{
$ParameterNameType = 'SearchType'
$RuntimeParameterDictionary = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary
$AttributeCollection = New-Object System.Collections.ObjectModel.Collection[System.Attribute]
$ParameterAttribute = New-Object System.Management.Automation.ParameterAttribute
$ParameterAttribute.ValueFromPipeline = $false
$ParameterAttribute.ValueFromPipelineByPropertyName = $false
$ParameterAttribute.Mandatory = $true
$ParameterAttribute.Position = 1
$AttributeCollection.Add($ParameterAttribute)
$arrSet = Get-OnypheSearchCategories
$ValidateSetAttribute = New-Object System.Management.Automation.ValidateSetAttribute($arrSet)
$AttributeCollection.Add($ValidateSetAttribute)
$ParameterNameAlias = New-Object System.Management.Automation.AliasAttribute -ArgumentList @("Category")
$AttributeCollection.Add($ParameterNameAlias)
$RuntimeParameter = New-Object System.Management.Automation.RuntimeDefinedParameter($ParameterNameType, [string], $AttributeCollection)
$RuntimeParameterDictionary.Add($ParameterNameType, $RuntimeParameter)
$ParameterNameFilter = 'SearchFilter'
$AttributeCollection2 = New-Object System.Collections.ObjectModel.Collection[System.Attribute]
$ParameterAttribute2 = New-Object System.Management.Automation.ParameterAttribute
$ParameterAttribute2.ValueFromPipeline = $false
$ParameterAttribute2.ValueFromPipelineByPropertyName = $false
$ParameterAttribute2.Mandatory = $false
$ParameterAttribute2.Position = 3
$AttributeCollection2.Add($ParameterAttribute2)
$arrSet = Get-OnypheSearchFilters
$ValidateSetAttribute2 = New-Object System.Management.Automation.ValidateSetAttribute($arrSet)
$AttributeCollection2.Add($ValidateSetAttribute2)
$RuntimeParameter2 = New-Object System.Management.Automation.RuntimeDefinedParameter($ParameterNameFilter, [string], $AttributeCollection2)
$RuntimeParameterDictionary.Add($ParameterNameFilter, $RuntimeParameter2)
$ParameterNameFunction = 'FilterFunction'
$AttributeCollection3 = New-Object System.Collections.ObjectModel.Collection[System.Attribute]
$ParameterAttribute3 = New-Object System.Management.Automation.ParameterAttribute
$ParameterAttribute3.ValueFromPipeline = $false
$ParameterAttribute3.ValueFromPipelineByPropertyName = $false
$ParameterAttribute3.Mandatory = $false
$ParameterAttribute3.Position = 4
$AttributeCollection3.Add($ParameterAttribute3)
$arrSet = Get-OnypheSearchFunctions
$ValidateSetAttribute3 = New-Object System.Management.Automation.ValidateSetAttribute($arrSet)
$AttributeCollection3.Add($ValidateSetAttribute3)
$RuntimeParameter3 = New-Object System.Management.Automation.RuntimeDefinedParameter($ParameterNameFunction, [string], $AttributeCollection3)
$RuntimeParameterDictionary.Add($ParameterNameFunction, $RuntimeParameter3)
return $RuntimeParameterDictionary
}
Process {
$SearchType = $PsBoundParameters[$ParameterNameType]
$SearchFilter = $PsBoundParameters[$ParameterNameFilter]
$SearchFunction = $PsBoundParameters[$ParameterNameFunction]
$params = @{
SearchType = $SearchType
FuncInput = $PsBoundParameters
}
if ($APIKey) {Set-OnypheAPIKey -APIKey $APIKey | out-null}
if ($wait) {start-sleep -s $wait}
if ($SearchFilter -and !($SearchValue)) {
throw "please use the SearchValue parameter when using SearchFilter parameter or used AdvancedSearch instead"
}
if ($SearchFunction -and !($FilterValue)) {
throw "please use the FilterValue parameter when using FilterFunction parameter"
}
if ($AdvancedSearch) {
$params.add('AdvancedSearch',$AdvancedSearch)
} elseif ($SearchValue) {
$params.add('SearchValue',$SearchValue)
$params.add('SearchFilter',$SearchFilter)
}
if ($AdvancedFilter) {
$params.add('AdvancedFilter',$AdvancedFilter)
} elseif ($SearchFunction) {
$params.add('FilterFunction', $SearchFunction)
$params.add('FilterValue',$FilterValue)
}
if ($UseBetaFeatures) {
$params.add('UseBetaFeatures', $true)
}
if ($Page) {
switch -regex ($page) {
"^((?!0)\d+)(-)((?!0)\d+)$" {
$page = $page -split "-"
for ($i=[int]$page[0];$i -le [int]$page[1];$i++) {
if ($params.page) {
$params.Page = $i.tostring()
} else {
$params.add('Page', $i.tostring())
}
if ($wait) {
Start-Sleep -s $wait
} else {
Start-Sleep -s 3
}
Invoke-APIOnypheSearch @params
}
}
"^((?!0)\d+)$" {
$params.add('Page', $page)
Invoke-APIOnypheSearch @params
}
}
} else {
Invoke-APIOnypheSearch @params
}
}
}
Function Get-OnypheInfo {
<#
.SYNOPSIS
main function/cmdlet - Get information from onyphe.io web service using dedicated subfunctions by Simple API available
.DESCRIPTION
main function/cmdlet - Get information from onyphe.io web service using dedicated subfunctions by Simple API available
send HTTP request to onyphe.io web service and convert back JSON information to a powershell custom object
.PARAMETER Category
-Category string (ctl,datascan,geoloc,inetnum,pastries,resolver,sniffer,synscan,threatlist,datashot,onionscan,onionshot,topsite,vulnscan,resolverreverse,resolverforward,datascandatamd5,whois)
.PARAMETER SearchValue
-SearchValue string -Category Inetnum -APIKey string{APIKEY}
look for an ip address in onyphe database
-SearchValue string -Category Threatlist -APIKey string{APIKEY}
look for threat info about a specific IP in onyphe database.
-SearchValue string -Category Pastries -APIKey string{APIKEY}
look for an pastbin data about a specific IP in onyphe database.
-SearchValue string -Category Synscan -APIKey string{APIKEY}