git clone https://github.com/cr0hn/dnscapy.git

easy_install Scapy

服务端:

python dnscapy_server.py a.friendsxxx.com 45.77.39.xxx

客户端:

ssh -o ProxyCommand="sudo python dnscapy_client.py a.friendsxxx.com 45.77.39.xxx" root@45.77.39.xxx

其中:a.friendsxxx.com是我dns tunnel的域名,而45.77.39.xxx是我的域名解析服务器IP(将a.friendsxxx.com的所有解析交给45.77.39.xxx)。

然后就可以访问ssh了。

传输文件:

scp -o ProxyCommand='sudo python dnscapy_client.py a.friendsxxx.com 45.77.39.xxx' wanted_file root@45.77.39.xxx:/tmp/

抓包分析下:

sudo tcpdump -i enp0s3 port 53 -w ~/dns_tunnel_tool/dnscapy/dnscapy_ssh.pcap

wireshark打开:

可以看到其传输数据的样子。

DNScapy is a DNS tunneling tool. The code is very light and written in Python. It includes a server and a client. The server can handle multiple clients.

DNScapy creates a SSH tunnel through DNS packets. SSH connection, SCP and proxy socks (SSH -D) are supported. You can use CNAME records or TXT records for the tunnel. The default mode is RAND, which uses randomly both CNAME and TXT.

DNScapy uses Scapy (http://www.secdev.org/scapy) for DNS packet forging and for his network automaton API.

DNScapy is still under development. The current version is 0.99b and seems to work pretty well. Feel free to clone and test it !

Software Requirements

Python >= 2.6
Scapy >= 2.1-dev (2.2 recommended)
Openssh
Linux (should work on Windows with some minor changes)

Note : once scapy is installed you have to patch a missing import.

Edit the file supersocket.py (located for example on /usr/local/lib/python2.6/dist-packages/scapy/supersocket.py)
Add the line: from scapy.packet import Padding

Hardware Requirements

To make a real DNS tunnel, you will need:

a client, typically a computer on a restricted network
a server, typically a computer with a full acces to Internet
a domain name (e.g. mydomain.com ) and an access on the configuration of its DNS server in order to delegate a zone (e.g. tunnel.mydomain.com) to your tunneling server

You can find further informations on how to delegate a DNS zone on websites like http://dnstunnel.de/ Howto

Here is a very short guide:

On the server:

sudo python dnscapy_server.py [DELEGATED_ZONE_NAME] [EXTERNAL_IP_ADDR]

On the client:

ssh -o ProxyCommand="sudo python dnscapy_client.py [DELEGATED_ZONE_NAME] [IP_ADDR_OF_CLIENT_DNS]" yourlogin@localhost

help and options:

./dnscapy_client.py -h ./dnscapy_server.py -h

It will not work if both client and server are on localhost. If you want to test it on the same computer I suggest to use a virtual machine. Why making a DNS tunnel ?

Because in most cases a security policy takes care of HTTP and forgets DNS. Let's consider two common situations:

You are not able to access to a specific website because of a HTTP proxy.
You are not be able to connect to a Hotspot because of a firewall that redirects HTTP requests of non-authenticated users.

In general, nothing is done to control the DNS resolution. Therefore you can break the two previous restrictions by making a DNS tunnel.

DISCLAIMER: We are not responsible at all for misuse of DNScapy. Bypassing a security policy is forbidden. Please use DNScapy only for test purposes in order to detect potential security holes in your own network. Why a SSH tunnel through DNS ?

转载于:https://www.cnblogs.com/bonelee/p/8037761.html

dnscapy使用——本质上是建立ssh的代理(通过dns tunnel)相关推荐

  1. ssh动态代理配置(Tunnel)

    当系统服务处于内网无法直接访问,只能通过一台跳板机进行ssh后才能访问时,可以配置ssh动态代理让本地具备直接访问内网服务的能力. 假设跳板机ip为172.30.0.100,ssh端口为22,内网服务 ...

  2. iodine免费上网——本质就是利用dns tunnel建立tcp,然后tcp proxy来实现通过访问虚拟dns0网卡来访问你的dns 授权server...

    我的命令: server端: sudo iodined -P passwd -f -DD 10.0.0.100 abc.com client端(直连模式,-r表示使用xxx.abc.com的xxx来转 ...

  3. java 建立ssh隧道_SSH基础

    SSH 基本概念 SSH 为 Secure Shell 的缩写,由 IETF 的网络小组(Network Working Group)所制定:SSH 为建立在应用层基础上的安全协议.SSH 是较可靠, ...

  4. 2D与3D人脸识别有什么本质上的区别?

    https://www.zhihu.com/question/324123433/answer/681365180 https://www.zhihu.com/question/324123433/a ...

  5. 【图论】用一道题从本质上讲清楚Floyd算法

    P1119 [灾后重建] 4 5 1 2 3 4 0 2 1 2 3 1 3 1 2 2 1 4 0 3 5 4 2 0 2 0 1 2 0 1 3 0 1 4 -1 -1 5 4 一道非常好的Flo ...

  6. 企业数字化转型本质上是“人”的转型和“组织”的转型

    2021年是机遇与挑战并存的一年.这场数字化变革摆在所有人面前,每个企业都必须重视起来,也不得不重视起了,因为数字化已经成为企业的起跑线了. 说起数字化,很多企业都认为是技术问题,认为企业数字化转型就 ...

  7. 宇宙和你,本质上其实只是个八维数字?

    剑桥大学的数学物理学家Cohl Furey正在寻找粒子物理标准模型和八元数之间的联系.八元数的乘法规则被编码在被称为法诺面的三角图中. 来源: 环球科学 对于一维.二维乃至四维的数字,人们都不陌生:一 ...

  8. 为什么说“按月订购”和“无人货架”本质上是一样的?

    封面图摄于青城山六善酒店,郭威从硅谷回来参加混沌创投营的活动,我正好也去蹭了一次课,于是便有了以上的录音.(点击收听录音:对话 UpHonest Capital 郭威) 在硅谷华人里真正投资做的好,能 ...

  9. PoW 本质上是个去中心化的时钟

    原文:Blockchain Proof-of-Work Is a Decentralized Clock 原文从区块链如何保持交易有序的基本问题出发,对该问题进行了详细阐述,并提出 PoW 本质上是实 ...

最新文章

  1. 一部IT电影,《反托拉斯行动》,主角加里-文斯顿(蒂姆·罗宾斯饰)影射比尔·盖茨...
  2. 【计算机网络(微课版)】第1章 概述 课后习题及答案
  3. 抽象工厂模式设计模式_21世纪的设计模式:抽象工厂模式
  4. 为什么 c = tf.matmul(a, b) 不立即执行矩阵乘法?
  5. 领航服务器系统,应用领航:盘点那些年我们一起追过的OS
  6. alchemy的Box2D版本
  7. activiti历史数据的查看
  8. 【重拾FPGA】三段式状态机的路口红绿灯
  9. python编写程序、一个富翁与陌生人做交易_智慧职教云课堂Python程序设计(常州工业职业技术学院)题目答案...
  10. 《跃迁:成为高手的技术》读后感
  11. linux怎么看网络连接网络,linux如何查看网络连接情况?
  12. 微信公众号 永久图文素材 content html sample
  13. 数据库应用之(云安全)
  14. Flutter 新版Navigator (一)
  15. 微机期末速通---不挂科版
  16. 【阿里云】阿里云跨账号内网互通
  17. C语言标准ANSI C、C语言的特点、C语言的关键字(32个)
  18. input选择框样式修改与自定义
  19. 了解传统教育培训机构的痛点
  20. 【戒焦戒躁,can win】Linux--IO缓冲区

热门文章

  1. Python多模块文件共享变量
  2. Ubuntu安装rabbitMQ及单机版rabbitMQ集群配置
  3. html5 video live
  4. mysql 视图列信息_MySQL 中获取用户表、用户视图、用户表中列信息
  5. python支持链式赋值和多重赋值_Python: 链式赋值的坑
  6. 为什么服务器虚拟化,为什么要进行服务器虚拟化
  7. 计算机辅助制造与cnc,ComputerAided Manufacturing CNC (计算机辅助制造数控).pdf
  8. 最小延迟调度问题算法c语言,【算法概论】贪心算法:最小延迟调度问题
  9. 在mysql控制台查询有乱码_mysql控制台显示乱码问题
  10. vue中监听input框获取焦点,失去焦点的问题