最初官方的代码没有找到,但是发现github里貌似有:

git clone https://github.com/splitbrain/dnstunnel.git

源码是perl写的,需要安装一些perl依赖包。

安装perl模块方法说明:

(sudo) perl -MCPAN -e shell
install Log::Log4perl
install HTML::TokeParser::Simple
h
q
   
The above will install Log4perl in /usr/lib/perl5/site_perl/5.6.1/Log/Log4perl.
需要注意的是必须使用root权限才能安装成功。

看源码dnstunneld

use Fcntl;
use Net::DNS;
use Net::DNS::Nameserver;
use LWP::UserAgent;
use Time::HiRes qw ( usleep gettimeofday );
use MIME::Base64;
use MIME::Base32 qw ( RFC );
use IO::Socket;
use Class::Struct;
use threads;
use threads::shared;
use Thread::Queue;
use Getopt::Long;

需要安装Net::DNS, LWP::UserAgent,Time::HiRes ,MIME::Base64,IO::Socket,Class::Struct,Getopt::Long。 MIME::Base32不需要,直接注释掉源码!如果不注释掉,发现有导入包的错误。

dnstunnelc,客户端安装包类似:

use Fcntl;
use Net::DNS;
use MIME::Base64;
use MIME::Base32 qw ( RFC );
use Time::HiRes qw (usleep gettimeofday );
use Getopt::Long;
use threads;
use Thread::Queue;

需要安装Net::DNS,MIME::Base64,Time::HiRes,Getopt::Long;同样注释掉use MIME::Base32 qw ( RFC ); 这行代码!

server端:

sudo perl dnstunneld -i 0.0.0.0 a.friendsxxx.com 

client端:

ssh -o ProxyCommand="perl dnstunnelc  a.friendsxxx.com" root@xxx.com

没有成功!可能是被dns服务器给切断了。

The Fake Server

The fake server you can set up at your server to tunnel all the traffic through is a little program called OzymanDNS, written in Perl (Client and Server together 642 SLOC) by DNS guru Dan Kaminsky. The tool is split in four files, two of them being a file upload/download tool using DNS. Nice examples, but rather uninteresting for our approach.

The script nomde.pl is the server. Since the server binds to port 53 UDP on your server (which is a privileged port) you must be root to start the server. Also, make sure port 53 UDP is reachable from the outside (consider running nmap -v -sU host from a remote machine). You will usually want to start it as follows:

sudo ./nomde.pl -i 0.0.0.0 server.example.com

Here, the server will only listen to DNS requests for all subdomains of server.example.com. That way, people who don't know that exact address cannot use the service on your server.

The Client

The OzymanDNS client is just a perl script which encodes and transfers everything it receives on STDIN to it's destination, via DNS requests. Replys are written to STDOUT.

So this isn't particularly useful as a standalone program. But it was designed to be used together with SSH. And with SSH this works great. SSH has a config option, ProxyCommand, which lets you use OzymanDNS's droute.pl client to tunnel the SSH traffic. The command to connect to your server would look like this:

ssh -o ProxyCommand="./droute.pl sshdns.server.example.com" user@localhost

Note two things:

  1. Add a sshdns. in front of the hostname you specified the server to listen to and
  2. Since your connection will already have been tunneled through DNS (and thus has come out at your host already) there is no need to login as user@server.example.com (because that already is localhost)

Once the connection is established (you'll probably have to enter your password) you have a shell! The connection is a little bit droppy sometimes and has not got the best latency, but it is still good keeping in mind that connections to the internet are not allowed at this Cafe/Airport/....

Tunneling

Once you verified that the connection is actually working, you can set up a tunnel so that you may not only have shell, but complete web acces, can fetch mails using POP, etc., etc...

For this, I recommend to read my tutorial on How to Tunnel Everything through SSH.

Don't forget: It may provide great performance increases to use SSH's -C ("compress data") switch!

Communication between the Servers

So, now how might the servers communicate with each other, not being directly able to establish a connection?, you might ask now.

Well, since all subdomain resolve requests are delegatet (ie., relayed) to your host, you can include arbitrary data in the hostname which your server then can interpret and execute/relay.

The bytes you want to send to the server (upstream) will be encoded using Base32 (if you know what Base64 is, Base32 is just the same except there is no case sensivitiy, for EXAMPLE.COM ist just the same as example.com). After the data, there is a unique ID (since some DNS requests may take longer than others and the UDP protocol has no methods to check this) and either one of the keywords up or down, indicating whether the traffic's up- or downstream. Here is what an example request could look like (transferring something to the server):

ntez375sy2qk7jsg2og3eswo2jujscb3r43as6m6hl2ws
xobm7h2olu4tmaq.lyazbf2e2rdynrd3fldvdy2w3tifi
gy2csrx3cqczxyhnxygor72a7fx47uo.nwqy4oa3v5rx6
6b4aek5krzkdm5btgz6jbiwd57ubnohnknpcuybg7py.6
3026-0.id-32227.up.sshdns.feh.dnstunnel.de

The server's response comes as a DNS TXT record. A TXT record can hold arbitrary ASCII data and can hold uppercase letters as well as lowercase letters and numbers (some other characters, as well). So the responses come Base64 encoded. Such a response might look like the following one:

695-8859.id-39201.down.sshdns.feh.dnstunnel.de.   0       IN      TXT
"AAAAlAgfAAAAgQDKrd3sFmf8aLX6FdU8ThUy3SRWGhotR6EsAavqHgBzH2khqsQHQjEf355jS7cT
G+4a8kAmFVQ4mpEEJeBE6IyDWbAQ9a0rgOKcsaWwJ7GdngGm9jpvReXX7S/2oqAIUFCn0M8="
"MHw9tR0kkDVZB7RCfCOpjfHrir7yuiCbt7FpyX8AAAABBQAAAAAAAAAA"

That is, in rough outlines, how tunneling via DNS works.

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

OzymanDNS 使用——perl 5.22没有成功。。。相关推荐

  1. 实战:kubeadm方式搭建k8s集群(k8s-v1.22.2,containerd-v1.5.5)-2023.2.22(测试成功)

    实验环境 1.硬件环境 3台虚机 2c2g,20g.(nat模式,可访问外网) 角色 主机名 ip master节点 master1 172.29.9.51 node节点 node1 172.29.9 ...

  2. 保定警方成功侦破“11.22”案件

    2011年12月2日,保定市公安局北市区分局经缜密侦查,成功侦破"11.22"案,抓获犯罪嫌疑人傅某某(男,23岁).曹某某(男,21岁,二人均为山东省滕州市人). 2011年11 ...

  3. 数据库服务器 之 在Linux下使用perl通过unixODBC连接SQLServer2000

    作者:tonyvicky 来自:LinuxSir.Org 摘要:MS从来没有提供过SQLServer for Linux,所以大家也不要去尝试在Linux系统安装SQLServer,但是可以通过ODB ...

  4. linux对perl脚本加密,对Perl代码进行编译与加密

    我写了一些Perl程序.为了防止程序在传播扩散过程中遭人随意篡改或出售而引起版权纠纷,于是需要对一些程序进行编译和加密处理. 1. 使用perlcc命令对perl代码进行编译 我安装的时CentOS ...

  5. 物美集团携手SAP ERP项目成功上线(转)

    物美集团携手SAP ERP项目成功上线 2008-01-24 07:04:55 来源:赛迪网 中国领先的民族零售企业集团--物美集团ERP项目(WINBOX)在旗下所有配送中心.大卖场.综超和便超成功 ...

  6. Strawberry Perl 所有版本链接

    包含所有新旧版本msi格式链接: http://strawberryperl.com/releases.html 本页使用Ctrl + F可以找到是否有你需要的版本号. Strawberry Perl ...

  7. 成功没有捷径python_成功路上没有捷径说说 成功需要过程的句子

    1. 好累,还是要撑住锻炼我的意志和内心 ,成功的路上没有捷径. 2. 成功路上没有捷径,相信"坚持"是最好的良策. 3. 就当是一场梦成功的路上没有捷径沉下心来好好提升自己早日实 ...

  8. linux 远程22端口打开,kali如何手动打开22端口

    首先使用netstat -lnt查看一下当前kali开放的端口,如果没有开放22端口,我们需要手动开启22端口. netstat -lnt 第一步:开启kail 远程ssh,开启办法如下: 1.配置S ...

  9. 启明创投投资企业神州细胞成功登陆科创板

    启明创投投资企业神州细胞生物技术集团股份公司(下称"神州细胞")于6月22日成功登陆科创板.神州细胞(688520.SH)发行价格为每股25.64元,开报85元,市值370.04亿 ...

最新文章

  1. 不是python对文件的读操作方法的是-python的文件操作方法
  2. 探索Julia(part1)--Julia初识
  3. 将Session写入Memcache
  4. javascript !-- //-- 与老的浏览器打交道
  5. PHP修复输入验证代码中的漏洞
  6. 【现代控制理论基础】二、线性控制系统的运动分析
  7. 十二时辰及经络走向图
  8. 微信分享至朋友圈和朋友接口
  9. 主动学习,半监督学习,直推学习
  10. 英特尔移动处理器全面解析
  11. 实现英文的大小写转换
  12. 达文教育2022年John Locke主题讲座再度来袭
  13. 计算机系统——信息的表示与处理
  14. 云帆加速:广电新媒体营收如何跑赢成本
  15. 少儿编程Scratch学习教程2--官方初学指南
  16. ubuntu下查看硬件信息等指令整理,安装并简单运行HotSpot
  17. 用计算机弹猴哥,《西游记》孙悟空获“弼马温”一职,网友弹屏吐槽:猴哥被忽悠了...
  18. 解决了ora-00119和ora-00132这个问题,不容易啊
  19. Reactive思考
  20. 驻留内存 虚拟内存 共享内存

热门文章

  1. export 和 export default 的区别
  2. httpClient 超时时间设置
  3. oracle在哪些系统运行,ORACLE 查看系统运行情况
  4. 计算机事业单位专技岗考什么区别,事业单位管理和专技岗位有什么区别?哪个有前途?...
  5. 计算机一级题资源,计算机一级B考题汇总(珍贵资源)
  6. 【吐血整理】用java编写一个登陆界面
  7. Android权限处理,Android校招面试指南
  8. 【408预推免复习】计算机组成原理之系统总线
  9. 【PAT (Advanced Level) Practice】1093 Count PAT‘s (25 分)
  10. 【深度学习入门到精通系列】医学图像预处理—CLAHE变换代码