Skip to content

Instantly share code, notes, and snippets.

@deekayen
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deekayen/67ed8972a0e54ef03e8e to your computer and use it in GitHub Desktop.
Save deekayen/67ed8972a0e54ef03e8e to your computer and use it in GitHub Desktop.
Node enumeration script finds the availability of content within a Drupal site for audit purposes. May help uncover pages mistakenly available to anonymous users.
<?php
$url_prefix = 'https://deekayen.net/node/';
$low = 1400;
$high = 1450;
$output_file = '/Users/davidnorman/Sites/scan/scan.csv';
/******************************************/
$fp = fopen($output_file, 'w');
fputcsv($fp, array('URL', 'Status Code'));
for ($i = $low; $i <= $high; $i++) {
$ch = curl_init($url_prefix . $i);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_exec($ch);
$info = curl_getinfo($ch);
if ($info['http_code'] != '404') {
fputcsv($fp, array($info['url'], $info['http_code']));
}
curl_close($ch);
}
fclose($fp);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment