Hacking Notes
  • What is this?
  • Reconnaissance 🗣
    • Information Gathering 🗣
  • Enumeration 🎯
    • Host Discovery 🛎
    • DNS Enumeration
    • OS Discovery 🖥
    • Port Scanning 📟
    • WAF Evasion
  • Web 📱
    • Unrestricted File Upload
    • Templates Injections ✖️
    • File Inclusion
    • Login Panes
    • SQL Injection
    • NoSQL Injection
    • OAuth 2.0 Bypass
  • Privilege Escalation
    • Linux Privesc
    • Windows Privesc
    • Run Commands AS
  • Post Explotation 💀
    • Port Forwarding and Tunneling
    • Transfering Files 📤
    • Reverse Shell 🔙
    • Crypto 101 👁
    • AV Evasion
    • Bypass UAC
    • Get Credentials
  • Services
    • PORT 21/tcp - FTP
    • PORT 25/tcp - SMTP
    • PORT 53/tcp/udp - DNS
    • Port 80,443/tcp - HTTP
    • Port 111/tcp - RPCBind
    • PORT 143,993/tcp - IMAP
    • PORT 139,445/tcp - SMB
    • PORT 161/udp - SNMP
    • PORT 1100/tcp - Java RMI
    • PORT 1433/tcp - Microsoft SQL Server
    • PORT 2049/tcp - NFS
    • PORT 3306/tcp MySQL
    • PORT 3389/tcp RDP
    • PyPI Server
  • Software
    • Tomcat
    • Jenkins
    • Drupal
    • Wordpress
  • Client-Side Attacks
    • Evil PDF
    • Microsoft Office Macros
  • Other
    • Hacking WiFI
      • WPA/WPA2 PSK
      • WPA/WPA2 PEAP (Enterprise)
      • WEP
    • Hacking with Powershell
    • Hacking AWS
  • Exploiting
    • Buffer Overflow
  • Active Directory
    • 🖥️AD Attacks
Powered by GitBook
On this page
  • What is Powershell?
  • Using Get-Help
  • Using Get-Command
  • Object Manipulation
  • Creating Objects From Previous cmdlets
  • Filtering Objects
  • Sort Objects

Was this helpful?

  1. Other

Hacking with Powershell

Basic explanation about what is Powershell and how we can use it in out hacking days.

PreviousWEPNextHacking AWS

Last updated 3 years ago

Was this helpful?

What is Powershell?

Powershell is the Windows Scripting Language and shell environment that is built using the .NET Framework.

Most Powershell commands, called cmdlets, are written in .NET. Unlike other scripting languages and shell environments, the output of these cmdlets are objects, making Powershell somewhat object oriented.

Note: The normal format of cmdlet is represented using Verb-Noun. Ex: Get-Command

Common verbs used are the

  • Get

  • Start

  • Stop

  • Read

  • Write

  • New

  • Out

Using Get-Help

Get-Help displays information about a cmdlet. To get help about a particular command, run the following:

Get-Help cmdlet

Note: To show some examples execute Get-Help cmdlet -Examples

Using Get-Command

Get-Command gets all the cmdlets installed on the current Computer.

Running Get-Command Verb-* or Get-Command *-Noun filters the search.

Object Manipulation

If we want to actually maniputare the output, we need to figure out a few things:

  • Passing output to other cmdlets.

  • Using specific object cmdlets to extract information.

To pas the output to another cmdlet like bash scripting is with the Pipeline "|"

Verb-Noun | Get-Member -MemberType Equals

Creating Objects From Previous cmdlets

One way of manipulating objects is pulling out the properties from the output of a cmdlet and creating a new object. This is done using the Select-Object cmdlet.

Get-ChildItem | Select-Object -Property Mode, Name

Filtering Objects

When retrieving output objects, you may want to select objects that match a very specific value. You can do that using the Where-Object.

Verb-Noun | Where-Object -Property PropertyName -operator Value
Verb-Noun | Where-Object {$_.PropertyName -operator Value}
  • -contains: Exact match for the specified value.

  • -eq: Equals to.

  • -gt: Greater than.

Sort Objects

May you need to sort the output of a cmdlet in order to extract the information more efficiently. You can do this with Sort-Object cmdlet.

Verb-Noun | Sort-Object

This are the:

following ones:
following operators