Penetration Testing with Perl by Douglas Berdeaux
Author:Douglas Berdeaux
Language: eng
Format: mobi, pdf
Publisher: Packt Publishing
Published: 2014-12-30T08:00:00+00:00
sub page{ # check for pages
my $res = $ua->get("http://".$host.":".$port."/".$_[0]);
if($res->is_success){
@content = split(/\015?\012/,$res->content);
return $_[0];
}
return 0;
}
END {
$sock->close() if $sock;
}
The section portion of the preceding code loops through the returned result in $buf and checks for a web server. If found, $web becomes true. If it's true, we loop through a few file extensions and test the server for an index page of each extension.
Finally, if a page is found, we loop through its returned content in @content from the content() method of the $res object, and print any links found. These links are found using the regular expression <a.*href=("|')([^"']+)("|'). The carat in the square brackets negates both quotation marks, which means "match anything except for a single quote and a double quote character".
Now, we can browse these pages and look for forms or other means for data input to possibly exploit. If we get a proper return value from page(), then we call last() to break from the foreach() loop. The END{} block contains one simple line to close our socket when the program exits.
We can also easily add a new global variable to the application, and increment it from page() in order to keep track of our HTTP requests and have that printed from the END{} block as well.
Let's run this application in the hope of finding more clues to the potential vulnerabilities of our target, and analyze the output:[trevelyn@shell ~]$ perl test.pl lab.weaknetlabs.com 180
Web Server Found: lighttpd/1.4.28
Page: index.html
File: comments.php
File: http://lab.weaknetlabs.com/vuln/index.php
File: ../../var/www/index.html
File: /vuln/showget.php?id=3
[trevelyn@shell ~]$
Download
Penetration Testing with Perl by Douglas Berdeaux.pdf
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Deep Learning with Python by François Chollet(12570)
Hello! Python by Anthony Briggs(9915)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9796)
The Mikado Method by Ola Ellnestam Daniel Brolund(9778)
Dependency Injection in .NET by Mark Seemann(9338)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8296)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7763)
Grails in Action by Glen Smith Peter Ledbrook(7696)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7557)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(7073)
Microservices with Go by Alexander Shuiskov(6836)
Practical Design Patterns for Java Developers by Miroslav Wengner(6758)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6698)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6413)
Angular Projects - Third Edition by Aristeidis Bampakos(6102)
The Art of Crafting User Stories by The Art of Crafting User Stories(5628)
NetSuite for Consultants - Second Edition by Peter Ries(5564)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5369)
Kotlin in Action by Dmitry Jemerov(5062)
