Skip to content

Commit

Permalink
Prepare for initial PSGallery release.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidski committed Dec 22, 2016
1 parent 8117583 commit e3eb6dc
Show file tree
Hide file tree
Showing 17 changed files with 326 additions and 237 deletions.
227 changes: 0 additions & 227 deletions Nessus.psm1

This file was deleted.

45 changes: 35 additions & 10 deletions Nessus.psd1 → PSNessus/PSNessus.psd1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Module manifest for module 'Nessus'
# Module manifest for module 'PSNessus'
#
# Generated by: David F. Severski
#
Expand All @@ -9,7 +9,7 @@
@{

# Script module or binary module file associated with this manifest.
RootModule = 'Nessus.psm1'
RootModule = 'PSNessus.psm1'

# Version number of this module.
ModuleVersion = '1.0'
Expand All @@ -21,13 +21,13 @@ GUID = 'fcbc8e15-c80d-4658-92f4-d57d35a6348b'
Author = 'David F. Severski'

# Company or vendor of this module
CompanyName = "Seattle Children's"
CompanyName = "NA"

# Copyright statement for this module
Copyright = "(c) 2015 Seattle Children's. All rights reserved."
Copyright = "(c) 2016 David F. Severski. All rights reserved."

# Description of the functionality provided by this module
# Description = ''
Description = 'PowerShell interface for the Tenable Nessus scanner.'

# Minimum version of the Windows PowerShell engine required by this module
# PowerShellVersion = '2.0'
Expand Down Expand Up @@ -66,16 +66,19 @@ Copyright = "(c) 2015 Seattle Children's. All rights reserved."
# NestedModules = @()

# Functions to export from this module
FunctionsToExport = '*'
FunctionsToExport = 'Connect-Nessus', 'Disconnect-Nessus', 'Export-NessusHistory',
'Export-NessusStatus', 'Get-NessusExportFile', 'Get-NessusHistoryIds',
'Get-NessusPolicies', 'Get-NessusScanHistory', 'Get-NessuScans',
'Send-NessusRequest', 'Start-NessusScan'

# Cmdlets to export from this module
CmdletsToExport = '*'
CmdletsToExport = ''

# Variables to export from this module
VariablesToExport = '*'
VariablesToExport = ''

# Aliases to export from this module
AliasesToExport = '*'
AliasesToExport = ''

# List of all modules packaged with this module.
# ModuleList = @()
Expand All @@ -84,7 +87,29 @@ AliasesToExport = '*'
# FileList = @()

# Private data to pass to the module specified in RootModule/ModuleToProcess
# PrivateData = ''
PrivateData = @{

PSData = @{

# Tags applied to this module. These help with module discovery in online galleries.
Tags = 'tenable', 'nessus', 'security', 'network', 'api', 'vulnerabilty'

# A URL to the license for this module.
LicenseUri = 'https://github.com/davidski/PSNessus/LICENSE'

# A URL to the main website for this project.
ProjectUri = 'https://github.com/davidski/PSNessus'

# A URL to an icon representing this module.
# IconUri = ''

# ReleaseNotes of this module
# ReleaseNotes = ''

} # End of PSData hashtable

} # End of PrivateData hashtable


# HelpInfo URI of this module
# HelpInfoURI = ''
Expand Down
20 changes: 20 additions & 0 deletions PSNessus/PSNessus.psm1
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#Get public and private function definition files.
$Public = @( Get-ChildItem -Path $PSScriptRoot\public\*.ps1 -ErrorAction SilentlyContinue )
$Private = @( Get-ChildItem -Path $PSScriptRoot\private\*.ps1 -ErrorAction SilentlyContinue )

#Dot source the files
Foreach($import in @($Public + $Private))
{
Try
{
. $import.fullname
}
Catch
{
Write-Error -Message "Failed to import function $($import.fullname): $_"
}
}

#$script:servername = "localhost"

Export-ModuleMember -Function $Public.Basename
10 changes: 10 additions & 0 deletions PSNessus/PSScriptAnalyzerSettings.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# PSScriptAnalyzerSettings.psd1
@{
Severity=@('Error','Warning')
ExcludeRules=@('PSAvoidUsingCmdletAliases',
'PSAvoidUsingUserNameAndPassWordParams',
'PSShouldProcess',
'PSAvoidUsingPlainTextForPassword',
'PSUseShouldProcessForStateChangingFunctions',
'PSUseSingularNouns')
}
25 changes: 25 additions & 0 deletions PSNessus/private/Add.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
function Add() {
[CmdletBinding()]
param(
[Parameter(Mandatory=$true, Position=0, valuefromPipeline=$true)]
[string] $name,
[Parameter(Mandatory=$true, Position=1, valuefromPipeline=$true)]
[string] $desc,
[Parameter(Mandatory=$true, Position=2, valuefromPipeline=$true)]
[string] $targets,
[Parameter(Mandatory=$true, Position=3, valuefromPipeline=$true)]
[string] $policy
)
$settings = @{}
$settings.Add("name", $name)
$settings.Add("description", $desc)
$settings.Add("text_targets", $targets)

$data = @{}
$data.Add("uuid", $policy)
$data.Add("settings", $settings)

$resp = Send-NessusRequest "Post" "/scans" $data

return $resp.scan
}
13 changes: 13 additions & 0 deletions PSNessus/public/Connect-Nessus.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
function Connect-Nessus() {
[CmdletBinding()]
param(
[Parameter(Mandatory=$true, Position=0, valuefromPipeline=$true)]
[string] $username,
[Parameter(Mandatory=$true, Position=1, valuefromPipeline=$true)]
[string] $password
)
$data = @{"username" = $username; "password" = $password}
$resp = Send-NessusRequest "Post" "/session" $data

return $resp.token
}
4 changes: 4 additions & 0 deletions PSNessus/public/Disconnect-Nessus.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function Disconnect-Nessus{
$resp = Send-NessusRequest "Delete" "/session"
$resp
}
Loading

0 comments on commit e3eb6dc

Please sign in to comment.