Skip to main content

Windows admin commands

1) shutdown
Shut Down: shutdown /s /t 0
Restart: shutdown /r /t 0
Restart Into Startup Options: shutdown /r /o

2) recimg – Create Custom Recovery Images

    recimg /createimage path

3)  sfc /scannow – Scan System Files for Problems

4) netstat -an – List Network Connections and Ports

5)Find the five processes using the most memory (Power shell)

ps | sort –p ws | select –last 5

6)Cycle a service (stop, and then restart it) like DHCP -- (Power shell)

Restart-Service DHCP

7) Search a string in current path  (Power shell)

dir -r  | select-string stringname

8) To get the system info and summary

net statistics server/workstatition -uptime info

C:\Users\vishnu>systeminfo | more

Host Name:                 DESKTOP-JGGFDUJ
OS Name:                   Microsoft Windows 10 Pro
OS Version:                10.0.10586 N/A Build 10586
OS Manufacturer:           Microsoft Corporation
OS Configuration:          Standalone Workstation
OS Build Type:             Multiprocessor Free
Registered Owner:          vishnu
Registered Organization:
Product ID:                00331-10000-00001-AA644
Original Install Date:

9) To see all network connections your client has open, run this command:

net use

10. To see your routing table, run either of these commands:

route print

netstat -r

11. Need to run a trace, but don’t have Netmon or Wireshark, and aren’t allowed to install either one? Run this command:

netsh trace start capture=yes tracefile=c:\capture.etl

netsh trace stop

12. To quickly open a port on the firewall, run this command, changing the name, protocol, and port to suit. This example opens syslog:

netsh firewall set portopening udp 161 syslog enable all

13. To add an entry to your routing table that will be permanent, run the route add command with the –p option. Omitting that, the entry will be lost at next reboot:

route add 0.0.0.0 mask 0.0.0.0 172.16.250.5 –p

14. Here’s a simple way to see all open network connections, refreshing every second:

netstat –ano 1

15. You can add a | findstr value to watch for only a specific connection, like a client ip.addr or port:

netstat –ano | findstr 216.134.217.20

16. logs through command line

Get-Eventlog
Get-WinEvent -logname application/system

Get-Eventlog -Log Application -New 3 | Format-list | out-file list.txt

17. Get-service

18 Stop-service

19. Get-process

20 .
Stop-Process -Name notepad

Stop-Process -ID 2668
 
 
 


Comments

Popular posts from this blog

WiFI connection

    root@kali:~# iw dev root@kali:~# ip link set wlan0 up root@kali:~# iw wlan0 scan root@kali:~# wpa_passphrase blackMOREOps >> /etc/wpa_supplicant.conf root@kali:~# wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf root@kali:~# iw wlan0 link root@kali:~# dhclient wlan0 root@kali:~# ping 8.8.8.8 (Where wlan0 is wifi adapter and blackMOREOps is SSID) (Add Routing manually) root@kali:~# ip route add default via 10.0.0.138 dev wlan0    

Modsecurity block rule for XMLRPC and wp-login attack

SecAction phase:1,nolog,pass,initcol:ip=%{REMOTE_ADDR},initcol:user=%{REMOTE_ADDR},id:5000134  <Locationmatch "/wp-login.php">  SecRule user:bf_block "@gt 0" "deny,status:401,log,id:5000135,msg:'ip address blocked for 5 minutes, more than 10 login attempts in 3 minutes.'"  SecRule RESPONSE_STATUS "^302" "phase:5,t:none,nolog,pass,setvar:ip.bf_counter=0,id:5000136"  SecRule RESPONSE_STATUS "^200" "phase:5,chain,t:none,nolog,pass,setvar:ip.bf_counter=+1,deprecatevar:ip.bf_counter=1/180,id:5000137"  SecRule ip:bf_counter "@gt 10" "t:none,setvar:user.bf_block=1,expirevar:user.bf_block=300,setvar:ip.bf_counter=0"  </Locationmatch>  SecAction phase:1,nolog,pass,initcol:ip=%{REMOTE_ADDR},initcol:user=%{REMOTE_ADDR},id:5000234  <Locationmatch "/xmlrpc.php">  SecRule user:bf_block "@gt 0" "deny,status:401,log,id:5000235,msg:'ip address blocked for 5 m...

Apache tuning documentation

Apache bench marking ======================= Things or checklist to be considered before the test     CPU: avoid power-saving mode. cpufreq-set -g performance.     File descriptors: raise the limit to (at least) the number of concurrent connections you wish to handle, using ulimit -n in your shell, or setrlimit(RLIMIT_NOFILE) in your server. Beware, some systems forbid you to raise the limit, you might need to investigate a bit to find how to unlock it.     Disable the logs of your server (you do not want to lose time logging thousands of requests instead of answering them).     Raise /proc/sys/net/somaxconn to the number of concurrent connections you want to handle. To understand why this is necessary, read the technical report or the excellent paper Measuring the Capacity of a Web Server (Banga and Druschel, Usenix 97). More on the fascinating topic of the accept() queue can be found in accept()able Strategies for Im...