Categories: Kali Linux

SharpStat : C# Utility That Uses WMI To Run CMD

SharpStat is a C# utility that uses WMI to run “cmd.exe /c netstat -n”, save the output to a file, then use SMB to read and delete the file remotely. This script will attempt to connect to all the supplied computers and use WMI to execute cmd.exe /c netstat -n > <file>.

The file the output is saved to is specified by ‘-file’. Once the netstat command is running, the output is read via remote SMB call and then deleted.

While this isn’t the stealthiest of scripts (because of the cmd.exe execution and saving to a file), sometimes you gotta do what you gotta do.

An alternative would be to use WMI to remotely query netstat information, but that WMI class is only available on Win10+ systems, which isn’t ideal. This solution at least works for all levels of operating systems.

Usage

 Mandatory Options:
     -file         = This is the file that the output will be saved in 
                     temporarily before being remotely read/deleted

 Optional Options:
     -computers    = A list of systems to run this against, separated by commas
        [or]
     -dc           = A domain controller to get a list of domain computers from
     -domain       = The domain to get a list of domain computers from

Also Read – Aaia : AWS Identity & Access Management Visualizer & Anomaly Finder

Examples

SharpStat.exe -file “C:\Users\Public\test.txt” -domain lab.raikia.com -dc lab.raikia.com
SharpStat.exe -file “C:\Users\Public\test.txt” -computers “wkstn7.lab.raikia.com,wkstn10.lab.raikia.com”

Screenshot

Credits :  raikiasec@gmail.com or @raikiasec

R K

Recent Posts

Install Pip on Ubuntu 18.04: Python 3 and Python 2 Setup Guide

Pip is the official package manager for Python and the standard way to install libraries from…

3 days ago

Install R on Ubuntu 18.04 from CRAN: Statistical Computing Setup

R is an open-source programming language and environment built for statistical computing and data visualization. It…

3 days ago

Install Jenkins on Ubuntu 18.04: CI/CD Server Setup Guide

Jenkins is an open-source automation server that makes it easy to build CI/CD pipelines. Continuous integration…

3 days ago

Install Android Studio on Ubuntu 18.04 with Snap and OpenJDK 8

Android Studio is the official IDE for Android development, built on JetBrains' IntelliJ IDEA platform. It…

3 days ago

Install and Configure GitLab on Ubuntu 18.04 with Omnibus

GitLab is a web-based, open-source Git repository manager written in Ruby. It includes built-in tools for…

3 days ago

Install Anaconda on Ubuntu 18.04: Python Data Science Setup Guide

Anaconda is the most widely used Python distribution for data science and machine learning. It bundles…

4 days ago