学习使用PSTools工具中的psping
初识PsTools
在工作中我们都会想探测某个IP是否能通,基本上都使用过ping命令,但是某些服务器禁用了ping,而且有些时候也想探测某个IP的某个端口是否能通。之前的我一般都是用“telnet ip port”,但是我发现一个不好的体验就是没啥明显的结果,不通的时候会超时要等一下下,通的时候也没啥友好的提示。所以就搜到了【PStools下载】,里面的“psping”命令就很适合我这个要求。
PsTools是一款非常好用的远程管理工具应用软件,PsTools软件为用户提供了非常强大的功能,支持远程打开文件、终止进程、关闭重启计算机等。非常的实用。
其中包含的工具简介如下:
| 命令名 | 命令用途 |
|---|---|
| PsExec | 远程执行进程 |
| PsFile | 显示远程打开的文件 |
| PsGetSid | 显示计算机或用户的 SID |
| PsInfo | 列出有关系统的信息 |
| PsKill | 按名称或进程 ID 终止进程 |
| PsList | 列出有关进程的详细信息 |
| PsLoggedOn | 查看在本地通过资源共享(包含所有资源)登录的用户 |
| PsLogList | 转储事件日志记录 |
| PsPasswd | 更改帐户密码 |
| PsService | 查看和控制服务 |
| PsShutdown | 关闭并重新启动(可选)计算机 |
| PsSuspend | 暂停进程 |
| PsUptime | 最后重启后系统运行的时间 |
| psping | ICMP Ping、TCP Ping、延迟测试、带宽测试 |
psping
下面是“psing -?”查看的帮助信息
PsPing v2.10 - PsPing - ping, latency, bandwidth measurement utility
Copyright (C) 2012-2016 Mark Russinovich
Sysinternals - www.sysinternals.com
PsPing implements Ping functionality, TCP ping, UDP/TCP latency, and UDP / TCP
bandwidth measurement.
Help usage: psping -? [i|t|l|b]
-? i Usage for ICMP ping.
-? t Usage for TCP ping.
-? l Usage for latency test.
-? b Usage for bandwidth test.
-nobanner Do not display the startup banner and copyright message.
1.使用ICMP ping
执行“psping -? i”
PsPing v2.10 - PsPing - ping, latency, bandwidth measurement utility
Copyright (C) 2012-2016 Mark Russinovich
Sysinternals - www.sysinternals.com
ICMP ping usage: psping [-t|-n count[s]] [-i interval] [-w count] [-q] [-h [buckets|val1,val2,...]] [-l requestsize[k]] [-6|-4] destination
-t Ping until stopped with Ctrl+C and type Ctrl+Break
for statistics.
-n Number of pings or append 's' to specify seconds e.g. '10s'.
-i Interval in seconds. Specify 0 for fast ping.
-w Warmup with the specified number of iterations (default is 1).
-q Don't output during pings.
-h Print histogram (default bucket count is 20).
If you specify a single argument, it's interpreted as a bucket
count and the histogram will contain that number of
buckets covering the entire time range of values.
Specify a comma-separated list of times to create a custom
histogram (e.g. "0.01,0.05,1,5,10").
-l Request size. Append 'k' for kilobytes.
-4 Force using IPv4.
-6 Force using IPv6.
For high-speed ping tests use -q and -i 0.
执行psping -4 -n 10 -w 2 -h 10 www.baidu.com
- -4 代表强制使用IPv4联机
- -n 代表正式ping包的个数,或者定义使用秒s作为单位
- -w 代表热身ping包的个数,即正式测试前先进行多少次热身测试连接
- -h 代表最小与最大延迟毫秒数

另外几个参数解释如下:
- -i 代表间隔秒数,快ping则设置为0
- -l 代表ping包大小,默认单位是byte。使用 k为单位代表kilobytes(KB),使用m为单位代表megabytes(MB)
- -q 代表ping过程中不一个个输出值
- -t 代表长ping不停
- -6 代表强制使用IPv6联机
2.使用TCP ping
执行“psping -? t”
PsPing v2.10 - PsPing - ping, latency, bandwidth measurement utility
Copyright (C) 2012-2016 Mark Russinovich
Sysinternals - www.sysinternals.com
TCP ping usage: psping [-t|-n count[s]] [-i interval] [-w count] [-q] [-h [buckets|val1,val2,...]] [-6|-4] destination:port
-t Ping until stopped with Ctrl+C and type Ctrl+Break
for statistics.
-n Number of pings or append 's' to specify seconds e.g. '10s'.
-i Interval in seconds. Specify 0 for fast ping.
-w Warmup with the specified number of iterations (default is 1).
-q Don't output during pings.
-h Print histogram (default bucket count is 20).
If you specify a single argument, it's interpreted as a bucket
count and the histogram will contain that number of
buckets covering the entire time range of values.
Specify a comma-separated list of times to create a custom
histogram (e.g. "0.01,0.05,1,5,10").
-4 Force using IPv4.
-6 Force using IPv6.
For high-speed ping tests use -q and -i 0.
与ping功能相同的参数定义:
- -n 代表正式ping包的个数,或者定义使用秒s作为单位
- -w 代表热身ping包的个数,即正式测试前先进行多少次热身测试连接
- -h 代表最小与最大延迟毫秒数
- -i 代表间隔秒数,快ping则设置为0
- -l 代表ping包大小,默认单位是byte。使用 k为单位代表kilobytes(KB),使用m为单位代表megabytes(MB)
- -q 代表ping过程中不一个个输出值
- -t 代表长ping不停
- -4 代表强制使用IPv4联机
- -6 代表强制使用IPv6联机

3.延迟测试
执行“psping -? l”
PsPing v2.10 - PsPing - ping, latency, bandwidth measurement utility
Copyright (C) 2012-2016 Mark Russinovich
Sysinternals - www.sysinternals.com
TCP and UDP latency usage:
server: psping [-6|-4] [-f] -s address:port
client: psping -l requestsize[k|m] -n count[s] [-r] [-u] [-w count] [-f] [-h [buckets|val1,val2,...]] [-6|-4] destination:port
-l Request size. Append 'k' for kilobytes and 'm' for megabytes.
-n Number of sends/receives. Append 's' to specify seconds e.g. '10s'.
-r Receive from the server instead of sending.
-u UDP (default is TCP).
-w Warmup with the specified number of iterations (default is 5).
-f Open source firewall port during the run.
-h Print histogram (default bucket count is 20).
If you specify a single argument, it's interpreted as a bucket
count and the histogram will contain that number of
buckets covering the entire time range of values.
Specify a comma-separated list of times to create a custom
histogram (e.g. "0.01,0.05,1,5,10").
-4 Force using IPv4.
-6 Force using IPv6.
-s Server listening address and port.
The server can serve both latency and bandwidth tests and remains active until
you terminate it with Control-C.
执行psping -l 1500 -n 300 -h 10 www.qq.com:443
- -l 1500代表我发送的数据包大小为每个1500 Bytes,TCP联机在Layer 2 Ethernet中的MTU (Maximum Transmission Unit)通常以1500 Bytes为一个单位
- -n 300代表放松300个封包

4.带宽测试
PsPing v2.10 - PsPing - ping, latency, bandwidth measurement utility
Copyright (C) 2012-2016 Mark Russinovich
Sysinternals - www.sysinternals.com
TCP and UDP bandwidth usage:
server: psping [-6|-4] [-f] -s address:port
client: psping -b -l requestsize[k|m] -n count[s] [-r] [-u [target]] [-i outstanding] [-w count] [-f] [-h [buckets|val1,val2,...]] [-6|-4] destination:port
-b Bandwidth test.
-l Request size. Append 'k' for kilobytes and 'm' for megabytes.
-n Number of sends/receives. Append 's' to specify seconds e.g. '10s'.
-r Receive from the server instead of sending.
-u UDP (default is TCP). Specify target bandwidth in MB/s.
-i Number of outstanding I/Os (default is min of 16 and 2x CPU cores).
-w Warmup for the specified iterations (default is 2x CPU cores).
-f Open source firewall port during the run.
-h Print histogram (default bucket count is 20).
If you specify a single argument, it's interpreted as a bucket
count and the histogram will contain that number of
buckets covering the entire time range of values.
Specify a comma-separated list of times to create a custom
histogram (e.g. "0.01,0.05,1,5,10").
-4 Force using IPv4.
-6 Force using IPv6.
-s Server listening address and port.
The server can serve both latency and bandwidth tests and remains active until
you terminate it with Control-C.
执行psping -b -l 1500 -n 15000 www.qq.com:443
- -b 代表将进行带宽测试
- -l 1500代表使用大小1500Bytes的数据包
- -n 15000代表使用15000个数据包
执行结果显示我的PC和www.qq.com之间带宽为:526.12 KB/s

5.同功能的tcping工具
还有一个在禁止ping的情况下可以在windows上部署tcping64.exe或者tcping.exe工具来检测服务器端口是否开放windows下【tcping工具下载】,执行命令“tcping -t www.baidu.com 443”

总结
- 当发现当前做法有不方便时就是寻找更好解决方案的时候。
- 上面这些命令,相信在很多判断网络的场景很常用,以后可以happy了。
学习使用PSTools工具中的psping的更多相关文章
- Java学习-041-颜色工具类(RGB,HEX)
在日常的网页开发中,经常需要进行颜色数值获取.转换,例如获取红色,获取蓝色,获取绿色,RGB转十六进制颜色,十六进制颜色转RGB等,因而在学习过程中,写了一个小工具类,仅供各位小主参考! 多不闲言,直 ...
- SSH 框架学习之初识Java中的Action、Dao、Service、Model-收藏
SSH 框架学习之初识Java中的Action.Dao.Service.Model-----------------------------学到就要查,自己动手动脑!!! 基础知识目前不够,有感性 ...
- Java学习-049-正则工具类
自去年九月份决定再次入学和职业资格进阶,开始备战二者考试至今,以及当下进行中的职称申请,犹如孤独的狼,不断前行在路上,而今凡凡总总的已历8月... 不感慨了,如下为一园友需要的正则工具类,直接上码: ...
- 关于解决Python中requests模块在PyCharm工具中导入问题
问题引入: 今天在学习Python网络请求的时候,导入requests模块时一直报红色波浪线,如图: 反复折腾,一直以为自己没有安装requests模块,反复安装反复卸载: 安装方法: 首先 cd 进 ...
- 在chrome开发者工具中观察函数调用栈、作用域链与闭包
在chrome开发者工具中观察函数调用栈.作用域链与闭包 在chrome的开发者工具中,通过断点调试,我们能够非常方便的一步一步的观察JavaScript的执行过程,直观感知函数调用栈,作用域链,变量 ...
- 在 Chrome 开发者工具中调试 node.js
命令行工具 devtool ,它可以在 Chrome 的开发者工具中运行 Node.js 程序. 下面的记录显示了在一个 HTTP 服务器中设置断点的情况. 该工具基于 Electron 将 Node ...
- [译]学习Javascript的工具
本文翻译youtube上的up主kudvenkat的javascript tutorial播放单 源地址在此: https://www.youtube.com/watch?v=PMsVM7rjupU& ...
- jQuery源代码学习笔记_工具函数_noop/error/now/trim
jQuery源代码学习笔记_工具函数_noop/error/now/trim jquery提供了一系列的工具函数,用于支持其运行,今天主要分析noop/error/now/trim这4个函数: 1.n ...
- CockroachDB学习笔记——[译]CockroachDB中的SQL:映射表中数据到键值存储
CockroachDB学习笔记--[译]CockroachDB中的SQL:映射表中数据到键值存储 原文标题:SQL in CockroachDB: Mapping Table Data to Key- ...
随机推荐
- python利用爬虫获取百度翻译,爱词霸翻译结果,制作翻译小工具
先看效果展示(仅作学习使用,非商业) 效果图是采用的 爱词霸 翻译,百度翻译 也实现了,只不过被注释了. 学计算机很多时候碰到生词,每次打开手机/浏览器翻译总觉得很麻烦,就想着自己写一个软件,自己去实 ...
- dotnet cli
前言 dotnet cli (Command-Line Interface) .net 源代码和二进制文件管理工具.需要安装 .NET Core SDK. 终端执行 dotnet --info 可以打 ...
- Jmeter 常用函数(15)- 详解 __StringFromFile
如果你想查看更多 Jmeter 常用函数可以在这篇文章找找哦 https://www.cnblogs.com/poloyy/p/13291704.htm 作用 从文本文件读取字符串,每次一行 需要注意 ...
- Golang omitempty 的用法
原文链接:https://blog.csdn.net/skh2015java/article/details/90720692omitempty作用是在json数据结构转换时,当该字段的值为该字段类型 ...
- 算法-heapq模块优先队列
heapq模块, 优先队列,小顶堆,最少值放在顶部,值越小,优先级越高 heapq.heappop(heap) 从堆中弹出最小的元素,并重新调整 heapq.heappush(heap, item)新 ...
- 第4篇 Scrum 冲刺博客(专✌️团队)
一.站立式会议 1.1会议图片 1.2成员完成情况 成员 昨天完成的任务 今天计划完成的任务 工作中的困难 陈忠明 按下载热度返回歌曲信息,与前端尝试交互 歌曲信息的上传/下载包 前后端交互问题 吴茂 ...
- Swift Expressible literal
Swift Expressible Literal 引子 从一个面试题说起.有如下代码: struct Book { let name: String } let book: Book = " ...
- 【Android】Android开发初学者实现拨打电话的功能,拨打电话app小demo实现
作者:程序员小冰,GitHub主页:https://github.com/QQ986945193 新浪微博:http://weibo.com/mcxiaobing 首先先给大家看一下最终实现的效果: ...
- 获取android手机的屏幕分辨率 android开发
/** * 获取屏幕分辨率 */ private void getResolution() { // TODO Auto-generated method stub Display display = ...
- 攻防世界——Misc新手练习区解题总结<2>(5-8题)
第五题gif: 下载附件后,解压得到这样一个文件 几经寻找无果后,发现是不是可以将gif中的黑白图片看做二进制的数字,进而进行解密 最后用二进制转文本得到flag 第六题掀桌子: 看起来是16进制的密 ...