├── .gitignore ├── File Management ├── copyfile.ps1 ├── filechanges.ps1 └── monitor-file.ps1 ├── LICENSE ├── Network └── monitorports.ps1 ├── Patch Management ├── kb2953095-office2k3.ps1 ├── kb2963983-vmlfix.ps1 ├── waucheck.ps1 └── wauremove.ps1 ├── README.md ├── SecIISMonitor.ps1 ├── System Information ├── getdrivestest.ps1 ├── installedprograms.ps1 ├── listnetversions.ps1 ├── monitor-startupprograms.ps1 ├── remotearchlist.ps1 ├── runningprograms.ps1 └── startupprograms.ps1 ├── Template └── psftemplate.ps1 ├── helloworld.ps1 ├── hoststest.ps1 ├── infiniteloop.ps1 ├── psfcommandtest.ps1 ├── psftest ├── psftest.ps1 ├── psftest.psm1 └── test.ps1 /.gitignore: -------------------------------------------------------------------------------- 1 | # Build Folders (you can keep bin if you'd like, to store dlls and pdbs) 2 | [Bb]in/ 3 | [Oo]bj/ 4 | 5 | # mstest test results 6 | TestResults 7 | 8 | ## Ignore Visual Studio temporary files, build results, and 9 | ## files generated by popular Visual Studio add-ons. 10 | 11 | # User-specific files 12 | *.suo 13 | *.user 14 | *.sln.docstates 15 | 16 | # Build results 17 | [Dd]ebug/ 18 | [Rr]elease/ 19 | x64/ 20 | *_i.c 21 | *_p.c 22 | *.ilk 23 | *.meta 24 | *.obj 25 | *.pch 26 | *.pdb 27 | *.pgc 28 | *.pgd 29 | *.rsp 30 | *.sbr 31 | *.tlb 32 | *.tli 33 | *.tlh 34 | *.tmp 35 | *.log 36 | *.vspscc 37 | *.vssscc 38 | .builds 39 | 40 | # Visual C++ cache files 41 | ipch/ 42 | *.aps 43 | *.ncb 44 | *.opensdf 45 | *.sdf 46 | 47 | # Visual Studio profiler 48 | *.psess 49 | *.vsp 50 | *.vspx 51 | 52 | # Guidance Automation Toolkit 53 | *.gpState 54 | 55 | # ReSharper is a .NET coding add-in 56 | _ReSharper* 57 | 58 | # NCrunch 59 | *.ncrunch* 60 | .*crunch*.local.xml 61 | 62 | # Installshield output folder 63 | [Ee]xpress 64 | 65 | # DocProject is a documentation generator add-in 66 | DocProject/buildhelp/ 67 | DocProject/Help/*.HxT 68 | DocProject/Help/*.HxC 69 | DocProject/Help/*.hhc 70 | DocProject/Help/*.hhk 71 | DocProject/Help/*.hhp 72 | DocProject/Help/Html2 73 | DocProject/Help/html 74 | 75 | # Click-Once directory 76 | publish 77 | 78 | # Publish Web Output 79 | *.Publish.xml 80 | 81 | # NuGet Packages Directory 82 | packages 83 | 84 | # Windows Azure Build Output 85 | csx 86 | *.build.csdef 87 | 88 | # Windows Store app package directory 89 | AppPackages/ 90 | 91 | # Others 92 | [Bb]in 93 | [Oo]bj 94 | sql 95 | TestResults 96 | [Tt]est[Rr]esult* 97 | *.Cache 98 | ClientBin 99 | [Ss]tyle[Cc]op.* 100 | ~$* 101 | *.dbmdl 102 | Generated_Code #added for RIA/Silverlight projects 103 | 104 | # Backup & report files from converting an old project file to a newer 105 | # Visual Studio version. Backup files are not needed, because we have git ;-) 106 | _UpgradeReport_Files/ 107 | Backup*/ 108 | UpgradeLog*.XML 109 | [Ss]chedule.xml 110 | -------------------------------------------------------------------------------- /File Management/copyfile.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .DESCRIPTION 3 | Copies a file to all selected hosts in the Systems tab. 4 | 5 | AUTHOR 6 | Ben0xA 7 | 8 | .PARAMETER sourcefile 9 | The source file to copy to the remote hosts. 10 | 11 | .PARAMETER destination 12 | The share name and folder on the remote host. 13 | 14 | .PARAMETER force 15 | This will attempt to copy the file even if the host appears down. 16 | 17 | .NOTES 18 | psfilename=sourcefile 19 | #> 20 | 21 | Param( 22 | [Parameter(Mandatory=$true,Position=1)] 23 | [string]$sourcefile, 24 | 25 | [Parameter(Mandatory=$false,Position=2)] 26 | [string]$destination="C$\Windows\Temp\", 27 | 28 | [Parameter(Mandatory=$false,Position=3)] 29 | [switch]$force 30 | ) 31 | 32 | #Start your code here. 33 | $hosts = $PSHosts.GetHosts() 34 | 35 | $results = @() 36 | 37 | if($hosts.Count -gt 0) { 38 | if(Test-Path $sourcefile) { 39 | foreach($h in $hosts) { 40 | $PSStatus.Update("Copying file to $($h.Name), please wait...") 41 | $rmtfolder = "\\$($h.Name)\$($destination)\" 42 | $copyitm = New-Object PSObject 43 | $copyitm | Add-Member -MemberType NoteProperty -Name "Computer" -Value $h.Name 44 | $copyitm | Add-Member -MemberType NoteProperty -Name "Source File" -Value $sourcefile 45 | $copyitm | Add-Member -MemberType NoteProperty -Name "Destination" -Value $rmtfolder 46 | if($force -or $h.Status -eq "Up"){ 47 | try 48 | { 49 | if(!(Test-Path -path $rmtfolder)) { 50 | New-Item $rmtfolder -Type Directory 51 | } 52 | Copy-Item $sourcefile $rmtfolder -recurse -force 53 | $copyitm | Add-Member -MemberType NoteProperty -Name "Result" -Value "Copied" 54 | } 55 | catch { 56 | $copyitm | Add-Member -MemberType NoteProperty -Name "Result" -Value "Failed!" 57 | } 58 | } 59 | else { 60 | $copyitm | Add-Member -MemberType NoteProperty -Name "Result" -Value "Host is down." 61 | } 62 | $results += $copyitm 63 | } 64 | $PSTab.AddObjectGrid($results, "Copy File Results") 65 | } 66 | else { 67 | Write-Output "Unable to locate $sourcefile. Please check the path and try again." 68 | } 69 | } 70 | #End Script -------------------------------------------------------------------------------- /File Management/filechanges.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .DESCRIPTION 3 | Checks a file for any changes froom a baseline and displays the 4 | change in the alerts area. 5 | 6 | AUTHOR 7 | Ben0xA 8 | 9 | .PARAMETER filename 10 | The file path to the file to monitor. 11 | 12 | .PARAMETER baselinefile 13 | The file path to the baseline file. 14 | 15 | .NOTES 16 | psfilename=filename,psfilename=baselinefile 17 | #> 18 | 19 | Param( 20 | [Parameter(Mandatory=$true,Position=1)] 21 | [string]$filename, 22 | 23 | [Parameter(Mandatory=$true,Position=2)] 24 | [string]$baselinefile 25 | ) 26 | 27 | #Start your code here. 28 | $baseline = "" 29 | if(test-path $baselinefile) { 30 | $PSStatus.Update("Getting baseline contents, please wait...") 31 | $baseline = Get-Content $baselinefile 32 | } 33 | if(test-path $filename) { 34 | $PSStatus.Update("Getting current contents of the file, please wait...") 35 | if($baseline -eq "") { 36 | if($baselinefile -ne "") { 37 | Get-Content $filename | Out-File $baselinefile 38 | } 39 | $PSAlert.Add("Baseline file created.", 0) 40 | } 41 | else { 42 | $PSStatus.Update("Getting updates, please wait...") 43 | $curcontent = Get-Content $filename 44 | $diff = Compare-Object $baseline $curcontent 45 | $curcontent | Out-File $baselinefile 46 | if($diff) { 47 | foreach($line in $diff) { 48 | [int]$alertlevel = 0 49 | if($line -notlike "*INFORMATIONAL*") { 50 | if($line -like "*ERROR*") { 51 | $alertlevel = 1 52 | } 53 | elseif($line -like "*WARNING*") { 54 | $alertlevel = 2 55 | } 56 | elseif($line -like "*SEVERE*") { 57 | $alertlevel = 3 58 | } 59 | elseif($line -like "*CRITICAL*") { 60 | $alertlevel = 4 61 | } 62 | $PSAlert.Add($line.InputObject, $alertlevel) 63 | } 64 | } 65 | } 66 | } 67 | } -------------------------------------------------------------------------------- /File Management/monitor-file.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .DESCRIPTION 3 | Monitors a file for any changes and displays the change in the 4 | alerts area. 5 | 6 | AUTHOR 7 | Ben0xA 8 | 9 | .PARAMETER filename 10 | The file path to the file to monitor. 11 | 12 | .NOTES 13 | psfilename=filename 14 | #> 15 | 16 | Param( 17 | [Parameter(Mandatory=$true,Position=1)] 18 | [string]$filename 19 | ) 20 | 21 | #Start your code here. 22 | $baseline = "" 23 | [date]$lastwrite = "01/01/1900 00:00AM" 24 | [boolean]$monitor = $True; 25 | 26 | $PSStatus.Update("Getting current contents of the file, please wait...") 27 | if(test-path $filename) { 28 | $baseline = Get-Content $filename 29 | $PSStatus.Update("Pausing for 2 seconds") 30 | Start-Sleep -s 2 31 | do { 32 | $fil = Get-ChildItem $filename 33 | if($fil.LastWriteTime -gt $lastwrite) { 34 | $lastwrite = $fil.LastWriteTime 35 | $PSStatus.Update("Getting updates, please wait...") 36 | $curcontent = Get-Content $filename 37 | $diff = Compare-Object $baseline $curcontent 38 | $baseline = Get-Content $filename 39 | if($diff) { 40 | foreach($line in $diff) { 41 | [int]$alertlevel = 0 42 | if($line -notlike "*INFORMATIONAL*") { 43 | if($line -like "*ERROR*") { 44 | $alertlevel = 1 45 | } 46 | elseif($line -like "*WARNING*") { 47 | $alertlevel = 2 48 | } 49 | elseif($line -like "*SEVERE*") { 50 | $alertlevel = 3 51 | } 52 | elseif($line -like "*CRITICAL*") { 53 | $alertlevel = 4 54 | } 55 | $PSAlert.Add($line.InputObject, $alertlevel) 56 | } 57 | } 58 | } 59 | } 60 | else { 61 | $PSStatus.Update("Nothing to update.") 62 | } 63 | $PSStatus.Update("Pausing for 2 seconds") 64 | Start-Sleep -s 2 65 | } while ($monitor) 66 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | {description} 294 | Copyright (C) {year} {fullname} 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /Network/monitorports.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .DESCRIPTION 3 | This script is for active monitoring of ports on a specified machine. 4 | 5 | FRAMEWORK 6 | PoshSec Framework 7 | 8 | FRAMEWORKVERSION 9 | 0.2.0.0 10 | 11 | AUTHOR 12 | Ben0xA 13 | #> 14 | Param( 15 | [Parameter(Mandatory=$false,Position=1)] 16 | [string]$computer="" 17 | ) 18 | 19 | #Required to use PoshSec functions 20 | Import-Module $PSModRoot\PoshSec 21 | 22 | [boolean]$scan = $True; 23 | $baseline = @() 24 | $active = @() 25 | 26 | #these are the ports that will raise an alert regardless of whitelists 27 | $remoteportalert = @(4444) 28 | $localportalert = @(4444) 29 | 30 | #these are the ports to allow and will not raise an alert 31 | $remoteportwhitelist = @(0,995,80,443) 32 | 33 | #these are the process names or IDs that will not raise an alert 34 | #example $processwhitelist = @("firefox", "Idle", 0) 35 | $processwhitelist = @("Idle", "0") 36 | 37 | #these are the ips that will not raise an alert 38 | #example $localipwhitelist = @("192.168.1.1", "127.0.0.1") 39 | $localipwhitelist = @("127.0.0.1") 40 | $remoteipwhitelist = @("127.0.0.1") 41 | 42 | $compname = $computer 43 | if($computer -eq "") { 44 | $compname = Get-Content env:ComputerName 45 | } 46 | 47 | $PSStatus.Update("Setting a baseline on $compname.") 48 | $baseline = Get-SecOpenPorts $computer 49 | do 50 | { 51 | $PSStatus.Update("Pausing for 2 seconds") 52 | Start-Sleep -s 2 53 | 54 | $PSStatus.Update("Getting current ports on $compname.") 55 | $active = Get-SecOpenPorts $computer 56 | 57 | $rslts = Compare-SecOpenPort $baseline $active 58 | 59 | foreach($rslt in $rslts) 60 | { 61 | if(($rslt.SideIndicator -eq "=>") -and 62 | ( 63 | ( 64 | ($remoteportwhitelist -notcontains $rslt.InputObject.RemotePort) -and 65 | ($processwhitelist -notcontains $rslt.InputObject.ProcessName) -and 66 | ($localipwhitelist -notcontains $rslt.InputObject.LocalAddress) -and 67 | ($remoteipwhitelist -notcontains $rslt.InputObject.RemoteAddress) 68 | ) -or 69 | ($remoteportalert -contains $rslt.InputObject.RemotePort) -or 70 | ($localportalert -contains $rslt.InputObject.LocalPort) 71 | ) 72 | ) 73 | { 74 | $protocol = $rslt.InputObject.Protocol 75 | $local = $rslt.InputObject.LocalAddress + ":" + $rslt.InputObject.LocalPort 76 | $remote = $rslt.InputObject.RemoteAddress + ":" + $rslt.InputObject.RemotePort 77 | $pname = $rslt.InputObject.ProcessName 78 | $state = $rslt.InputObject.State 79 | 80 | $PSAlert.Add("[$compname]Port $($state): $protocol $($local)<=>$($remote) ($pname)", 2) 81 | $baseline += $rslt.InputObject 82 | } 83 | elseif(($rslt.SideIndicator -eq "<=") -and 84 | ( 85 | ( 86 | ($remoteportwhitelist -notcontains $rslt.InputObject.RemotePort) -and 87 | ($processwhitelist -notcontains $rslt.InputObject.ProcessName) -and 88 | ($localipwhitelist -notcontains $rslt.InputObject.LocalAddress) -and 89 | ($remoteipwhitelist -notcontains $rslt.InputObject.RemoteAddress) 90 | ) -or 91 | ($remoteportalert -contains $rslt.InputObject.RemotePort) -or 92 | ($localportalert -contains $rslt.InputObject.LocalPort) 93 | ) 94 | ) 95 | { 96 | $protocol = $rslt.InputObject.Protocol 97 | $local = $rslt.InputObject.LocalAddress + ":" + $rslt.InputObject.LocalPort 98 | $remote = $rslt.InputObject.RemoteAddress + ":" + $rslt.InputObject.RemotePort 99 | $pname = $rslt.InputObject.ProcessName 100 | 101 | $PSAlert.Add("[$compname]Port Closed: $protocol $($local)<=>$($remote) ($pname)",0) 102 | 103 | # You can't remove items from an array. You have to rebuild it. 104 | [int]$blidx = 0 105 | $newbl = @() 106 | $rsobj = $rslt.InputObject 107 | $rsstr = $rsobj.Protocol + $rsobj.LocalAddress + $rsobj.LocalPort + $rsobj.RemoteAddress + $rsobj.RemotePort + $rsobj.ProcessName 108 | do 109 | { 110 | $blobj = $baseline[$blidx] 111 | $blstr = $blobj.Protocol + $blobj.LocalAddress + $blobj.LocalPort + $blobj.RemoteAddress + $blobj.RemotePort + $blobj.ProcessName 112 | if($blstr -ne $rsstr) 113 | { 114 | $newbl += $blobj 115 | } 116 | $blidx++ 117 | } while (($blidx -lt $baseline.count)) 118 | $baseline = $newbl 119 | $newbl = $null 120 | } 121 | } 122 | } while ($scan) 123 | 124 | 125 | #End Script -------------------------------------------------------------------------------- /Patch Management/kb2953095-office2k3.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .DESCRIPTION 3 | Scan for CVE-2014-1761. 4 | 5 | Will Query the selected hosts to see if they have Office 2003 6 | installed. If they do, it will iterate each account to see if 7 | that account under HKEY_CURRENT_USER has the DWORD of RtfFiles 8 | set to 1 under 9 | HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Word\Security\FileOpenBlock 10 | 11 | REQUIRES 12 | PoshSec Modules: Get-RemoteRegistry, Get-RemoteRegistryKey, Get-RemoteRegistryValue 13 | Download from here -> https://github.com/PoshSec/PoshSec/tree/development 14 | 15 | ADVISORIES 16 | https://technet.microsoft.com/en-us/security/advisory/2953095 17 | 18 | CVE-2014-1761 19 | KB2953095 20 | 21 | NOTES 22 | This is for Office 2003 only. For later versions use GPO or 23 | Plan File Blocking. 24 | 25 | See http://technet.microsoft.com/library/cc179230 26 | 27 | AUTHOR 28 | Ben0xA 29 | 30 | .PARAMETER showintab 31 | Specifies whether to show the results in a PoshSec Framework Tab. 32 | 33 | .PARAMETER storedhosts 34 | This is for storing hosts from the framework for scheduling. 35 | 36 | .PARAMETER applyfix 37 | Specifies whether to apply the DWORD fix to 1 to block RTF Files. 38 | 39 | .NOTES 40 | pshosts=storedhosts 41 | #> 42 | 43 | Param( 44 | [Parameter(Mandatory=$false,Position=1)] 45 | [boolean]$showintab=$True, 46 | 47 | [Parameter(Mandatory=$false,Position=2)] 48 | [string]$storedhosts, 49 | 50 | [Parameter(Mandatory=$false,Position=3)] 51 | [boolean]$applyfix=$false 52 | ) 53 | #Required to use PoshSec functions 54 | Import-Module $PSModRoot\PoshSec 55 | 56 | if($storedhosts) { 57 | #The storedhosts have been serialized as a string 58 | #Before we use them we need to deserialize. 59 | $hosts = $PSHosts.DeserializeHosts($storedhosts) 60 | } 61 | else { 62 | $hosts = $PSHosts.GetHosts() 63 | } 64 | 65 | $hoststats = @() 66 | 67 | if($hosts) { 68 | foreach($h in $hosts) { 69 | $PSStatus.Update("Querying $($h.Name), please wait...") 70 | 71 | $profiles = $null 72 | try { 73 | #checks to see if the box will even respond to a RPC call 74 | #this will return all Profiles for HKEY_USERS 75 | $profiles = Get-RemoteRegistryKey $h.Name 3 "Software\Microsoft\Windows NT\CurrentVersion\ProfileList" 76 | } 77 | catch { 78 | $profiles = $null 79 | } 80 | 81 | $keys = @() 82 | if($profiles) { 83 | foreach($profile in $profiles) { 84 | if($profile.Key -like "S-1-5-21*") { 85 | #attempt to see if they have Word 2003 installed 86 | $key = Get-RemoteRegistryKey $h.Name 4 "$($profile.Key)\Software\Microsoft\Office\11.0\Word\" 87 | if($key) { 88 | $keys += $profile.Key 89 | } 90 | } 91 | } 92 | if($keys) { 93 | foreach($key in $keys) { 94 | #the path to the Key for RtfFiles:DWORD 95 | $hkpath = "$($key)\Software\Microsoft\Office\11.0\Word\Security\FileOpenBlock\" 96 | $blockrtfdword = Get-RemoteRegistryValue $h.Name 4 $hkpath 97 | $hoststat = New-Object PSObject 98 | $hoststat | Add-Member -MemberType NoteProperty -Name "Computer" -Value $h.Name 99 | $hoststat | Add-Member -MemberType NoteProperty -Name "Word2003Installed" -Value "True" 100 | $hoststat | Add-Member -MemberType NoteProperty -Name "Profile" -Value $key 101 | $blocking = $false 102 | if($blockrtfdword) { 103 | if($blockrtfdword.Name -eq "RtfFiles" -and $blockrtfdword.Value -eq 1) { 104 | #the DWORD exists and is already set to block 105 | $blocking = $true 106 | } 107 | } 108 | if($blocking) { 109 | $hoststat | Add-Member -MemberType NoteProperty -Name "BlockingRTF" -Value "True" 110 | $hoststat | Add-Member -MemberType NoteProperty -Name "AppliedBlock" -Value "" 111 | } 112 | else { 113 | $hoststat | Add-Member -MemberType NoteProperty -Name "BlockingRTF" -Value "False" 114 | if($applyfix) { 115 | $reg = Get-RemoteRegistry $h.Name 116 | if(!$blockrtfdword) { 117 | #the DWORD does not exist. Create it and the path 118 | $rslt = $reg.CreateKey(2147483651, $hkpath) 119 | } 120 | #change the DWORD value to 1 121 | $rslt = $reg.SetDWORDValue(2147483651, $hkpath, "RtfFiles", 1) 122 | $reg = $null 123 | } 124 | 125 | #this is a sanity check to ensure that the previous applyfix (if enabled) 126 | #worked 127 | $blockrtfdword = Get-RemoteRegistryValue $h.Name 4 $hkpath 128 | if($blockrtfdword) { 129 | if($blockrtfdword.Name -eq "RtfFiles" -and $blockrtfdword.Value -eq 1) { 130 | $blocking = $true 131 | } 132 | } 133 | if($blocking) { 134 | $hoststat | Add-Member -MemberType NoteProperty -Name "AppliedBlock" -Value "True" 135 | } 136 | else { 137 | $hoststat | Add-Member -MemberType NoteProperty -Name "AppliedBlock" -Value "False" 138 | } 139 | } 140 | $hoststats += $hoststat 141 | } 142 | } 143 | else { 144 | #word 2003 was not installed. nothing left to do. 145 | $hoststat = New-Object PSObject 146 | $hoststat | Add-Member -MemberType NoteProperty -Name "Computer" -Value $h.Name 147 | $hoststat | Add-Member -MemberType NoteProperty -Name "Word2003Installed" -Value "False" 148 | $hoststat | Add-Member -MemberType NoteProperty -Name "Profile" -Value "" 149 | $hoststat | Add-Member -MemberType NoteProperty -Name "BlockingRTF" -Value "" 150 | $hoststat | Add-Member -MemberType NoteProperty -Name "AppliedBlock" -Value "" 151 | $hoststats += $hoststat 152 | } 153 | } 154 | else { 155 | $PSAlert.Add("Unable to connect to $($h.Name)", 2) 156 | } 157 | } 158 | 159 | if($hoststats) { 160 | if($showintab) { 161 | $PSTab.AddObjectGrid($hoststats, "KB2953095 Results") 162 | Write-Output "KB2953095 Results Tab Created." 163 | } 164 | else { 165 | $hoststats | Out-String 166 | } 167 | } 168 | else { 169 | Write-Output "Unable to find any hosts." 170 | } 171 | } 172 | else { 173 | Write-Output "Please select the hosts in the Systems tab to scan." 174 | } 175 | 176 | #End Script -------------------------------------------------------------------------------- /Patch Management/kb2963983-vmlfix.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .DESCRIPTION 3 | Unregister VGX fix for CVE-2014-1776. 4 | 5 | Will run the following command on the selected hosts: 6 | regsvr32.exe -u \"%CommonProgramFiles%\Microsoft Shared\VGX\vgx.dll" 7 | 8 | REQUIRES 9 | PoshSec Modules: Invoke-RemoteWmiProcess 10 | Download from here -> https://github.com/PoshSec/PoshSec/tree/master 11 | 12 | ADVISORIES 13 | https://technet.microsoft.com/library/security/2963983 14 | 15 | CVE-2014-1776 16 | KB2963983 17 | 18 | AUTHOR 19 | Ben0xA 20 | 21 | .PARAMETER showintab 22 | Specifies whether to show the results in a PoshSec Framework Tab. 23 | 24 | .PARAMETER storedhosts 25 | This is for storing hosts from the framework for scheduling. 26 | 27 | .NOTES 28 | pshosts=storedhosts 29 | #> 30 | 31 | Param( 32 | [Parameter(Mandatory=$false,Position=1)] 33 | [boolean]$showintab=$True, 34 | 35 | [Parameter(Mandatory=$false,Position=2)] 36 | [string]$storedhosts 37 | ) 38 | #Required to use PoshSec functions 39 | Import-Module $PSModRoot\PoshSec 40 | 41 | if($storedhosts) { 42 | #The storedhosts have been serialized as a string 43 | #Before we use them we need to deserialize. 44 | $hosts = $PSHosts.DeserializeHosts($storedhosts) 45 | } 46 | else { 47 | $hosts = $PSHosts.GetHosts() 48 | } 49 | 50 | $hoststats = @() 51 | 52 | if($hosts) { 53 | foreach($h in $hosts) { 54 | $PSStatus.Update("Applying Fix to $($h.Name), please wait...") 55 | 56 | $result = $null 57 | try { 58 | $result = Invoke-RemoteWmiProcess $h.Name "cmd /c C:\Windows\System32\regsvr32.exe -u -s `"C:\Program Files\Common Files\Microsoft Shared\VGX\vgx.dll`"" -noredirect 59 | } 60 | catch { 61 | $result = $null 62 | } 63 | 64 | $hoststats += $result 65 | } 66 | 67 | if($hoststats) { 68 | if($showintab) { 69 | $PSTab.AddObjectGrid($hoststats, "IE0Day Results") 70 | Write-Output "IE0Day Results Tab Created." 71 | } 72 | else { 73 | $hoststats | Out-String 74 | } 75 | } 76 | else { 77 | Write-Output "Unable to find any hosts." 78 | } 79 | } 80 | else { 81 | Write-Output "Please select the hosts in the Systems tab to scan." 82 | } 83 | 84 | #End Script -------------------------------------------------------------------------------- /Patch Management/waucheck.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .DESCRIPTION 3 | Windows Automatic Update Checker 4 | Written by Ben0xA 5 | With Help from mwjcomputing! 6 | 7 | .PARAMETER kbs 8 | Comma separated values of KB numbers. 9 | 10 | .PARAMETER outputFile 11 | The output file to save results. This will override showintab. 12 | 13 | .PARAMETER omitInstalled 14 | Omits output if the KB is installed. 15 | 16 | .PARAMETER computer 17 | Specifies a single computer to scan. 18 | 19 | .PARAMETER showintab 20 | Specifies whether to show the results in a PoshSec Framework Tab. 21 | 22 | .NOTES 23 | pshosts=storedhosts 24 | #> 25 | 26 | Param( 27 | [Parameter(Mandatory=$true,Position=1)] 28 | [string]$kbs, 29 | 30 | [Parameter(Mandatory=$false,Position=2)] 31 | [string]$outputFile, 32 | 33 | [Parameter(Mandatory=$false,Position=3)] 34 | [boolean]$omitInstalled, 35 | 36 | [Parameter(Mandatory=$false,Position=4)] 37 | [string]$computer, 38 | 39 | [Parameter(Mandatory=$false,Position=5)] 40 | [boolean]$showintab, 41 | 42 | [Parameter(Mandatory=$false,Position=6)] 43 | [string]$storedhosts 44 | ) 45 | 46 | Function Get-Pcs{ 47 | $domain = New-Object System.DirectoryServices.DirectoryEntry 48 | 49 | $ds = New-Object System.DirectoryServices.DirectorySearcher 50 | $ds.SearchRoot = $domain 51 | $ds.Filter = ("(objectCategory=computer)") 52 | $ds.PropertiesToLoad.Add("name") 53 | 54 | $rslts = $ds.FindAll() 55 | return $rslts 56 | } 57 | 58 | Function Get-KBs([string]$pcname){ 59 | $rslts = @() 60 | $qfe = Get-WmiObject -Class Win32_QuickFixEngineering -Computer $pcname -ErrorVariable myerror -ErrorAction SilentlyContinue 61 | if($myerror.count -eq 0) { 62 | foreach($kb in $kbItems){ 63 | $installed = $false 64 | $kbentry = $qfe | Select-String $kb 65 | if($kbentry){ 66 | $installed = $true 67 | } 68 | if($omitInstalled){ 69 | if(-not $installed){ 70 | $rslt = New-Object PSObject 71 | $rslt | Add-Member -MemberType NoteProperty -Name "PC_Name" -Value $pcname 72 | $rslt | Add-Member -MemberType NoteProperty -Name "KB" -Value $kb 73 | $rslt | Add-Member -MemberType NoteProperty -Name "Installed" -Value $installed 74 | $rslts += $rslt 75 | } 76 | } 77 | else { 78 | $rslt = New-Object PSObject 79 | $rslt | Add-Member -MemberType NoteProperty -Name "PC_Name" -Value $pcname 80 | $rslt | Add-Member -MemberType NoteProperty -Name "KB" -Value $kb 81 | $rslt | Add-Member -MemberType NoteProperty -Name "Installed" -Value $installed 82 | $rslts += $rslt 83 | } 84 | } 85 | } 86 | else{ 87 | $rslt = New-Object PSObject 88 | $rslt | Add-Member -MemberType NoteProperty -Name "PC_Name" -Value $pcname 89 | $rslt | Add-Member -MemberType NoteProperty -Name "KB" -Value $kb 90 | $rslt | Add-Member -MemberType NoteProperty -Name "Installed" -Value "RPC_Error" 91 | $rslts += $rslt 92 | $PSAlert.Add("$pcname is inaccessible. RPC_Error", 1) 93 | } 94 | return $rslts 95 | } 96 | 97 | # Begin Program Flow 98 | Write-Output "WAUCheck" 99 | Write-Output "Written By: @Ben0xA" 100 | Write-Output "Huge thanks to @mwjcomputing!`r`n" 101 | Write-Output "Looking for KBs $kbs" 102 | $results = @() 103 | $pcs = @() 104 | if($omitInstalled){ 105 | Write-Output "Omitting entries where the KB is installed." 106 | } 107 | 108 | if(-not $outputFile){ 109 | Write-Output "Sending output to the screen. Use -outputFile name to save to a file.`r`n" 110 | } 111 | else { 112 | Write-Output "Will save csv results to $outputFile. Query messages will only appear on the screen.`r`n" 113 | } 114 | 115 | $wumaster = "" 116 | $kbItems = $kbs.Split(",") 117 | [PSObject]$hosts = $null 118 | 119 | if(-not $computer){ 120 | if($storedhosts) { 121 | #The storedhosts have been serialized as a string 122 | #Before we use them we need to deserialize. 123 | $hosts = $PSHosts.DeserializeHosts($storedhosts) 124 | } 125 | else { 126 | $hosts = $PSHosts.GetHosts() 127 | } 128 | 129 | if(!$hosts) { 130 | $hosts = Get-PCs 131 | foreach($h in $hosts) { 132 | $pcs += $h.Properties.name 133 | } 134 | } 135 | else { 136 | foreach($h in $hosts) { 137 | $pcs += $h.Name 138 | } 139 | } 140 | 141 | $idx = 0 142 | $len = $pcs.length 143 | foreach($pc in $pcs){ 144 | $idx += 1 145 | $pcname = $pc 146 | 147 | if($pcname){ 148 | $PSStatus.Update("Querying $pcname [$idx of $len]") 149 | if($showintab) { 150 | $rsp = Get-KBs($pcname) 151 | if($rsp -and $rsp -ne "") { 152 | $results += $rsp 153 | } 154 | } 155 | else { 156 | $wumaster += Get-KBs($pcname) | Out-String 157 | } 158 | } 159 | } 160 | } 161 | else{ 162 | $PSStatus.Update("Querying $computer, please wait...") 163 | if($showintab) { 164 | $rsp = Get-KBs($computer) 165 | if($rsp -and $rsp -ne "") { 166 | $results += $rsp 167 | } 168 | } 169 | else { 170 | $wumaster += Get-KBs($computer) | Out-String 171 | } 172 | } 173 | 174 | if(-not $outputFile){ 175 | if($showintab) { 176 | $PSTab.AddObjectGrid($results, "Windows KB ($kbs) Results") 177 | } 178 | else { 179 | $wumaster | Out-String 180 | } 181 | } 182 | else { 183 | $wumaster| Out-File $outputFile 184 | Write-Output "Output saved to $outputFile" 185 | } 186 | 187 | #End Program -------------------------------------------------------------------------------- /Patch Management/wauremove.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .DESCRIPTION 3 | Windows Automatic Update Remover 4 | Written by Ben0xA 5 | 6 | .PARAMETER kbs 7 | Comma separated values of KB numbers. 8 | 9 | .PARAMETER outputFile 10 | The output file to save results. This will override showintab. 11 | 12 | .PARAMETER computer 13 | Specifies a single computer to scan. 14 | 15 | .PARAMETER showintab 16 | Specifies whether to show the results in a PoshSec Framework Tab. 17 | 18 | .NOTES 19 | pshosts=storedhosts 20 | #> 21 | 22 | Param( 23 | [Parameter(Mandatory=$true,Position=1)] 24 | [string]$kbs, 25 | 26 | [Parameter(Mandatory=$false,Position=2)] 27 | [string]$outputFile, 28 | 29 | [Parameter(Mandatory=$false,Position=4)] 30 | [string]$computer, 31 | 32 | [Parameter(Mandatory=$false,Position=6)] 33 | [string]$storedhosts 34 | ) 35 | 36 | Function Remove-KBs($pcname, $kb){ 37 | Invoke-RemoteWmiProcess $pcname "wusa.exe /uninstall /kb:$($kb) /quiet /norestart" -noredirect -nowait 38 | } 39 | 40 | Function Get-KBs($pcname){ 41 | $rslt = "" 42 | $qfe = Get-WmiObject -Class Win32_QuickFixEngineering -Computer $pcname -ErrorVariable myerror -ErrorAction SilentlyContinue 43 | if($myerror.count -eq 0) { 44 | foreach($kb in $kbItems){ 45 | $installed = $false 46 | $kbentry = $qfe | Select-String $kb 47 | if($kbentry){ 48 | Write-Output("KB $kb found. Attempting to uninstall, please wait...") 49 | $rmrslt = Remove-KBs $pcname $kb 50 | $rslt += "$pcname,$kb,Uninstall Sent`r`n" 51 | } 52 | else { 53 | $rslt += "$pcname,$kb,Not Installed`r`n" 54 | } 55 | } 56 | } 57 | else{ 58 | $rslt += "$pcname,$kb,RPC_Error`r`n" 59 | } 60 | return $rslt 61 | } 62 | 63 | Import-Module $PSModRoot\PoshSec 64 | # Begin Program Flow 65 | 66 | Write-Output "WAURemove" 67 | Write-Output "Written By: @Ben0xA" 68 | Write-Output "Huge thanks to @mwjcomputing!`r`n" 69 | Write-Output "Looking for KBs $kbs" 70 | if(-not $outputFile){ 71 | Write-Output "Sending output to the screen. Use -outputFile name to save to a file.`r`n" 72 | } 73 | else { 74 | Write-Output "Will save csv results to $outputFile. Query messages will only appear on the screen.`r`n" 75 | } 76 | 77 | $wumaster = "PC Name,KB,Status`r`n" 78 | $kbItems = $kbs.Split(",") 79 | if(-not $computer){ 80 | if($storedhosts) { 81 | #The storedhosts have been serialized as a string 82 | #Before we use them we need to deserialize. 83 | $hosts = $PSHosts.DeserializeHosts($storedhosts) 84 | } 85 | else { 86 | $hosts = $PSHosts.GetHosts() 87 | } 88 | 89 | if(!$hosts) { 90 | $hosts = Get-PCs 91 | foreach($h in $hosts) { 92 | $pcs += $h.Properties.name 93 | } 94 | } 95 | else { 96 | foreach($h in $hosts) { 97 | $pcs += $h.Name 98 | } 99 | } 100 | 101 | $idx = 0 102 | $len = $pcs.length 103 | foreach($pc in $pcs){ 104 | $idx += 1 105 | $pcname = $pc 106 | 107 | if($pcname){ 108 | $PSStatus.Update("Querying $pcname [$idx of $len]") 109 | if($showintab) { 110 | $rsp = Get-KBs($pcname) 111 | if($rsp -and $rsp -ne "") { 112 | $results += $rsp 113 | } 114 | } 115 | else { 116 | $wumaster += Get-KBs($pcname) | Out-String 117 | } 118 | } 119 | } 120 | } 121 | else{ 122 | $PSStatus.Update("Querying $computer, please wait...") 123 | if($showintab) { 124 | $rsp = Get-KBs($computer) 125 | if($rsp -and $rsp -ne "") { 126 | $results += $rsp 127 | } 128 | } 129 | else { 130 | $wumaster += Get-KBs($computer) | Out-String 131 | } 132 | } 133 | 134 | if(-not $outputFile){ 135 | if($showintab) { 136 | $PSTab.AddObjectGrid($results, "Windows KB ($kbs) Results") 137 | } 138 | else { 139 | $wumaster | Out-String 140 | } 141 | } 142 | else { 143 | $wumaster| Out-File $outputFile 144 | Write-Output "Output saved to $outputFile" 145 | } 146 | 147 | #End Program -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | PoshSecScripts 2 | ============== 3 | 4 | PowerShell scripts for the PoshSec Framework 5 | -------------------------------------------------------------------------------- /SecIISMonitor.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | A PoshSec Framework function that monitors the current IIS log and generates alerts on specified criteria. The alerts display the log's timestamp, the client IP, the URL accessed, and the user agent string. 4 | 5 | .PARAMETER IP 6 | Client IP address to isolate in the log file. Generates alerts for those records. 7 | 8 | .PARAMETER Filter 9 | A string to search for to limit the log files returned 10 | 11 | .PARAMETER Limit 12 | An integer value to indicate how many records to return from the log file. Default is the most recent 100. 13 | 14 | .PARAMETER Path 15 | Path to the IIS log files. Default is C:\inetpub\logs\LogFiles\W3SVC1\ 16 | 17 | .PARAMETER Poll 18 | Integer indicating number of seconds to elapse between chacks on the log. Default is 10. 19 | 20 | .EXAMPLE 21 | Get an alert if anyone tries to view your robots.txt file. 22 | Start-SecIISMonitor -filter "robots.txt" 23 | 24 | #> 25 | param( 26 | [String]$IP = "", 27 | [String]$filter = "", 28 | [Int]$limit = 100, 29 | [String]$path = "C:\inetpub\logs\LogFiles\W3SVC1\", 30 | [int]$poll = 10 31 | ) 32 | 33 | #Required to use PoshSec functions 34 | Import-Module $PSModRoot\PoshSec 35 | 36 | while($true){ 37 | if([System.Net.IPAddress]::TryParse($IP,[ref] $null)){ 38 | Get-SECIISlog -path $path -filter $filter -limit $limit | ForEach-Object { 39 | if($_.cIP -eq $IP){ 40 | $PSAlert.Add($_.cIP + " " + $_.URL + " " + $_.Agent ,2) 41 | } 42 | } 43 | } 44 | else{ 45 | Get-SECIISlog -path $path -filter $filter -limit $limit | ForEach-Object { 46 | $PSAlert.Add($_.LogDate + " " + $_.cIP + " " + $_.URL + " " + $_.Agent,2) 47 | } 48 | } 49 | 50 | Start-Sleep -Second $poll 51 | } 52 | 53 | 54 | -------------------------------------------------------------------------------- /System Information/getdrivestest.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .DESCRIPTION 3 | Tests the Get-Drives module import. 4 | #> 5 | 6 | Write-Output "Testing Get-Drives module..." 7 | #End Program -------------------------------------------------------------------------------- /System Information/installedprograms.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .DESCRIPTION 3 | Lists all of the applications that are installed on the system. 4 | 5 | AUTHOR 6 | Ben0xA 7 | 8 | .PARAMETER showintab 9 | Specifies whether to show the results in a PoshSec Framework Tab. 10 | 11 | .PARAMETER storedhosts 12 | This is for storing hosts from the framework for scheduling. 13 | 14 | .NOTES 15 | pshosts=storedhosts 16 | #> 17 | 18 | Param( 19 | [Parameter(Mandatory=$false,Position=1)] 20 | [boolean]$showintab=$True, 21 | 22 | [Parameter(Mandatory=$false,Position=2)] 23 | [string]$storedhosts 24 | ) 25 | #Required to use PoshSec functions 26 | Import-Module $PSModRoot\PoshSec 27 | 28 | #Start your code here. 29 | $progs = @() 30 | $installedprogs = @() 31 | 32 | if($storedhosts) { 33 | #The storedhosts have been serialized as a string 34 | #Before we use them we need to deserialize. 35 | $hosts = $PSHosts.DeserializeHosts($storedhosts) 36 | } 37 | else { 38 | $hosts = $PSHosts.GetHosts() 39 | } 40 | 41 | if($hosts) { 42 | foreach($h in $hosts) { 43 | $PSStatus.Update("Querying $($h.Name), please wait...") 44 | if($h.Status -eq "Up") { 45 | $progs = Get-RemoteRegistryKey $h.Name 3 "Software\Microsoft\Windows\CurrentVersion\Uninstall\" 46 | if($progs) { 47 | $idx = 1 48 | foreach($p in $progs) { 49 | $PSStatus.Update("Adding $idx out of $($progs.Length) on $($h.Name), please wait...") 50 | $progdata = Get-RemoteRegistryValue $h.Name 3 "$($p.Path)$($p.Key)" 51 | $instprog = New-Object PSObject 52 | $instprog | Add-Member -MemberType NoteProperty -Name "Computer" -Value $p.Computer 53 | $rslt = $progdata | Where { $_.Name -eq "DisplayName"} 54 | if($rslt) { 55 | $instprog | Add-Member -MemberType NoteProperty -Name "DisplayName" -Value $rslt.Value 56 | } 57 | else { 58 | $instprog | Add-Member -MemberType NoteProperty -Name "DisplayName" -Value $p.Key 59 | } 60 | $instprog | Add-Member -MemberType NoteProperty -Name "DisplayVersion" -Value $($progdata | Where { $_.Name -eq "DisplayVersion"} | Select -ExpandProperty Value) 61 | $instprog | Add-Member -MemberType NoteProperty -Name "InstallLocation" -Value $($progdata | Where { $_.Name -eq "InstallLocation"} | Select -ExpandProperty Value) 62 | $instprog | Add-Member -MemberType NoteProperty -Name "InstallDate" -Value $($progdata | Where { $_.Name -eq "InstallDate"} | Select -ExpandProperty Value) 63 | $instprog | Add-Member -MemberType NoteProperty -Name "InstallSource" -Value $($progdata | Where { $_.Name -eq "InstallSource"} | Select -ExpandProperty Value) 64 | $installedprogs += $instprog 65 | $idx += 1 66 | } 67 | } 68 | } 69 | } 70 | 71 | if($installedprogs) { 72 | $installedprogs = $installedprogs | Sort-Object Computer, DisplayName 73 | if($showintab) { 74 | $PSTab.AddObjectGrid($installedprogs, "Installed Programs") 75 | Write-Output "Installed Programs Tab Created." 76 | } 77 | else { 78 | $installedprogs | Out-String 79 | } 80 | } 81 | else { 82 | Write-Output "Unable to find any installed programs" 83 | } 84 | } 85 | else { 86 | Write-Output "Please select the hosts in the Systems tab to scan." 87 | } 88 | 89 | #End Script -------------------------------------------------------------------------------- /System Information/listnetversions.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .DESCRIPTION 3 | Lists the .NET versions for all hosts selected in Systems. 4 | 5 | AUTHOR 6 | Ben0xA 7 | 8 | .PARAMETER showintab 9 | Specifies whether to show the results in a PoshSec Framework Tab. 10 | #> 11 | 12 | Param( 13 | [Parameter(Mandatory=$false,Position=1)] 14 | [boolean]$showintab=$True 15 | ) 16 | #Required to use PoshSec functions 17 | Import-Module $PSModRoot\PoshSec 18 | 19 | #Start your code here. 20 | $vers = @() 21 | 22 | $hosts = $PSHosts.GetHosts() 23 | 24 | if($hosts) { 25 | foreach($h in $hosts) { 26 | if($h.Status -eq "Up") { 27 | $PSStatus.Update("Querying " + $h.Name + "...") 28 | $ver = Get-RemoteNETVersion $h.Name 29 | if($ver) { 30 | $vers += $ver 31 | } 32 | } 33 | } 34 | 35 | if($vers.count -gt 0) { 36 | if($showintab) { 37 | $PSTab.AddObjectGrid($vers, ".NET Versions") 38 | Write-Output ".NET Versions Tab Created." 39 | } 40 | else { 41 | $vers | Out-String 42 | } 43 | } 44 | else { 45 | Write-Output "Unable to find any .NET Version information." 46 | } 47 | } 48 | else { 49 | Write-Output "Please select the hosts in the Systems tab to scan." 50 | } 51 | 52 | #End Script -------------------------------------------------------------------------------- /System Information/monitor-startupprograms.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .DESCRIPTION 3 | Monitors all of the applications that are set to starup in the \Run 4 | folder of the registry and compares them to a previous baseline. 5 | 6 | AUTHOR 7 | Ben0xA 8 | 9 | .PARAMETER baselinefile 10 | The file to use to store the baseline. 11 | 12 | .PARAMETER storedhosts 13 | This is for storing hosts from the framework for scheduling. 14 | 15 | .NOTES 16 | pshosts=storedhosts 17 | psfilename=baselinefile 18 | #> 19 | 20 | Param( 21 | [Parameter(Mandatory=$false,Position=1)] 22 | [string]$baselinefile, 23 | 24 | [Parameter(Mandatory=$false,Position=2)] 25 | [string]$storedhosts 26 | ) 27 | #Required to use PoshSec functions 28 | Import-Module $PSModRoot\PoshSec 29 | 30 | #Start your code here. 31 | $progs = @() 32 | 33 | if($storedhosts) { 34 | #The storedhosts have been serialized as a string 35 | #Before we use them we need to deserialize. 36 | $hosts = $PSHosts.DeserializeHosts($storedhosts) 37 | } 38 | else { 39 | $hosts = $PSHosts.GetHosts() 40 | } 41 | 42 | if($hosts) { 43 | foreach($h in $hosts) { 44 | $PSStatus.Update("Querying $($h.Name), please wait...") 45 | $progs += Get-RemoteRegistryValue $h.Name 3 "Software\Microsoft\Windows\CurrentVersion\Run\" 46 | $progs += Get-RemoteRegistryValue $h.Name 3 "Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Run\" 47 | } 48 | 49 | if($progs) { 50 | if(Test-Path $baselinefile) { 51 | $baseline = Import-CliXml $baselinefile 52 | $results = Compare-Object $baseline $progs 53 | if($results) { 54 | foreach($rslt in $results) { 55 | switch($rslt.SideIndicator) 56 | { 57 | "<=" { $PSAlert.Add("Program Removed: $($rslt.InputObject)", 2)} 58 | "=>" { $PSAlert.Add("Program Added: $($rslt.InputObject)", 2)} 59 | } 60 | } 61 | #save the new progs as the new baseline 62 | $progs | Export-CliXml $baselinefile 63 | } 64 | } 65 | else { 66 | $progs | Export-CliXml $baselinefile 67 | Write-Output "Baseline file created." 68 | } 69 | } 70 | else { 71 | Write-Output "Unable to find any startup programs" 72 | } 73 | } 74 | else { 75 | Write-Output "Please select the hosts in the Systems tab to scan." 76 | } 77 | 78 | #End Script -------------------------------------------------------------------------------- /System Information/remotearchlist.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .DESCRIPTION 3 | Lists the architecture and OS for all hosts selected in Systems. 4 | 5 | AUTHOR 6 | Ben0xA 7 | 8 | .PARAMETER showintab 9 | Specifies whether to show the results in a PoshSec Framework Tab. 10 | #> 11 | 12 | Param( 13 | [Parameter(Mandatory=$false,Position=1)] 14 | [boolean]$showintab=$True 15 | ) 16 | #Required to use PoshSec functions 17 | Import-Module $PSModRoot\PoshSec 18 | 19 | #Start your code here. 20 | $archs = @() 21 | 22 | $hosts = $PSHosts.GetHosts() 23 | 24 | if($hosts) { 25 | foreach($h in $hosts) { 26 | if($h.Status -eq "Up") { 27 | $PSStatus.Update("Querying " + $h.Name + "...") 28 | $arch = Get-RemoteArchitecture $h.Name 29 | if($arch) { 30 | $archs += $arch 31 | } 32 | } 33 | } 34 | 35 | if($archs.count -gt 0) { 36 | if($showintab) { 37 | $PSTab.AddObjectGrid($archs, "System Architecture") 38 | Write-Output "System Architecture Tab Created." 39 | } 40 | else { 41 | $archs | Out-String 42 | } 43 | } 44 | else { 45 | Write-Output "Unable to find any system architecture information." 46 | } 47 | } 48 | else { 49 | Write-Output "Please select the hosts in the Systems tab to scan." 50 | } 51 | 52 | #End Script -------------------------------------------------------------------------------- /System Information/runningprograms.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .DESCRIPTION 3 | Lists all of the applications that are currently running. 4 | 5 | AUTHOR 6 | Ben0xA 7 | 8 | .PARAMETER showintab 9 | Specifies whether to show the results in a PoshSec Framework Tab. 10 | 11 | .PARAMETER storedhosts 12 | This is for storing hosts from the framework for scheduling. 13 | 14 | .PARAMETER processname 15 | The name of the process. 16 | 17 | .PARAMETER ignoreprocesses 18 | A comma separated list of processes to ignore. 19 | 20 | .PARAMETER baselinepath 21 | The path to the baseline xml for comparison. 22 | 23 | .NOTES 24 | pshosts=storedhosts 25 | psfilename=baselinepath 26 | #> 27 | 28 | Param( 29 | [Parameter(Mandatory=$false,Position=1)] 30 | [boolean]$showintab=$True, 31 | 32 | [Parameter(Mandatory=$false,Position=2)] 33 | [string]$storedhosts, 34 | 35 | [Parameter(Mandatory=$false,Position=3)] 36 | [string]$processname, 37 | 38 | [Parameter(Mandatory=$false,Position=4)] 39 | [string]$ignoreprocesses, 40 | 41 | [Parameter(Mandatory=$false,Position=5)] 42 | [string]$baselinepath 43 | ) 44 | #Required to use PoshSec functions 45 | Import-Module $PSModRoot\PoshSec 46 | 47 | #Start your code here. 48 | $processes = @() 49 | $outprocs = @() 50 | $ignore = ($ignoreprocesses -split ",") 51 | 52 | if($storedhosts) { 53 | #The storedhosts have been serialized as a string 54 | #Before we use them we need to deserialize. 55 | $hosts = $PSHosts.DeserializeHosts($storedhosts) 56 | } 57 | else { 58 | $hosts = $PSHosts.GetHosts() 59 | } 60 | 61 | if($hosts) { 62 | foreach($h in $hosts) { 63 | $PSStatus.Update("Querying $($h.Name), please wait...") 64 | $processes += Get-SecRunningProcess $h.Name $processname 65 | } 66 | 67 | if($processes) { 68 | foreach($proc in $processes) { 69 | if($ignore -notcontains $proc.ProcessName) { 70 | $outprocs += $proc 71 | } 72 | } 73 | if($baselinepath -ne "") { 74 | if(Test-Path $baselinepath) { 75 | $baseprocs = Import-Clixml -path $baselinepath 76 | $results = Compare-Object $baseprocs $outprocs -property Computer, ProcessName 77 | if($results) { 78 | if($showintab) { 79 | $PSTab.AddObjectGrid($results, "Process Comparison Results") 80 | Write-Output "Process Comparison Results Tab Created." 81 | } 82 | else { 83 | $results | Out-String 84 | } 85 | #overwrite baseline 86 | $outprocs | Export-Clixml -path $baselinepath 87 | } 88 | } 89 | else { 90 | $outprocs | Export-Clixml -path $baselinepath 91 | Write-Output "Baseline file created." 92 | } 93 | } 94 | else { 95 | if($showintab) { 96 | $PSTab.AddObjectGrid($outprocs, "Running Programs") 97 | Write-Output "Running Programs Tab Created." 98 | } 99 | else { 100 | $outprocs | Out-String 101 | } 102 | } 103 | } 104 | else { 105 | Write-Output "Unable to find any running programs" 106 | } 107 | } 108 | else { 109 | Write-Output "Please select the hosts in the Systems tab to scan." 110 | } 111 | 112 | #End Script -------------------------------------------------------------------------------- /System Information/startupprograms.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .DESCRIPTION 3 | Lists all of the applications that are set to starup in the \Run 4 | folder of the registry. 5 | 6 | AUTHOR 7 | Ben0xA 8 | 9 | .PARAMETER showintab 10 | Specifies whether to show the results in a PoshSec Framework Tab. 11 | 12 | .PARAMETER storedhosts 13 | This is for storing hosts from the framework for scheduling. 14 | 15 | .NOTES 16 | pshosts=storedhosts 17 | #> 18 | 19 | Param( 20 | [Parameter(Mandatory=$false,Position=1)] 21 | [boolean]$showintab=$True, 22 | 23 | [Parameter(Mandatory=$false,Position=2)] 24 | [string]$storedhosts 25 | ) 26 | #Required to use PoshSec functions 27 | Import-Module $PSModRoot\PoshSec 28 | 29 | #Start your code here. 30 | $progs = @() 31 | 32 | if($storedhosts) { 33 | #The storedhosts have been serialized as a string 34 | #Before we use them we need to deserialize. 35 | $hosts = $PSHosts.DeserializeHosts($storedhosts) 36 | } 37 | else { 38 | $hosts = $PSHosts.GetHosts() 39 | } 40 | 41 | if($hosts) { 42 | foreach($h in $hosts) { 43 | $PSStatus.Update("Querying $($h.Name), please wait...") 44 | $progs += Get-RemoteRegistryValue $h.Name 3 "Software\Microsoft\Windows\CurrentVersion\Run\" 45 | $progs += Get-RemoteRegistryValue $h.Name 3 "Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Run\" 46 | } 47 | 48 | if($progs) { 49 | if($showintab) { 50 | $PSTab.AddObjectGrid($progs, "Startup Programs") 51 | Write-Output "Startup Programs Tab Created." 52 | } 53 | else { 54 | $progs | Out-String 55 | } 56 | } 57 | else { 58 | Write-Output "Unable to find any startup programs" 59 | } 60 | } 61 | else { 62 | Write-Output "Please select the hosts in the Systems tab to scan." 63 | } 64 | 65 | #End Script -------------------------------------------------------------------------------- /Template/psftemplate.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .DESCRIPTION 3 | 4 | 5 | AUTHOR 6 | 7 | #> 8 | 9 | #Put Parameters here. Before Import-Module $PSFramework 10 | # param( 11 | # [String]$param1 = "", 12 | # [String]$param2 = "", 13 | # [Int]$param3 = 1 14 | # ) 15 | 16 | #Start your code here. 17 | 18 | 19 | 20 | #End Script -------------------------------------------------------------------------------- /helloworld.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .DESCRIPTION 3 | Tests the import function for the PoshSec Framework. 4 | 5 | AUTHOR 6 | Ben0xA 7 | #> 8 | # Begin Script Flow 9 | Write-Output "Hello World!" 10 | #End Script -------------------------------------------------------------------------------- /hoststest.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .DESCRIPTION 3 | This tests the $PSHosts functionality with PoshSec Framework 4 | 5 | AUTHOR 6 | Ben0xA 7 | 8 | $PSHosts Usage 9 | $PSHosts.GetHosts([bool AllHosts]) 10 | 11 | Returns PSObject array with whatever columns are listed in the listview. 12 | #> 13 | 14 | # Begin Script Flow 15 | 16 | #Start your code here. 17 | Write-Output "Listing of Hosts that are checked." 18 | Write-Output $PSHosts.GetHosts() | Out-String 19 | Write-Output "" 20 | Write-Output "Listing of all Hosts" 21 | Write-Output $PSHosts.GetHosts($True) | Out-String 22 | #End Script -------------------------------------------------------------------------------- /infiniteloop.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .DESCRIPTION 3 | Tests the cancel script option with infinite loop. 4 | 5 | .AUTHOR 6 | Ben0xA 7 | #> 8 | 9 | # Begin Script Flow 10 | Write-Output "This is the infinite loop script." 11 | 12 | $v = $False 13 | 14 | do 15 | { 16 | 17 | } while ($v -eq $False) 18 | #End Script -------------------------------------------------------------------------------- /psfcommandtest.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .DESCRIPTION 3 | Tests the ability to call PoshSec Framework Commands. 4 | 5 | AUTHOR 6 | Ben0xA 7 | #> 8 | #Required to use PoshSec functions 9 | Import-Module $PSModRoot\PoshSec 10 | 11 | # Begin Script Flow 12 | Write-Output "This is the result of the Get-SecSoftwareInstalled function." 13 | 14 | Get-SecSoftwareInstalled 15 | #End Script -------------------------------------------------------------------------------- /psftest: -------------------------------------------------------------------------------- 1 | <# 2 | .DESCRIPTION 3 | Tests the Get-Drives module import. 4 | #> 5 | 6 | # Begin Program Flow 7 | Import-Module $PSFramework 8 | 9 | Write-Output "Testing Get-Drives module..." 10 | Get-Command -Module PoshSecFramework 11 | #End Program -------------------------------------------------------------------------------- /psftest.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .DESCRIPTION 3 | Tests the import function for the PoshSec Framework. 4 | 5 | AUTHOR 6 | Ben0xA 7 | #> 8 | 9 | # Begin Script Flow 10 | 11 | Write-Output "This is the test script for PoshSec Framework" 12 | Write-Output "There should be 5 alerts listed." 13 | $PSAlert.Add("This is an Information alert.", 0) 14 | $PSAlert.Add("This is an Error alert.", 1) 15 | $PSAlert.Add("This is a Warning alert.", 2) 16 | $PSAlert.Add("This is a Severe alert.", 3) 17 | $PSAlert.Add("This is a Critical alert.", 4) 18 | Write-Output "" 19 | 20 | $PSStatus.Update("This updates the status item for this script") 21 | 22 | Write-Output "This is the PSFramework variable for the main framework script location." 23 | Write-Output $PSFramework 24 | Write-Output "This is the PSModRood variable for the Modules root folder." 25 | Write-Output $PSModRoot 26 | Write-Output "This is the PSRoot variable for the Scripts root folder." 27 | Write-Output $PSRoot 28 | 29 | Get-Drives 30 | 31 | #End Script -------------------------------------------------------------------------------- /psftest.psm1: -------------------------------------------------------------------------------- 1 | <# 2 | .DESCRIPTION 3 | Tests the Get-Drives module import. 4 | #> 5 | 6 | # Begin Program Flow 7 | Write-Output "Testing Get-Drives module..." 8 | Get-Command -Module PoshSecFramework 9 | #End Program -------------------------------------------------------------------------------- /test.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .DESCRIPTION 3 | Just a test. Ignore 4 | 5 | AUTHOR 6 | Ben0xA 7 | 8 | .PARAMETER sourcefile 9 | The source file to copy to the remote hosts. 10 | 11 | .PARAMETER storedhosts 12 | This is for storing hosts from the framework for scheduling. 13 | 14 | .NOTES 15 | psfilename=sourcefile 16 | pshosts=storedhosts 17 | #> 18 | 19 | Param( 20 | [Parameter(Mandatory=$true,Position=1)] 21 | [string]$sourcefile, 22 | 23 | [Parameter(Mandatory=$false,Position=2)] 24 | [string]$storedhosts 25 | ) 26 | 27 | # Begin Script Flow 28 | 29 | #Start your code here. 30 | [PSObject]$hosts = $null 31 | 32 | if($storedhosts) { 33 | #The storedhosts have been serialized as a string 34 | #Before we use them we need to deserialize. 35 | $hosts = $PSHosts.DeserializeHosts($storedhosts) 36 | } 37 | else { 38 | $hosts = $PSHosts.GetHosts() 39 | } 40 | 41 | Write-Output $hosts 42 | 43 | $results = @() 44 | 45 | if($hosts.Count -gt 0) { 46 | foreach($h in $hosts) { 47 | $PSStatus.Update("Processing $($h.Name), please wait...") 48 | $copyitm = New-Object PSObject 49 | $copyitm | Add-Member -MemberType NoteProperty -Name "Computer" -Value $h.Name 50 | $copyitm | Add-Member -MemberType NoteProperty -Name "Filename" -Value $sourcefile 51 | $copyitm | Add-Member -MemberType NoteProperty -Name "Status" -Value "It worked!" 52 | $results += $copyitm 53 | } 54 | $PSTab.AddObjectGrid($results, "Test Results") 55 | } 56 | #End Script --------------------------------------------------------------------------------