1. Current Location: Home >  Router Encyclopedia >  netstat -ano to see who's connecting to the computer, caught stealing data from cloud drives

netstat -ano to see who's connecting to the computer, caught stealing data from cloud drives

The command netstat -ano outputs a comparison diagram of five rows and five TCP connection states

The desktop in the study was sluggish every night for a while, but speed tests were normal, with over 900MB running happily. One day, on a whim, I pressed Win+R and typed cmd, typing a netstat -ano and pressing Enter—scrolling the bar for three screens before it finally ended, with seventy or eighty connections hanging. Inside, there was a cloud storage client I had never even opened, with over thirty files by one person, all sent to the server. At that moment, I truly understood what value this command was: speed cameras tell you how thick the pipes are, and it tells you who's running inside them.

First, recognize three flags: a, n, and o each manage a section

The name of this command literally translates to "network statistics," which Windows comes with and doesn't require anything to be installed. Each of the three letters is a segment: -a means 'all', and also flip out the port labeled 'Listening'; if you don't add it, you can only see the established connection; -n is a number, so the IP and port are properly displayed as numbers; otherwise, the system will try to reverse the IP into a domain name, and it often won't work out after a long time; -o is most important. Reveal the process number PID behind each connection. Without this o, you won't know who to blame even if you see a hundred connections.

Typing all three at once, after pressing Enter, the output is five neat columns: protocol, local address, external address, status, and PID. Many people don't understand the local address column; it's actually the "address number on this end of your computer." The colon precedes your own IP, and the four- or five-digit numbers after the colon are the port numbers used for communication. This port is not fixed. Every time you visit the web, the system will randomly send you a message from 49152 upward. For example, when you make a call, your phone uses the line this time—if it hangs up, you return it and then switch to another one next time. The topic of port numbers has been written about before. Here, just remember the reading: the last parameter of the local address is the number you are randomly assigned; The last paragraph of an external address is the other party's service number: 443 is an encrypted webpage, 80 is a regular webpage, these two are the most common.

The five states make up a lifetime of a single phone

call

The status column is the soul of the entire command. TCP requires a handshake to establish a connection and a waving hand to disconnect. Each stage in between leaves a mark in the status bar. I translated them in the table as if making a call:

When does the ? . minutes, a the
status appear in adult terms? Should you panic
LISTENING: Waiting by the phone for someone to call a program, opening the port, waiting for someone to come and see who opened the door
SYN_SENT dialed out, but no one answered you. When you open a website that won't open, it keeps pausing = the other end doesn't respond
ESTABLISHED: Currently calling, webpage open, WeChat running, game playing normal, dozens of messages are quite ordinary
TIME_WAIT hang up, take a moment to slow down, then close the webpage. Within two to fourlarge area is normal, and you can walk CLOSE_WAIT
other party hangs up. If you haven't installed the program, you should have to close the line. If the line only rises and doesn't fall, that's the problem

The easiest to fool among them is TIME_WAIT. Once the webpage is closed, the connection doesn't disappear immediately; the system will let it hang for two to four minutes before regeneration. Windows defaults to close for nearly four minutes. So if you casually tap and see dozens of TIME_WAIT, that's not an anomaly—it's the webpage you closed in the past few minutes queuing out of the field. The real thing worth checking is CLOSE_WAIT: it means the other party has already disconnected, and your program should be ending the connection, but it confiscates. A few times a few times doesn't matter, but if the number keeps rising by hundreds or hundreds and you can't close all the software, then it's because the program malfunctioned and forgot to hang up—this kind of thing can't be saved by changing system parameters; if you restart the program, it usually ends immediately.

Flood the screen with foreign IPs, don't shout you're caught in the trap just yet

Many articles online have called netstat a magic tool for detecting trojans, causing many people to be shocked by the flood of unfamiliar IPs after typing, thinking their computers had been planted by someone. Let's start by pouring cold water: the ESTABLISHED of foreign addresses is mostly something you clicked on yourself. Every webpage you open, WeChat on your phone, and your backend cloud drive are all connected to a bunch of servers. Those seemingly strange IPs are mostly the website's CDN nodes and chat servers. With a casual tap on the machine in my study, there were fifty or sixty ESTABLISHED entries—so many that I couldn't even count them all.

A convenient way is to categorize by PID, not by IP. First, look at the fifth column to find the PIDs that appear most frequently, then go to the "Details" tab in Task Manager and sort by PID column. Once you match the process names, everything is clear. Dozens of connections are grouped across five or six processes—cloud drive, browser, WeChat, gaming platform—each one is managed, and this is clean.

The

one that really deserves a second look is the LISTENING segment, which has a trick ninety percent overlooked: if the local address says port 0.0.0.0, it opens the door facing all network cards, so other devices in the LAN can knock on it; if the colon port is set to 127.0.0.1, it only opens to your own local machine, and no one outside can reach you. For the same LISTENING, 127.0.0.1 can basically be overlooked, but 0.0.0.0 is worth considering: Remote Desktop 3389, File Sharing 445, etc., which I recognize, just open them yourself; The port number and process names are also unfamiliar 0.0.0.0.0 listeners, then check what that PID is all about. By the way, there's also a self-check approach on the router side: the ones caught aren't connections, but DNS and port mapping. I wrote before about checking for router hacking. The computer side and the router end end fit perfectly.

The time they caught stealing traffic, solved the case in three minutes

Back to the desktop that started at night and made a lot of weight. After typing the command, I copied down the most frequently appearing PID and went to Task Manager for a pair—the cloud drive client I had installed for half a year and hadn't opened much. More than thirty ESTABLISHED entries are all pointing to its server, all of which are being transmitted in a uniform state. When I opened it, I found that 'Auto-sync' was always on in the settings. I had tossed a batch of photos into a shared folder, and it quietly moved them out every day, catching the evening rush hour, with the uplink completely dominated. Once the upstream is fully occupied, the webpage opens with a flesh. This logic is Who at home is stealing data, but that time it was caught in the router's backend; this time, it was caught on the computer.

This kind of backend transmission can't be detected by speed testing software—during those few seconds of speed testing, it gives way, and after the test, it continues transmitting. Netstat's charm is its snapshot: you can type a snapshot anytime, who is transmitting it, to whom is being transmitted, how many are hanging, and the image is revealed instantly. Later, my cousin's NAS had hundreds of connections and asked if I was panicking. What I asked him to check wasn't the computer's schedule, but the router's NAT session table—the computer's table only managed the local machine, < a href="https://www.shunot.com/en/lybk/992.html"> the router's session table managed the whole family. The two ledgers were two sides of the same thing. Bittorrent and similar download tools are naturally designed to connect to big players; dozens of messages are routine for them. Don't panic just because the numbers are huge.

Finishing: Strike the set in order

Using this command smoothly is essentially stringing together scattered words into actions. My own habit is five steps:

to do. a clear idea. Step it : in the . : check the . Step Search for unfamiliar names
Decide the order and see what
Step one: type netstat -ano, output redirect, save a file, count the total quantity first, have
two: categorize the status column and countESTABLISHED Dozens of bars are normal, TIME_WAIT is normal
Step threecheck the number of CLOSE_WAIThundreds, which only rise, not fall, and find the problematic program
Step fourlocal LISTENING address 0.0.0.0 for each process and let go of 127.0.0.1
fivein the High-Frequency PID in Task Manager, and don't mess with system processes

And two more reminders. First, netstat has an -b parameter that can directly show which program file the connection belongs to, saving you the trouble of working with the PID. However, it requires administrator status to run cmd, so for convenience, use the "-ano plus task manager" combination. Second, don't get excited if you see a bunch of connections hanging svchost.exe. It's a Windows system service container, originally a patriarch. If you want to check, right-click to check the services it carries. The article on TCP and UDP explained what connections are all about. Paired with a few wireless tips from netsh, you can basically handle all your home network issues, from the network card to the connection. All the tools are given away in the system; the only thing missing is the one click to press Enter button.

Read More


Copyright Notice Scan to read on mobile
All Rights Reserved: 《SHUNOT》 => 《netstat -ano to see who's connecting to the computer, caught stealing data from cloud drives》
Article URL: https://www.shunot.com/en/lybk/1243.html
Unless otherwise stated, all articles are original by 《SHUNOT》. Reposting is welcome! Please indicate the original URL when reposting, thank you.

Contact Us

Online Consultation: Click here to send me a message

WeChat ID: master_135

Scan to follow