RewriteEngine On
RewriteLog "/var/log/apache/rewrite_log"
RewriteLogLevel 9
RewriteCond etc.
Once you've debugged your problem, its advisable to take these lines out as they can generate A LOT of logs. Another thing I noticed is that these RewriteLog directives only seem to work when placed in the main httpd.conf, not in .htaccess files despite "AllowOverride All".
I was trying to prevent hotlinking on this site. Basically that means someone who is linking directly to my images (and not to the page in which it is displayed). Essentially this amounts to bandwidth theft. To prevent this, I implemented the following mod_rewrite rules in .htaccess:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} \.(gif|jpg|js|css)$ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?goonda.org/.*$ [NC]
RewriteRule \.(gif|jpg|js|css)$ - [F]
This code prevents any non-blank referrer which does not originate from my website (goonda.org) to receive a 403 (Forbidden) message. Works great!
[ add comment ] ( 985 views ) | permalink
As part of a project at work recently, I had to figure out how to easily encrypt a file for one of our brain-dead developers. Luckily for me the excellent OpenSSL Toolkit was available on the Unix host. Here's how you do it:
To encrypt a file:
openssl enc -aes-256-cbc -salt -in file.txt -out file.enc
To base-64 encode it, simply add the -a switch (for 'ASCII'):
openssl enc -aes-256-cbc -a -salt -in file.txt -out file.enc
The encryption operation requires that you supply a passphrase.
To decrypt the same file:
openssl enc -d -aes-256-cbc -in file.enc
To decrypt base-64 version, you guessed it, add -a flag :
openssl enc -d -aes-256-cbc -a -in file.enc
The passphrase will be prompted for. You can also supply the passphrase on the command line using the -pass option, or read the passphrase from a file using -pass file:/path/to/file.
Neato. A lot more cool tips at the OpenSSL Command-Line HOWTO.
Sure beats reading the heinously long and complex man pages for openssl! Now we really need a good way to be able to do this for batch jobs *without* having to store the passphrase in cleartext.
[ add comment ] ( 1082 views ) | permalink
cURL is a very useful utility to perform HTTP/HTTPS operations from the command line. Many times during a web application pentest you need to send an HTTP POST to a login form (e.g. brute force a login to the site). Here's the very simple way to do it, assuming you the form parameters are called username and password.
curl -d "username=SOMEUSER&password=SOMEPASS" -k https://some.website.com/loginform.jsp
The "-d" indicates you are including data for a POST, the -k says ignore SSL certificate warnings from the remote site.
Using curl is really only good for doing quick spot checks, to do large scale brute forcing I'd recommend using THC Hydra, the super useful perl module libwww-perl aka LWP, or Nessus which has incorporated Hydra. On Windows, Brutus works.
[ add comment ] ( 1149 views ) | permalink

Comments are disabled on this blog, mostly because of the toxic trifecta of:
1) unholy blog spammers
2) crappy captcha systems
3) my own laziness
[ add comment ] ( 2626 views ) | permalink

Calendar


