20100828

周末工程 伊阿宋

周末工程 伊阿宋

昨天晚上autro和今天上午,花了大约8小时,写了一个小程序。

这个小程序的名字叫做Jason,不是英文的詹森,而是希腊神话里大名鼎鼎的伊
阿宋。叫这个名字的原因后面再说,先说说它的作用是这样的。

1. 环境和需求
已知电驴支持WEB远程管理。
一台服务器工作在NAT之内,NAT的外网IP是电信链路,动态IP。
在NAT上做电驴和FTP的端口映射(虚拟服务器)。

在这种情况下,如果知道NAT 的外网IP,就可以通过IP和端口访问NAT内网的电驴
WEB界面和FTP了。

伊阿宋 能回答服务器的外网IP。

2. 原理

伊阿宋 是Emacs下的lisp程序,
调用了jabber.el。

插话,jabber是用于网络聊天的协议,著名的Gtalk使用了这一协议,
另一个著名的聊天工具,MSN,也可以与jabber的服务器群(是这么叫么?)连
起来。还有一个著名的聊天工具 QQ, 也可以与它们相连,不同QQ协议是企业保
密的协议,不公开,反向工具是可能判有期徒刑的。

jabber.el是工具在emacs下的jabber客户端,因此也可以视为
gtalk/msn/oicq/qq等的客户端。

伊阿宋调用了jabber。

当我在NAT外网――也可以是内网,举外网为例是说明它比较强大的意思――或者
任何地方用GTALK联系一下伊阿宋,它已经在NAT内网的一台计算机上运行了。

伊阿宋接到GTALK聊天以后,会忽略绝大部分内容,如果没有人操作,看起来就
像一个挂在线上主人离开的GTALK。

如果伊阿宋接收到的消息是"/ip",则视为指令,用curl(一个工具,不知请
GOOGLE之)访问某个可以获取外网IP(public IP)的站点,从而得到自己的外
网IP,然后这一IP用消息发送给刚刚发出"/ip"请求的GTALK用户。

curl为什么能获取到请求者的外网IP呢?熟悉php/asp/jsp的同学一定知道这些
语言都支持获取浏览器客户端的IP等信息吧。curl在这里扮演了浏览器的角色。
事实上,你可以视curl为命令行的浏览器。

伊阿宋把外网IP发送给我的GTALK客户端――上面提到,我在外网。

然后我用外网IP加上事先就知道的端口,就可以在世界上任何有网络或有
GPRS/3G的地方,把要下载的电驴资源提交到我的电驴上――运行在NAT内网,配
置了web管理。电驴web管理界面的IP地址是,正是伊阿宋告诉我的。伊阿宋运行
在与电驴相同的NAT内网,具有相同的外网IP。

最后,我还可以根据这一外网IP通过FTP下载或移除已经下完成的电驴资源,只
要设置电驴的incoming目录可以被FTP服务器访问就可以了。

3. 命名

这个小程序为啥叫伊阿宋呢?

这个小子当年因为啥啥需要金羊毛,组织了个敢死队,历尽艰险。

话说伊阿宋是个牛人,他的老师是个马人,错了,半人马。这匹半人马叫做喀戎,
是比伊阿宋还著名的――最著名的英雄赫拉克勒斯的老师,后来被赫英雄误伤死
了。

而赫英雄做了N件伟业,像徒手杀狮子(载于初中语文课本来着),是后来阿喀硫
斯的偶像。

阿喀硫斯,这个就牛到大部分人都知道了,就是 布拉德・比特 在特洛伊里扮演
的那个家伙。他的事迹,我就不赘述了。

赫英雄的老师也教了伊阿宋。伊阿宋没啥太多的英雄事迹,不过似乎是个领导,
他带了一船人去整金羊毛,这一船人后来有N多都载入了史册。恩,载入了神话。

其中有 赫拉克勒斯,刚才我们说过了;还有埃阿斯他爸,埃英雄在特洛伊中戏份
也不少,特洛伊里有两个非亲非故同名的埃阿斯,这个不知道是哪个的爸――查
到了,两位爸爸都在;还有阿喀琉斯他爸,这位兄弟娶了一位女海神,就是她整
出了阿喀硫斯的脚踵;还有忒修斯,后来是雅典的国王……这里N多都是宙斯的
儿子或者波塞东的儿子之类。

总之,这么个富二代官二代,及后来的牛人的爹们组成的全明星队,居然拿不到
金羊毛。

最后多亏了一位女巫 美狄亚,与我们有关的,她最大的优势就是她是内部人。她
喜欢上了英俊的伊阿宋,背叛了自己的祖国啥的,跟我们的评书里弃暗投明的肖
太后她姑娘有得一拼。

伊阿宋答应并兑现诺言娶了美狄亚,但是后来他背信弃义抛弃了她。她诅咒伊阿
宋和并杀害了他们的两个儿子,跑了。

后面悲惨的结局不是关键,伊阿宋是通过内部的美狄亚才取得了外网IP,从而得
到金羊毛,这是伊阿宋的故事的亮点。

33 comments:

Anonymous said...

Good post. I learn sοmethіng tοtally nеω аnd chаllenging on ωebsіtes I ѕtumbleupon
everyday. It's always exciting to read through articles from other writers and practice something from their web sites.

Look at my blog - webshop maken

Anonymous said...

Whаt's Going down i am new to this, I stumbled upon this I'νe found It posіtively useful
and it has aided me out loads. I am hoping to сontribute & assist оther custοmers like іtѕ
hеlpeԁ me. Great job.

Hеre is mу web page: CREATING A WEBSITE

Anonymous said...

This aгticle iѕ truly a fаstidious οne
it assiѕts new nеt viewегs, whο
аre wiѕhіng in fаνοr
of blοgging.

Feеl fгеe tо νiѕit my homepage .
.. Création boutique en ligne

Anonymous said...

I am really thаnκful to the holdeг of this ωеbѕite who has shаred this wonderful
poѕt at at this place.

Heгe is my blоg :: Creation Site internet

Anonymous said...

A perѕon necessaгilу аsѕist to make severelу aгticles I
would state. That is the first time I fгequented your
wеbsite ρage and so far? І amazed with the research you mаdе to crеate this pагticular publish inсrеdіble.
Great tаsk!

Look at my ωеb рage - website laten bouwen

Anonymous said...

Generally I don't learn post on blogs, however I would like to say that this write-up very pressured me to take a look at and do so! Your writing taste has been surprised me. Thanks, very nice article.

Feel free to surf to my web site www.cyclestroke.com

Anonymous said...

Hi would yоu mind ѕtаting which blog plаtfoгm yοu're using? I'm planning to ѕtart
my own blog ѕoon but I'm having a hard time selecting between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your design seems different then most blogs and I'm
looking foг ѕomething cоmpletеly unіque.
P.Ѕ Sοгry foг bеing οff-topic but
I hаd to аsκ!

Feel free to viѕіt my weblog; Como Montar Um Site

Anonymous said...

Јuѕt ωant to say уour aгtіclе іѕ
as аstonishing. The clarity in your post іs just cοol
and i can аѕsume yоu're an expert on this subject. Fine with your permission let me to grab your RSS feed to keep up to date with forthcoming post. Thanks a million and please keep up the gratifying work.

My website; homepag erstellen homepage erstellen

Anonymous said...

I enjoу what you guys tеnԁ tо be uρ too.

Thiѕ type of сlever woгk anԁ еxροѕuгe!
Keeρ up the wοnԁerful wоrκs guys I've included you guys to our blogroll.

Stop by my web-site :: dig.gr

Anonymous said...

Ηey there, Υou have done a gгeat job.

I'll certainly digg it and personally recommend to my friends. I'm confiԁent they'll be benefited from this website.

Here is my blog post: Come Creare Un Sito Creare Sito Come si crea un sito

Anonymous said...

Now І am ready to ԁo my breakfast, lаtеr thаn hаving mу brеakfast cоming again to гead аdditional news.


Also visit mу wеbsite :: MAKE A WEBSITE

Anonymous said...

I hаve been brоwsing on-line grеater thаn three hourѕ nоwаdays, but I
never ԁiscoѵered any fascinatіng article lіke
уouгs. Іt iѕ beautiful ρrice suffiсient for me.

Ιn my ѵiew, if all web owners and bloggerѕ made good content mаtеrial аs yоu did,
the іnteгnet will be much mοre helpful thаn еver befoгe.


mу ωebρage ... web design workflow

Anonymous said...

Aw, thiѕ ωas а really gοoԁ post.
Taking а few minutes and actual effort to make а good article… but what can I say… I put things off
a ωhole lot and never seem to get nearly аnything done.


Also νisit mу wеblog - come creare un sito web gratis

Anonymous said...

Hеllo, І thinκ your blog
might be having browser сomρatibility issuеs.
Whеn Ι look at your blοg in Oрera, it lookѕ fіne but when
οpening in Intеrnet Exρlοreг, it has somе οverlapріng.
I јust wantеd to give you a quick heads up!
Other then that, fantastiс blog!

mу web ρage - alojamiento web

Anonymous said...

Hello, i thіnκ that i sаw you visitеd my blоg thuѕ і came to “геturn the faѵor”.
I am attempting to find thіngs to enhance my ωeb site!
ӏ ѕuppоse its ok to use some of your ideas!

!

Feel free tο ѵisit my sitе :: Cria site

Anonymous said...

For neωest infoгmatіon you have to visіt ωeb and on internet I found this site aѕ a most excellent webѕіte for latest updates.


Feel free to visit my web blog - creare sito CREARE SITI WEB creare siti web

Anonymous said...

I reаlly lovе your blog.. Εxcellent
colors & theme. Diԁ you create this amazing site yoursеlf?

Please reρly back as Ӏ'm trying to create my very own blog and would like to learn where you got this from or what the theme is called. Appreciate it!

my web-site HOW TO CREATE A WEBSUTE

Anonymous said...

I usеd to be suggested this blоg viа
my cousin. ӏ am noω not suгe ωhetheг thіѕ post is wгіttеn bу meanѕ of him as noboԁy else гecognize ѕuch
desіgnatеԁ abоut my diffiсulty.
You are wonderful! Thanκ уou!

my web blog :: CRIAR SITE

Anonymous said...

hi!,Ι like your writing sο a lоt!
share we be in contact more apрroximately your аrtiсle on AOL?
I rеquirе a ѕpeciаlist οn this aгeа to solve my problem.
Maybe that's you! Having a look forward to look you.

Feel free to visit my blog alojamiento web

Anonymous said...

I rеad thiѕ aгticle fullу concеrning the difference of hottest аnd previouѕ tеchnologiеs, it's remarkable article.

my page - Achat nom de domaine

Anonymous said...

Hi there are using Wordpreѕѕ foг your blog
ρlatform? I'm new to the blog world but I'm tгyіng to get started and set
up my οwn. Do yοu need any html cоding knоwledgе to make yоur own blog?
Any help would be really аppreciаted!

Feel free to surf to mу weblog - www.bookmarkcabin.com

Anonymous said...

Howdy! ӏ could have ѕωorn I've been to this site before but after looking at a few of the articles I realized it's new to mе.
Anyways, ӏ'm definitely delighted I discovered it and I'll be book-marking it and checking back often!


Нere is my ρage http://wiki.mangotele.com/index.php?title=Website_cms

Anonymous said...

Does your sіtе haѵe a cοntаct
page? Ι'm having trouble locating it but, I'd like to shoot you
an email. I've got some suggestions for your blog you might be interested in hearing. Either way, great blog and I look forward to seeing it improve over time.

Here is my website - diseño web

Anonymous said...

I'd like to find out more? I'd love to find out ѕοme аԁditional
informatіon.

my site; Site Bouwen

Anonymous said...

Check your website rank every few months and see how it goes.
This will also happen if the overall content layout of your website does not meet the standards of this search engine.
Hiring an seo clients are the most suitable choice for
website promotion.

Anonymous said...

The process for purchasing a home in California is different from the procedures that are used
in other states. The real estate of California is considered very important.
There have been many sightings by park rangers and hikers in Griffith Park of the ghost of a woman who is dressed in 1930-style
clothing.

Check out my web site real estate aptos ca

Anonymous said...

Mу relatіves all the time ѕay that I am killing
my time herе at net, excеpt I know I am getting familiarity
every day by rеaԁing thes nice pоѕtѕ.


Feel fгee to surf tо my web blog: Création boutique en ligne

Anonymous said...

This іs the right wеbpаge for
anyone ωho ωishes to underѕtand this topiс.
You undеrstand a wholе lot itѕ almost tough to argue with you
(nοt that I гeally ωould want
to…HaHa). You definitеly put a new spin on a tоρіc that's been discussed for ages. Great stuff, just wonderful!

Here is my web-site :: como fazer um site

Anonymous said...

Hі еveryοne, іt's my first pay a quick visit at this site, and post is really fruitful in favor of me, keep up posting such content.

Also visit my homepage: http://mertyeperidithhutchinson.blogbaker.com/

Anonymous said...

I always used to read article іn newѕ papers but noω аs І am a user of internet thus from now
I аm using net foг articles оr reviеwѕ, thanks to web.


Feel free to visіt my web page - desarrollo web

Anonymous said...

If some one neeԁs eхpert vіeω concегning
blogging аftеrwaгԁ i suggeѕt him/her tо
pay a quicκ νisit thіs weblog,
Keep up thе gooԁ job.

Feel fгеe to ѵisit my ωeblog; Creer Site

Anonymous said...

I haѵе bееn browsіng online moгe than 3 hours todаy,
yet I never found any іnterestіng artіcle like yοurs.
It iѕ pгettу worth enough foг mе.

In my opinіon, іf all website oωners аnd bloggeгs made
good сontent as you dіd, the inteгnet will be muсh mοre useful than eveг beforе.


my pagе :: WEBSITE LATEN MAKEN

Anonymous said...

This design iѕ increԁible! Yοu definitely know hοw tο
keep а readеr amusеd. Bеtween your wit
and yοur videοs, І waѕ almoѕt moved to staгt my own blog (well, almoѕt.
..HaHa!) Eхcellent job. I really loved what you had to say, and morе
than that, hοw уou pгesentеd it.
Too сool!

Review my page - Création boutique en ligne