COMMAND SHELL Flashcards

1
Q

recursive where command

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
1
Q

where command

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

find command

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

commands for finding files and directories and filtering

A

where
where /R
find
findstr
comp
fc
sort

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

local access to command prompt

A

Using the Windows key + r to bring up the run prompt, and then typing in cmd.

OR

Accessing the executable from the drive path C:\Windows\System32\cmd.exe

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

remote access to command prompt

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

command shell general commands

A

help
Get-help
Update-help
Ctrl-C
Get-Module
Import-Module
Get-Command
Set-Location <path>
Get-content <file>
systeminfo
hostname
ver</file></path>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

help <command></command>

A

provides help information for windows commands

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

get-help <cmdlet></cmdlet>

A

displays help about Windows Powershell cmdlets and concepts

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

update-help

A

downloads and installs the most up to date help files for windows powershell

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

get-module

A

view the modules loaded into your powershell session

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

ctrl-c

A

interrupts the currently running process

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

import-module

A

import a module into your powershell session

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

get-command

A

view all commands,cmdlets,functions and aliases loaded into your powershell environment

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

set-location <path></path>

A

changes our location in the filesystem. same as using CD

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

get-content <file></file>

A

view the contents of an object. similar to type or cat

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

systeminfo

A

displays the operating system configuration information for a local or remote machine

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

hostname

A

Displays name of the current host

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Terminal History Commands

A

doskey /history
page up
page down
f3
f7
f9

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

ver

A

Displays the current Windows version

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Admin Commands

A

xfreerdp /v:<target> /u:<user> /p:<password>
ssh <user>@<target></target></user></password></user></target>

<PIPE>
</PIPE>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

xfreerdp /v:<target> /u:<user> /p:<password></password></user></target>

A

Initiate a RDP connection with the target host.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Command Description
xfreerdp /v:<target> /u:<user> /p:<password> Initiate a RDP connection with the target host.
ssh <user>@<target></target></user></password></user></target>

A

Connect to a target host via SSH

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

<PIPE>
</PIPE>

A

When you see <PIPE> specified in the commands below, it is saying to use the Pipe key (shift+backslash on US Keyboard layouts).</PIPE>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

File & Directory Commands
CMD.exe

A

dir
cd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

cls

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

dir

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

dir /A

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

dir /A:H

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

dir /A:R

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

cd

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

chdir

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

tree

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

tree /F

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

mkdir

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

md

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

rmdir

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

rd

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

rmdir /S

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

move

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

xcopy

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

copy

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q

xcopy /E

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q

robocopy

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q

xcopy /K

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
42
Q

robocopy /E /MIR /A-:SH

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
43
Q

more

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
44
Q

more /S

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
45
Q

fsutil file createNew

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
46
Q

type

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
47
Q

echo

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
48
Q

ren

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
49
Q

del

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
50
Q

del /A:R

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
51
Q

del /A:H

A
52
Q

[command 1] > [file]

A

Redirects the output from a command into a file. Overwrites the specified files’ contents.

53
Q

erase

A
54
Q

[command 1] &raquo_space; [file]

A

Redirects the output from a command into a file. Appends additional output without overwriting the file’s original contents.

54
Q

[command 1] < [file]

A

redirects the output of the file and passes it into the command.

55
Q

<command 1> | <command 2>

A

Redirects the output of the first command into a <PIPE> and provides it to the second command.</PIPE>

56
Q

<command 1> || <command 2>

A

Checks to see if the first command fails to execute successfully and, if so, proceeds to execute the second command.

57
Q

<command 1> & <command 2>

A

Executes both commands in succession. It does not perform checks to see if either command passes or fails.

58
Q

where <file></file>

A

Displays the location of file(s) provided.

59
Q

<command 1> && <command 2>

A

Checks to see if the first command executes successfully and then executes the second command. If the first command fails, the current command execution halts and the second command is not executed.

59
Q

Input/Output Operators

A
59
Q

find “example string” <file></file>

A

Searches for a string of text in a file or files, and displays lines of text that contain the specified string.

60
Q

where /R <working> <file></file></working>

A

Recursively searches for the file(s) provided starting from the specified directory.

61
Q

findstr

A

Searches for patterns of text in files
similar to grep command

62
Q

comp <file1><file2></file2></file1>

A

Compares the contents of two files or sets of files byte-by-byte.

63
Q

fc <file1><file2></file2></file1>

A

Compares two files or sets of files and displays the differences between them.

64
Q

sort

A

Reads input, sorts data, and writes the results to the screen, a file, or another device.

65
Q

user commands
cmd.exe

A

whoami
whoami /priv
whoami /groups
whoami /all
net user
net local groups
net group

66
Q

whoami

A

Displays the username of the currently logged-on user.

67
Q

whoami /priv

A

Displays the security privileges of the current user.

68
Q

whoami /groups

A

Displays the user groups that the current user belongs to.

69
Q

whoami /all

A

Displays all information about the current user, including username, security identifiers (SID), privileges, and groups.

69
Q

net user

A

Displays a list of the user accounts on the computer

70
Q

net localgroup

A

Displays the name of the server and the names of local groups on the computer.

71
Q

netshare

A

Displays info about all of the resources that are shared on the local computer.

71
Q

ipconfig

A

View basic networking configurations.

72
Q

ipconfig /?

A

Displays help and usage information for ipconfig.

72
Q

net group

A

Displays the name of a server and the names of groups on the server. Only able to be used if the machine is joined to the domain.

73
Q

ipconfig /all

A

View detailed networking configuration information.

74
Q

net

A

CLI utility containing multiple commands to manage and configure network resources.

75
Q

net view

A

Displays a list of domains, computers, or resources being shared by the specified computer.

76
Q

arp

A

Displays and manages the contents and entries within the Address Resolution Protocol (ARP) cache.

77
Q

arp /a

A

Displays the contents and entries contained within the Address Resolution Protocol (ARP) cache.

78
Q

netstat -an

A

Display current network connections.

79
Q

nslookup <query></query>

A

Query DNS for a name or address.

80
Q

sc query <Name></Name>

A

Lists details about a specific service by name.

80
Q

Services Commands
CMD.exe

A

sc query
sc query <Name>
sc start <Name>
sc stop <Name>
sc config <Name> start = disabled
tasklist /svc
net start
wmic service list brief</Name></Name></Name></Name>

80
Q

sc query

A

Lists all running services and provides additional information for each service.

81
Q

sc start <Name></Name>

A

Start a service by name.

82
Q

sc stop <Name></Name>

A

Stop a service by name.

83
Q

sc config <Name> start = disabled</Name>

A

Change settings of the service specified.

84
Q

tasklist /svc

A

Provide a list of services running under each process on the system.

85
Q

net start

A

List all running services.

86
Q

wmic service list brief

A

List all services on the system using WMIC. Includes information such as: ExitCode, Name, ProcessID, StartMode, State, and Status.

87
Q

Address Resolution Protocol (ARP)

A
88
Q

Scheduled Tasks
Commands

A

schtasks
schtasks /query
schtasks /query /V /FO list
schtasks /create
schtasks /create /sc <Schedule> /tn <Task> /tr <Program>
schtasks /change
schtasks /change /tn <Task> /ru <Username> /rp <Password>
schtasks /delete
schtasks /delete /tn <task></task></Password></Username></Task></Program></Task></Schedule>

89
Q

schtasks

A

Displays all tasks scheduled on the local machine.

90
Q

schtasks /query

A

Displays all tasks scheduled on the local machine. Interchangeable with schtasks command.

91
Q

schtasks /query /V /FO list

A

Displays all scheduled tasks with verbose information in a list format.

92
Q

schtasks /create

A

Allows for the creation of scheduled tasks.

93
Q

schtasks /delete

A

Allows for the deletion of scheduled tasks.

93
Q

schtasks /change

A

Allows for modification of an existing scheduled task.

94
Q

schtasks /delete /tn <task></task>

A

Deletes a scheduled task with the matching name.

95
Q

schtasks /change /tn <task> /ru <username> /rp <password></password></username></task>

A

Modifies a scheduled task with a specified name to run under the permissions of the user account using the provided password for authentication.

96
Q

schtasks /create /sc <Schedule> /tn <Task> /tr <Program></Program></Task></Schedule>

A

Creates a new scheduled task based on a select schedule, with a provided name, and a program specified to run when the task starts.

97
Q

Invoke-WebRequest -Uri “https://website-to-visit” -Method GET

A
98
Q

Invoke-WebRequest -Uri “https://website-to-visit.html” -Method GET <PIPE> fl Images</PIPE>

A
98
Q

Invoke-WebRequest -Uri “https://website-to-visit\file.ps1” -OutFile “C:<filename>”

A
99
Q

(New-Object Net.WebClient).DownloadFile(“https://website-to-visit\tools.zip”, “Tools.zip”)

A
100
Q

Event Log
Commands

A
101
Q

wevtutil el

A

Uses the Windows Events Commandline utility to enumerate all log sources.

102
Q

wevtutil qe <name> /c:5 /rd:true /f:text</name>

A

Query a log for events

102
Q

wevtutil epl <Name> C:\system_export.evtx</Name>

A

Export a log

102
Q

wevtutil gl “name”

A

Will gather config information about the log specified.

103
Q

Get-Winevent -listlog *

A

List all logging facilities using Powershell cmdlets

103
Q

Get-WinEvent -LogName ‘Name’ -MaxEvents 5 <PIPE> Select-Object -ExpandProperty Message</PIPE>

A

View the messages of a specific log

104
Q

Get-WinEvent -FilterHashTable @{LogName=’Security’;ID=’4625 ‘}

A

Query a specific log by eventID

105
Q

Registry Hives

A
106
Q

HKEY_CURRENT_CONFIG (HKCC)

A

This section contains records for the host’s current hardware profile. (shows the variance between current and default setups) Think of this as a redirection of the HKLM CurrentControlSet profile key.

107
Q

HKEY_CLASSES_ROOT (HKCR)

A

Filetype information, UI extensions, and backward compatibility settings are defined here.

108
Q

HKEY_USERS (HKU)

A

The local computer’s default User profile and current user configuration settings are defined under HKU.

108
Q

HKEY_CURRENT_USER (HKCU)

A

Value entries here define each user’s specific OS and software settings. Roaming profile settings, including user preferences, are stored under HKCU.

109
Q

HKEY_LOCAL_MACHINE (HKLM)

A

This subtree contains information about the computer’s physical state, such as hardware and operating system data, bus types, memory, device drivers, and more.

110
Q

Registry Commands

A
111
Q

Get-ChildItem -Path <HIVE>:\Path-to-key -Recurse</HIVE>

A

Recursively search through a Key and all subkeys.

112
Q

Get-Item -Path Registry::<HIVE>\Path-to-key\ <PIPE> Select-Object -ExpandProperty Property</PIPE></HIVE>

A

See the sub-keys and properties of a registry key.

113
Q

Get-ItemProperty -Path Registry::<HIVE>\Path-to-key\key</HIVE>

A

View the properties and values of a specific key.

114
Q

REG QUERY <HIVE>\PATH\KEY</HIVE>

A

Use reg.exe to query the registry.

115
Q

REG QUERY <HIVE> /F "Password" /t REG_SZ /S /K</HIVE>

A

Search for specific strings within the Registry hive.

116
Q

New-Item -Path <HIVE>:\PATH\ -Name KeyName</HIVE>

A

Create a new Registry Key.

117
Q

New-ItemProperty -Path <HIVE>:\PATH\KEY -Name "ValueName" -PropertyType String -Value "C:\Users\htb-student\Downloads\payload.exe"</HIVE>

A

Set a new Value pair within a registry Key.

118
Q

REG add “<HIVE>\PATH\KEY" /v access /t REG_SZ /d "C:\Users\htb-student\Downloads\payload.exe"</HIVE>

A

Use Reg.exe to create a new key/value pair.

119
Q

Remove-ItemProperty -Path <HIVE>:\PATH\KEY -Name "name"</HIVE>

A

Delete a key/value from the registry.