<commit_before>﻿#
# Description: Interactive Powershell program to retrieve data about remote host
# Author:      <NAME>
# Website:     https://github.com/kek91
#
# Known bug: For some reason the "st" command won't
# output anything the first time, you have to run it twice...
#

$version = "0.1.0"

$commands = @(
    "eventvwr",
    "lookup",
    "ping"
)


function showMenu {
    echo "Interactive Admin Tools v$version

Available commands:

event {host}, lu {host}, trace {host}, 
ping {host}, st {host}, hw {host}, 
cls, menu, setup, help, exit

"
}
function showHelp {
    echo "Interactive Admin Tools v$version

event `t {host}       `t - Show Event Viewer (eventvwr) for host
lu    `t {host}       `t - Lookup DNS (nslookup) info for IP/hostname
trace `t {host}       `t - Run traceroute (tracert) to host
ping `t {host}       `t - Ping host
st `t {host}        `t - Get BIOS Serial Tag from host
hw `t {host}        `t - Get Hardware info from host

cls/clear             `t - Clear screen
menu                  `t - Show menu
setup                 `t - Create environment variable for this program to run it from cmd.exe with 'iat'
help                  `t - Show help
exit/q                `t - Exit. Doh

Problems running commands? Remember to run script as domain administrator
"
}

cls
showMenu

do {

    $input = read-host ">>> "
    $input = $input -split ' '
    $cmd   = $input[0]
    $param = $input[1]

    switch ($cmd)
    {
        'event' {
            eventvwr $param
        }

        'lu' {
            if($param) {
                nslookup $param
            }
        }

        'trace' {
            if($param) {
                tracert $param
            }
        }

        'ping' {
            ping $param
        }

        'st' {
            if($param) {
                $st = Get-WmiObject -computername $param -class win32_bios | select SerialNumber
                echo $st
            }
        }
        'hw' {
            if($param) {
                $ram = Get-WmiObject -computername $param -class win32_computersystem | select TotalPhysicalMemory
                $cpu = Get-WmiObject -computername $param -class Win32_Processor | select Name, NumberOfCores
                $gpu = Get-WmiObject -computername $param -class Win32_DisplayConfiguration | select DeviceName
                $os = Get-WmiObject -computername $param -class Win32_OperatingSystem | select Caption, OSArchitecture
                echo "CPU: $cpu"
                echo "RAM: $ram"
                echo "GPU: $gpu"
                echo " OS: $os"
            }
        }
        






        'setup' {
            echo "`nCreating (User) environment variable '%iat%'..."
            [Environment]::SetEnvironmentVariable("iat", "powershell $PSCommandPath", "User")
            echo "`nComplete!`n`nYou can now start InteractiveAdminTools by simply typing %iat% in your command prompt."
        }

        'menu' {
            showMenu
        }
        'help' {
            showHelp
        }
        'cls' {
            cls
        }
        'clear' {
            cls
        }

        'q' {
            return<commit_msg>InteractiveAdminTools get remote processes or filter by process name<commit_after>﻿#
# Description: Interactive Powershell program to retrieve data about remote host
# Author:      <NAME>
# Website:     https://github.com/kek91
#
# Known bug: For some reason the "st" command won't
# output anything the first time, you have to run it twice...
#

$version = "0.2.0"

$commands = @(
    "eventvwr",
    "lookup",
    "ping"
)


function showMenu {
    echo "Interactive Admin Tools v$version

Available commands:

event {host}, lu {host}, trace {host}, 
ping {host}, st {host}, hw {host},
p {host} {process},
cls, menu, setup, help, exit

"
}
function showHelp {
    echo "Interactive Admin Tools v$version

event `t {host}       `t - Show Event Viewer (eventvwr) for host
lu    `t {host}       `t - Lookup DNS (nslookup) info for IP/hostname
trace `t {host}       `t - Run traceroute (tracert) to host
ping `t {host}       `t - Ping host
st `t {host}        `t - Get BIOS Serial Tag from host
hw `t {host}        `t - Get Hardware info from host
p `t {host} {process} - List running processes on host or if the specific process is running

cls/clear             `t - Clear screen
menu                  `t - Show menu
setup                 `t - Create environment variable for this program to run it from cmd.exe with 'iat'
help                  `t - Show help
exit/q                `t - Exit. Doh

Problems running commands? Remember to run script as domain administrator
"
}

cls
showMenu

do {

    $input = read-host ">>> "
    $input = $input -split ' '
    $cmd   = $input[0]
    $param = $input[1]
    $param2= $input[2]

    switch ($cmd)
    {
        'event' {
            eventvwr $param
        }

        'lu' {
            if($param) {
                nslookup $param
            }
        }

        'trace' {
            if($param) {
                tracert $param
            }
        }

        'ping' {
            ping $param
        }

        'st' {
            if($param) {
                $st = Get-WmiObject -computername $param -class win32_bios | select SerialNumber
                echo $st
            }
        }
        'hw' {
            if($param) {
                $ram = Get-WmiObject -computername $param -class win32_computersystem | select TotalPhysicalMemory
                $cpu = Get-WmiObject -computername $param -class Win32_Processor | select Name, NumberOfCores
                $gpu = Get-WmiObject -computername $param -class Win32_DisplayConfiguration | select DeviceName
                $os = Get-WmiObject -computername $param -class Win32_OperatingSystem | select Caption, OSArchitecture
                echo "CPU: $cpu"
                echo "RAM: $ram"
                echo "GPU: $gpu"
                echo " OS: $os"
            }
        }
        'p' {
            if($param) {
                if($param2) {
                    $p = Get-Process $param2* -computername $param
                }
                else {
                    $p = Get-Process -computername $param
                    #tasklist /S lt-0085
                }
                echo $p
            }
        }






        'setup' {
            echo "`nCreating (User) environment variable '%iat%'..."
            [Environment]::SetEnvironmentVariable("iat", "powershell $PSCommandPath", "User")
            echo "`nComplete!`n`nYou can now start InteractiveAdminTools by simply typing %iat% in your command prompt."
        }

        'menu' {
            showMenu
        }
        'help' {
            showHelp
        }
        'cls' {
            cls
        }
        'clear' {
            cls
        }

        'q' {
            return
{'fraction_non_alphanumeric': 0.10268446530731994, 'fraction_numerical': 0.006161067918439196, 'mean_word_length': 1.5459297983569829, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1369506', 'n_tokens_mistral': 2069, 'n_tokens_neox': 1929, 'n_words': 630}