full_path stringlengths 31 232 | filename stringlengths 4 167 | content stringlengths 0 48.3M |
|---|---|---|
combined_dataset/train/non-malicious/Get-MACFromIP.ps1 | Get-MACFromIP.ps1 | Function Get-MACFromIP {
param ($IPAddress)
$sign = @"
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Net.NetworkInformation;
using System.Runtime.InteropServices;
public static class NetUtils
{
[System.Runtime.InteropServices.DllImport("iphlpapi.dll... |
combined_dataset/train/non-malicious/finddupe_7.ps1 | finddupe_7.ps1 | function Get-MD5([System.IO.FileInfo] $file = $(throw 'Usage: Get-MD5 [System.IO.FileInfo]'))
{
$stream = $null;
$cryptoServiceProvider = [System.Security.Cryptography.MD5CryptoServiceProvider];
$hashAlgorithm = new-object $cryptoServiceProvider
$stream = $file.OpenRead();
$hashByteArray = $hashA... |
combined_dataset/train/non-malicious/Start-ProcessAsAdministr.ps1 | Start-ProcessAsAdministr.ps1 | function Start-ProcessAsAdministrator
{
<#
.ForwardHelpTargetName Start-Process
.ForwardHelpCategory Cmdlet
#>
[CmdletBinding(DefaultParameterSetName='Default')]
param(
[Parameter(Mandatory=$true, Position=0)]
[Alias('PSPath')]
[ValidateNotNullOrEmpty()]
[System.String... |
combined_dataset/train/non-malicious/Deleted-ObjectsAD_2.ps1 | Deleted-ObjectsAD_2.ps1 | param(
$Domen,
[string[]]$ObjectsDeleted
)
function Ping ($Name){
$ping = new-object System.Net.NetworkInformation.Ping
if ($ping.send($Name).Status -eq "Success") {$True}
else {$False}
trap {Write-Verbose "Error Ping"; $False; continue}
}
[string[]]$ObjectPath
[string[]]$Disks
[string[]]... |
combined_dataset/train/non-malicious/4178.ps1 | 4178.ps1 |
cls
Set-Variable -Name App -Value $null
Set-Variable -Name File -Force
Set-Variable -Name GUID -Force
Set-Variable -Name RelativePath -Scope Global -Force
$MissingGUIDs = @()
Function GetRelativePath {
$Global:RelativePath=(split-path $SCRIPT:MyInvocation.MyCommand.Path -parent)+"\"
}
GetRelativePath
$File = ... |
combined_dataset/train/non-malicious/de04269d-38ca-4bb2-8559-9bd6072c319f.ps1 | de04269d-38ca-4bb2-8559-9bd6072c319f.ps1 | #==========================================================================
# NAME: getunknownsids.ps1
#
# AUTHOR: Stephen Wheet
# Version: 4.0
# Date: 6/11/10
#
# COMMENT:
# This script was created to find unknown SIDs or old domain permissions
# on folders. It ignores folders where inheirtance is turned ... |
combined_dataset/train/non-malicious/sample_24_44.ps1 | sample_24_44.ps1 | #
# Module manifest for module 'OCI.PSModules.Servicemanagerproxy'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Servicemanagerproxy.dll'
# Version number of this module.
ModuleVersion = '83.1.0'
# Sup... |
combined_dataset/train/non-malicious/Shell.ShellLink.ps1 | Shell.ShellLink.ps1 | ## With thanks to Steve McMahon and his article:
## http://vbaccelerator.com/home/NET/Code/Libraries/Shell_Projects/Creating_and_Modifying_Shortcuts/article.asp
##
## After executing Add-Type, below, you'll be able to:
## new-object Shell.ShellLink ".\\Some Shortcut.lnk"
Add-Type -Ref System.Drawing, System.Wind... |
combined_dataset/train/non-malicious/sample_53_65.ps1 | sample_53_65.ps1 | #
# Module manifest for module 'OCI.PSModules.Dataflow'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Dataflow.dll'
# Version number of this module.
ModuleVersion = '82.0.0'
# Supported PSEditions
Comp... |
combined_dataset/train/non-malicious/wpf datagrid xaml.ps1 | wpf datagrid xaml.ps1 | <Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Name="Window"
Title="DataGrid Binding"
Width="640" Height="480">
<Grid >
<TextBlock Height="24" Margin="8,8,8,0" TextWrapping="Wrap" Text="DataGrid" VerticalAlignment="Top" F... |
combined_dataset/train/non-malicious/2176.ps1 | 2176.ps1 |
[CmdletBinding(SupportsShouldProcess=$true)]
param(
[parameter(Mandatory=$true, HelpMessage="Specify the Primary Site server")]
[ValidateScript({Test-Connection -ComputerName $_ -Count 2})]
[string]$SiteServer = "$($env:COMPUTERNAME)",
[parameter(Mandatory=$true, HelpMessage="Specify the name of a Dist... |
combined_dataset/train/non-malicious/chkhash_19.ps1 | chkhash_19.ps1 | # calculate SHA512 of file.
function Get-SHA512([System.IO.FileInfo] $file = $(throw 'Usage: Get-MD5 [System.IO.FileInfo]'))
{
$stream = $null;
$cryptoServiceProvider = [System.Security.Cryptography.SHA512CryptoServiceProvider];
$hashAlgorithm = new-object $cryptoServiceProvider
$stream = $file.Open... |
combined_dataset/train/non-malicious/3626.ps1 | 3626.ps1 |
function Test-BasicDataClassificationOnSqlManagedDatabase
{
$testSuffix = getAssetName
Create-ManagedDataClassificationTestEnvironment $testSuffix
$params = Get-DataClassificationManagedTestEnvironmentParameters $testSuffix
try
{
$recommendations = Get-AzSqlInstanceDatabaseSensitivityRecomme... |
combined_dataset/train/non-malicious/sample_66_32.ps1 | sample_66_32.ps1 | #
# Module manifest for module 'OCI.PSModules.Aidocument'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Aidocument.dll'
# Version number of this module.
ModuleVersion = '85.1.0'
# Supported PSEditions
... |
combined_dataset/train/non-malicious/Network Config _ Excel.ps1 | Network Config _ Excel.ps1 | $excel = New-Object -comobject Excel.Application
$excel.visible = $False #Change to True to see the excel build
$wbook = $excel.Workbooks.Add()
$wsheet = $wbook.Worksheets.Item(1)
$wsheet.Cells.Item(1,1) = "Date"
$wsheet.Cells.Item(1,2) = "Server"
$wsheet.Cells.Item(1,3) = "NETID"
$wsheet.Cells.Item(1,4) = "Desc... |
combined_dataset/train/non-malicious/sample_41_48.ps1 | sample_41_48.ps1 | #
# Module manifest for module 'OCI.PSModules.Database'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Database.dll'
# Version number of this module.
ModuleVersion = '83.2.0'
# Supported PSEditions
Comp... |
combined_dataset/train/non-malicious/sample_5_58.ps1 | sample_5_58.ps1 | // Copyright (c) 2016 Dell Inc. or its subsidiaries. All Rights Reserved.
// ==================================================================
// DCIM_FCCapabilities
// ==================================================================
[dynamic, provider("dcismprovider"),
Description(
"DCIM_FCC... |
combined_dataset/train/non-malicious/The Letter Diamond.ps1 | The Letter Diamond.ps1 | ## Write a program which draws a diamond of the form illustrted
## below. The letter which is to appear at the widest point of the
## figure (E in the example) is to be specified as the input data.
## A
## B B
## C C
## D D
## E E
## D D
## ... |
combined_dataset/train/non-malicious/sample_25_23.ps1 | sample_25_23.ps1 | #
# Module manifest for module 'OCI.PSModules.Resourcesearch'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Resourcesearch.dll'
# Version number of this module.
ModuleVersion = '80.0.0'
# Supported PSE... |
combined_dataset/train/non-malicious/sample_3_97.ps1 | sample_3_97.ps1 | @{
GUID="EEFCB906-B326-4E99-9F54-8B4BB6EF3C6D"
Author="PowerShell"
CompanyName="Microsoft Corporation"
Copyright="Copyright (c) Microsoft Corporation."
ModuleVersion="7.0.0.0"
CompatiblePSEditions = @("Core")
PowerShellVersion="3.0"
NestedModules="Microsoft.PowerShell.Commands.Management.dll"
HelpInfoURI = 'https://aka... |
combined_dataset/train/non-malicious/3518.ps1 | 3518.ps1 |
function Test-RecordSetCrud
{
$zoneName = Get-RandomZoneName
$recordName = getAssetname
$resourceGroup = TestSetup-CreateResourceGroup
$zone = New-AzPrivateDnsZone -Name $zoneName -ResourceGroupName $resourceGroup.ResourceGroupName
$createdRecord = New-AzPrivateDnsRecordSet -Name $recordName -Zo... |
combined_dataset/train/non-malicious/1306.ps1 | 1306.ps1 |
function Test-CPathIsJunction
{
[CmdletBinding(DefaultParameterSetName='Path')]
param(
[Parameter(Mandatory=$true,ParameterSetName='Path',Position=0)]
[string]
$Path,
[Parameter(Mandatory=$true,ParameterSetName='LiteralPath')]
[string]
... |
combined_dataset/train/non-malicious/Get_Set Signature (CTP2)_2.ps1 | Get_Set Signature (CTP2)_2.ps1 | #Requires -version 2.0
## Authenticode.psm1
####################################################################################################
## Wrappers for the Get-AuthenticodeSignature and Set-AuthenticodeSignature cmdlets
## These properly parse paths, so they don't kill your pipeline and script if you incl... |
combined_dataset/train/non-malicious/Connect-VMHost.ps1 | Connect-VMHost.ps1 | #requires -version 2 -pssnapin VMware.VimAutomation.Core
Function Connect-VMHost {
<#
.Summary
Used to Connect a disconnected host to vCenter.
.Parameter VMHost
VMHost to reconnect to virtual center
.Example
Get-VMHost | Where-Object {$_.state -eq "Disconnected"} | Conne... |
combined_dataset/train/non-malicious/4244.ps1 | 4244.ps1 |
function Dump-NTDS
{
[cmdletbinding()]
Param
(
[string[]]$EmptyFolder
)
if( (Get-ChildItem $EmptyFolder | Measure-Object).Count -eq 0)
{
if (Test-Administrator) {
NTdsutil.exe "activate instance ntds" "ifm" "create full $($EmptyFolder) " "q" "q"
} else {
Write-Output ... |
combined_dataset/train/non-malicious/VMware _ Windows Admin.ps1 | VMware _ Windows Admin.ps1 | #========================================================================
# Created on: 5/17/2012 2:03 PM
# Created by: Clint Jones
# Organization: Virtually Genius!
# Filename: Get-VMHostVersions
#========================================================================
#Import modules
Add-PSSnapin "Vm... |
combined_dataset/train/non-malicious/sample_52_87.ps1 | sample_52_87.ps1 | ## Copyright (c) Microsoft Corporation. All rights reserved.
<#
.SYNOPSIS
This cmdlet collects a performance recording of Microsoft Defender Antivirus
scans.
.DESCRIPTION
This cmdlet collects a performance recording of Microsoft Defender Antivirus
scans. These performance recordings contain Microsoft-Antimal... |
combined_dataset/train/non-malicious/8fad46f9-26e1-4da7-8cc9-eb8a10d893dc.ps1 | 8fad46f9-26e1-4da7-8cc9-eb8a10d893dc.ps1 | $devEnvArgs = '"' + "$pwd"+"\\Installer\\myInstaller.sln" + '"';
$devSwitches = '"' + "/rebuild Release 2>&1" + '"';
$output = &$vsExe $devEnvArgs $devSwitches;
|
combined_dataset/train/non-malicious/sample_61_72.ps1 | sample_61_72.ps1 | #
# Module manifest for module 'OCI.PSModules.Fleetsoftwareupdate'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Fleetsoftwareupdate.dll'
# Version number of this module.
ModuleVersion = '86.2.0'
# Sup... |
combined_dataset/train/non-malicious/1497.ps1 | 1497.ps1 |
function Assert-Error
{
[CmdletBinding(DefaultParameterSetName='Default')]
param(
[Parameter(Mandatory=$true,ParameterSetName='CheckLastError')]
[Switch]
$Last,
[Parameter(Mandatory=$true,ParameterSetName='CheckFirstError')]
[Switch]
... |
combined_dataset/train/non-malicious/3084.ps1 | 3084.ps1 | function global:Test-Error {
Write-Error "This is an error" -ErrorAction SilentlyContinue
}
Given "we mock Write-Error" {
Mock Write-Error { } -Verifiable
}
When "we call a function that writes an error" {
Test-Error
}
Then "we can verify the mock" {
Assert-MockCalled Write-Error
Assert-Verifiabl... |
combined_dataset/train/non-malicious/sample_33_56.ps1 | sample_33_56.ps1 | #
# Module manifest for module 'OCI.PSModules.Announcementsservice'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Announcementsservice.dll'
# Version number of this module.
ModuleVersion = '75.1.0'
# S... |
combined_dataset/train/non-malicious/2290.ps1 | 2290.ps1 |
[CmdletBinding(SupportsShouldProcess=$true)]
param(
[parameter(Mandatory=$false, ParameterSetName="List", HelpMessage="List user accounts eligible for removal instead of being removed")]
[ValidateNotNullOrEmpty()]
[switch]$List,
[parameter(Mandatory=$false, ParameterSetName="Purge", HelpMessage="Remove... |
combined_dataset/train/non-malicious/Get Twitter RSS Feed_7.ps1 | Get Twitter RSS Feed_7.ps1 | param ([String] $ScreenName)
$client = New-Object System.Net.WebClient
$idUrl = "https://api.twitter.com/1/users/show.json?screen_name=$ScreenName"
$data = $client.DownloadString($idUrl)
$start = 0
$findStr = '"id":'
do {
$start = $data.IndexOf($findStr, $start + 1)
if ($start -gt 0) {
$s... |
combined_dataset/train/non-malicious/4154.ps1 | 4154.ps1 |
param
(
[Parameter(Mandatory = $true)][string]$BIOSPassword
)
Function BitLockerSAK {
[cmdletBinding()]
Param (
[Switch]$IsTPMActivated,
[Switch]$IsTPMEnabled,
[Switch]$IsTPMOwnerShipAllowed,
[Switch]$ResumeEncryption,
[Switch]$GetEncryptionState,
[Switch]$GetProtectionStatus,
[switch]$Encrypt,
[... |
combined_dataset/train/non-malicious/sample_38_21.ps1 | sample_38_21.ps1 | #
# Module manifest for module 'OCI.PSModules.Nosql'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Nosql.dll'
# Version number of this module.
ModuleVersion = '81.0.0'
# Supported PSEditions
Compatible... |
combined_dataset/train/non-malicious/1268.ps1 | 1268.ps1 |
function Get-CIisVersion
{
[CmdletBinding()]
param(
)
Set-StrictMode -Version 'Latest'
Use-CallerPreference -Cmdlet $PSCmdlet -Session $ExecutionContext.SessionState
$props = Get-ItemProperty hklm:\Software\Microsoft\InetStp
return $props.MajorVersion.ToString() + "." + $props.Minor... |
combined_dataset/train/non-malicious/2367.ps1 | 2367.ps1 | $aOutput = @();
$aDisabledGpos = Get-GPO -All | Where-Object { $_.GpoStatus -eq 'AllSettingsDisabled' };
foreach ($oGpo in $aDisabledGpos) {
$oOutput = New-Object System.Object;
$oOutput | Add-Member -type NoteProperty -Name 'Status' -Value 'Disabled';
$oOutput | Add-Member -type NoteProperty -Name 'Name' -Value $oG... |
combined_dataset/train/non-malicious/2292.ps1 | 2292.ps1 |
[CmdletBinding(SupportsShouldProcess=$true)]
param(
[parameter(Mandatory=$true, HelpMessage="Specify the user principal name to amend the password expire policy on")]
[ValidateNotNullOrEmpty()]
[ValidatePattern("^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$")]
[string]$UserPrincipalName,
[parameter(Manda... |
combined_dataset/train/non-malicious/Import-Certificate_2.ps1 | Import-Certificate_2.ps1 | #requires -Version 2.0
function Import-Certificate
{
param
(
[IO.FileInfo] $CertFile = $(throw "Paramerter -CertFile [System.IO.FileInfo] is required."),
[string[]] $StoreNames = $(throw "Paramerter -StoreNames [System.String] is required."),
[switch] $LocalMachine,
[switch] $CurrentUser,
[string... |
combined_dataset/train/non-malicious/sample_41_37.ps1 | sample_41_37.ps1 | #########################################################################################
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# Localized PackageManagement.Resources.psd1
#
#########################################################################################
ConvertFrom-StringDa... |
combined_dataset/train/non-malicious/sample_16_5.ps1 | sample_16_5.ps1 | #
# Module manifest for module 'OCI.PSModules.Ailanguage'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Ailanguage.dll'
# Version number of this module.
ModuleVersion = '75.1.0'
# Supported PSEditions
... |
combined_dataset/train/non-malicious/ISEFun.psm1.ps1 | ISEFun.psm1.ps1 | # Module version 0.1
# Author: Bartek Bielawski (@bielawb on twitter)
# Purpose: Add functionality to PowerShell ISE
# Description: Adds Add-ons menu 'ISEFun' with all functions included.
# User can add any action there using Add-MyMenuItem function
# One of functions (Copy item from history) was build using... |
combined_dataset/train/non-malicious/sample_14_85.ps1 | sample_14_85.ps1 | #
# Module manifest for module 'OCI.PSModules.Database'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Database.dll'
# Version number of this module.
ModuleVersion = '81.0.0'
# Supported PSEditions
Comp... |
combined_dataset/train/non-malicious/sample_41_34.ps1 | sample_41_34.ps1 |
# ----------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the Licen... |
combined_dataset/train/non-malicious/sample_8_24.ps1 | sample_8_24.ps1 | ConvertFrom-StringData @'
id_printdevmodes2countcheck_st=There are several printers listed under HKU\\.DEFAULT\\Printers\\DevModes2
'@
# SIG # Begin signature block
# MIIoKgYJKoZIhvcNAQcCoIIoGzCCKBcCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAA... |
combined_dataset/train/non-malicious/3560.ps1 | 3560.ps1 |
$suffix="v2avm1"
$JobQueryWaitTimeInSeconds = 0
$PrimaryFabricName = "V2A-W2K12-400"
$PrimaryNetworkFriendlyName = "corp"
$RecoveryNetworkFriendlyName = "corp"
$NetworkMappingName = "corp96map"
$RecoveryPlanName = "RPSwag96" + $suffix
$policyName1 = "V2aTest" + $suffix
$policyName2 = "V2aTest"+ $suffix+... |
combined_dataset/train/non-malicious/LibraryMSCS_2.ps1 | LibraryMSCS_2.ps1 | # ------------------------------------------------------------------------
### <Script>
### <Author>
### Chad Miller
### </Author>
### <Description>
### Defines functions for working with Microsoft Cluster Service (MSCS)
### </Description>
### <Usage>
### . ./LibraryMSCS.ps1
### </Usage>
### </Script>
# --... |
combined_dataset/train/non-malicious/442.ps1 | 442.ps1 | Register-PSFConfigValidation -Name "consolecolor" -ScriptBlock {
Param (
$Value
)
$Result = New-Object PSObject -Property @{
Success = $True
Value = $null
Message = ""
}
try { [System.ConsoleColor]$color = $Value }
catch
{
$Result.Message = "Not a console color: $Value"
$Result.Success = $False... |
combined_dataset/train/non-malicious/sample_40_42.ps1 | sample_40_42.ps1 | #
# Module manifest for module 'OCI.PSModules.Ocicontrolcenter'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Ocicontrolcenter.dll'
# Version number of this module.
ModuleVersion = '82.0.0'
# Supported... |
combined_dataset/train/non-malicious/0ddea161-baf2-439c-b797-afb5c636692f.ps1 | 0ddea161-baf2-439c-b797-afb5c636692f.ps1 | #Variables
$Date = Get-Date
$TempReport = $env:TEMP + "\\temp.csv"
$FinalReport = $env:USERPROFILE + "\\" + $Date.Year + "_" + $Date.Month + "_" + $Date.Day + "_" + $Date.Hour + ":" + $Date.Minute + "_Scheduled_Task_Report.csv"
$title = Write-Host "Scheduled Task Reporter" -ForegroundColor green
$message = Write... |
combined_dataset/train/non-malicious/sample_64_65.ps1 | sample_64_65.ps1 | # dot-source all function files
Get-ChildItem -Path $PSScriptRoot | Unblock-File
Get-ChildItem -Path $PSScriptRoot\*.ps1 -Exclude ServiceFabricSDK.ps1 | Foreach-Object{ . $_.FullName }
# SIG # Begin signature block
# MIInkwYJKoZIhvcNAQcCoIInhDCCJ4ACAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI... |
combined_dataset/train/non-malicious/1649.ps1 | 1649.ps1 |
| : |
| : |
$ a = " < |