19.09.2017 Views

the-web-application-hackers-handbook

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

788 Chapter 20 n A Web Application Hacker’s Toolkit<br />

TRY IT!<br />

http://mdsec.net/addressbook/32/<br />

In addition to built-in commands and libraries, you can call out to various<br />

simple tools and utilities from Perl scripts and operating system shell scripts.<br />

Some tools that are useful for this purpose are described next.<br />

Wget<br />

Wget is a handy tool for retrieving a specified URL using HTTP or HTTPS.<br />

It can support a downstream proxy, HTTP au<strong>the</strong>ntication, and various o<strong>the</strong>r<br />

configuration options.<br />

Curl<br />

Curl is one of <strong>the</strong> most flexible command-line tools for issuing HTTP and HTTPS<br />

requests. It supports GET and POST methods, request parameters, client SSL<br />

certificates, and HTTP au<strong>the</strong>ntication. In <strong>the</strong> following example, <strong>the</strong> page title<br />

is retrieved for page ID values between 10 and 40:<br />

#!/bin/bash<br />

for i in `seq 10 40`;<br />

do<br />

echo -n $i “: “<br />

curl -s http://mdsec.net/app/ShowPage.ashx?PageNo==$i | grep -Po<br />

“(.*)” | sed ‘s/.......\(.*\)......../\1/’<br />

done<br />

TRY IT!<br />

http://mdsec.net/app/<br />

Netcat<br />

Netcat is a versatile tool that can be used to perform numerous network-related<br />

tasks. It is a cornerstone of many beginners’ hacking tutorials. You can use it to<br />

open a TCP connection to a server, send a request, and retrieve <strong>the</strong> response.<br />

In addition to this use, Netcat can be used to create a network listener on your<br />

computer to receive connections from a server you are attacking. See Chapter 9

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!