Skip to content

Commit

Permalink
Added PoshPath
Browse files Browse the repository at this point in the history
  • Loading branch information
benpturner committed Sep 4, 2017
1 parent 7cf724b commit a407984
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion C2-Installer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ if ($downloaded) {
[System.IO.File]::WriteAllBytes("$($installpath)PowershellC2\Start-C2-Server.lnk", $bytes)

$SourceExe = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
$ArgumentsToSourceExe = "-exec bypass -c import-module ${poshpath}C2-Viewer.ps1; c2-viewer"
$ArgumentsToSourceExe = "-exec bypass -c import-module ${poshpath}C2-Viewer.ps1; c2-viewer -poshpath ${poshpath}"
$DestinationPath = "$($installpath)PowershellC2\Start-C2-Viewer.lnk"
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut($DestinationPath)
Expand Down
10 changes: 8 additions & 2 deletions C2-Viewer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,18 @@ function C2-Viewer
(
[Parameter(ParameterSetName = "FolderPath", Mandatory = $false)]
[string]
$FolderPath
$FolderPath,
[string]
$PoshPath
)
if (!$FolderPath) {
$FolderPath = Read-Host -Prompt `n'Enter the root folder path of the Database/Project'
# do you want a read-only c2 server window
}
if (!$PoshPath) {
$PoshPath = Read-Host -Prompt `n'Enter the PoshC2 path'
# do you want a read-only c2 server window
}
$slash = $FolderPath -match '.+[^\\]\\$'
if ($slash) {
$FolderPath = $FolderPath.TrimEnd('\')
Expand All @@ -42,7 +48,7 @@ function C2-Viewer
# initiate defaults
$Database = "$FolderPath\PowershellC2.SQLite"
$p = $env:PsModulePath
$p += ";C:\temp\PowershellC2\"
$p += ";$PoshPath"

[Environment]::SetEnvironmentVariable("PSModulePath",$p)
Import-Module -Name PSSQLite
Expand Down

0 comments on commit a407984

Please sign in to comment.