TLDRBins TLDRBins / NTP


Usage Tips:

  • Click on a keyword to enable inline editing.
  • Click inside a code block to copy (excludes comments).
  • Use the button to view examples.
  • Click outside to collapse all examples.

Check Server Time

sudo nmap -sU -sV --script "ntp* and (discovery or vuln) and not (dos or brute)" -p 123 <TARGET>
Sample Output: TO-DO

Check Time Skew

date; ntpdate -q <TARGET>
Sample Output: TO-DO

Update Time

Fix ntpdate from doing nothing

sudo apt install chrony
Sample Output: TO-DO
sudo timedatectl set-ntp true
Sample Output: TO-DO
sudo ntpdate -s <TARGET>
Sample Output: TO-DO
# After getting the time skew faketime -f <TIME_DIFF> <COMMAND>
Sample Output: TO-DO
# Get from http server faketime "$(curl -sI <TARGET> | grep 'Date:' | awk -F 'Date:' '{print $2}')" <COMMAND>
Sample Output: TO-DO

1. Disable NTP

sudo timedatectl set-ntp false
Sample Output: TO-DO

2. Set Timezone

sudo timedatectl set-timezone GMT
Sample Output: TO-DO

3. Get Time from DC

./nmap -p445 -sCV -Pn <DC>
Sample Output: sshuser@nix01:/dev/shm$ ./nmap -p445 -sCV -Pn 192.168.20.10 Host discovery disabled (-Pn). All addresses will be marked 'up' and scan times will be slower. Starting Nmap 7.91 ( https://nmap.org ) at 2024-11-07 16:21 UTC Nmap scan report for 192.168.20.10 Host is up (0.00078s latency). PORT STATE SERVICE VERSION 445/tcp open microsoft-ds? Host script results: |_clock-skew: 6h59m07s |_nbstat: NetBIOS name: DC, NetBIOS user: <unknown>, NetBIOS MAC: 00:50:56:b0:a7:78 (VMware) | smb2-security-mode: | 2.02: |_ Message signing enabled and required | smb2-time: | date: 2024-11-07T23:20:38 |_ start_date: N/A Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 46.80 seconds

4. Set Time

sudo date -s '<DATE>'
Sample Output: $ sudo date -s '2024-11-07T23:20:38' Thu Nov 7 23:20:38 GMT 2024