Giter VIP home page Giter VIP logo

homework-of-powershell's Introduction

Homework-of-Powershell

powershell codes of my blog.

Invoke-Enumeratefile.ps1

Enumerate all the files under c:\Windows that the permission of NT AUTHORITY\SYSTEM is full control.

We can use the task scheduler to write an arbitrary DACL to the file and then we can modify the files with normal user permissions.

This script will enumerate all the files you can take control over.

Invoke-LibraryFilesPersistence.ps1

First modify the registry and then create a file named Documents.library-ms in %appdata%\Microsoft\Windows\Start Menu\Programs\Accessories.

It'll load c:\test\calc.dll on start-up.

Delete-Amcache.ps1

This script loads the AMCache hive from the default Windows location and delete the seleted data. You can use Get-Amcache.ps1 to list the data of AMCache hive,then use this to delete the seleted data. The new AMCache hive will be saved as new.hve

Get-Amcache.ps1:https://github.com/yoda66/GetAmCache/blob/master/Get-Amcache.ps1

New-GPOImmediateTask.ps1

Builds an 'Immediate' schtask to push out through a specified GPO.

Because I haven't found out how to register the 'Immediate' schtask yet.

So I have to backup the gpo,then modify the Backup.xml and gpreport.xml,and finally import the gpo.

    (1)Create a gpo
        new-gpo -name TestGPO | new-gplink -Target "dc=test,dc=com"
    (2)Use New-GPOImmediateTask.ps1 to backup the gpo into the current path,modify the Backup.xml and gpreport.xml and finally import the gpo       
        New-GPOImmediateTask -TaskName Debugging -GPODisplayName TestGPO -SysPath '\\dc.test.com\sysvol\test.com' -CommandArguments '-c "123 | Out-File C:\test\debug.txt"'
    (3)You can force the client to refresh the gpo:
        Invoke-GPUpdate -Computer "TEST\COMPUTER-01"
       Or you can wait 90 minutes,the client's gpo will refresh automatically. 

dns-dump.ps1

Dump all the DNS records via AD LDAP and DNS query when you can access the Active Directory.

Invoke-OutlookPersistence.ps1

This script allows you to use COM Object hijacking to maintain persistence.

When the Outlook starts,it will load the backdoor DLL.

This method is first used by Turla in public.

Learn from:https://www.welivesecurity.com/wp-content/uploads/2018/08/Eset-Turla-Outlook-Backdoor.pdf

Get-AllExports.ps1

Reference:

https://github.com/FuzzySecurity/PowerShell-Suite/blob/master/Get-Exports.ps1

This script is mainly used to automatically scan whether the export function of DLL in the specified directory contains "minidump" or not.

UsePSSessionToExportMailfromExchange.ps1

This script will export the mail(.pst) from the Exchange server.

First it will use PSSession to connect the Exchange server.

Then it'll check the user's privilege.

If the user is not in the "Mailbox Import Export",the script will add the user to it and reconnect the Exchange server..

Next it will export the mail and save it.

At last it will remove the user from the group and remove the PSSession.

DirectExportMailfromExchange.ps1

This script will export the mail(.pst) from the Exchange server.

The script needs to be executed on the Exchange server.

UsePSSessionToSearchMailfromExchange.ps1

This script will search the mail from the Exchange server and export the results to the selected mailbox.

First it will use PSSession to connect the Exchange server.

Then it'll check the user's privilege.

If the user is not in the "Mailbox Search",the script will add the user to it and reconnect the Exchange server.

Next it will search the mail from the Exchange server and export the results to the selected mailbox.

At last it will remove the user from the group and remove the PSSession.

DirectSearchMailfromExchange.ps1

This script will search the mail from the Exchange server and export the results to the selected mailbox.

The script needs to be executed on the Exchange server.

Invoke-DomainPasswordSprayOutsideTheDomain.ps1

This module performs a password spray attack against users of a domain.

Note: It only works outside the domain environment.

When you are in the domain environment,you can use the original file(Invoke-DomainPasswordSpray).

Source:https://github.com/dafthack/DomainPasswordSpray

homework-of-powershell's People

Contributors

3gstudent avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.