Scalp! is a log analyzer for the Apache web server that aims to look for security problems. The main idea is to look through huge log files and extract the possible attacks that have been sent through HTTP/GET (By default, Apache does not log the HTTP/POST variable).
Monthly Archives:: May 2011
I recently had an issue where I was sorting a array using php’s sort() function. This worked fine, except the ordering gets out of logical order when you get into the double digits. Example:
1 2 20 21 3...
This is where natsort() comes in. This is PHP’s natural sorting algorithm. It sorts based on how a human would sort a list rather than the way a machine would.
So I replaced
natsort($narray); $narray = array_values($narray);
Bad hax0rs! base64_decode is used by hackers frequently when they hijack a site to obfuscate their malicious code. This quick BASH one-liner will find files containing this evil function and lists them out:
find . -name '*.php' | while read FILE; do if grep 'eval(base64_decode' "$FILE"; then echo "$FILE" >> infectedfiles; else echo "$FILE" >> notinfected; fi ; done
I found a handy technique to find files modified between a specific date. In essence, we touch two temp files, setting the modified dates to the range we want to find:
touch temp -t 201104141130 touch ntemp -t 201104261630
Note the date is yyymmddtime.
Then we run the find command:
find /path/to/folder/ -cnewer temp -and ! -cnewer ntemp
Here is a great method to remove the background of a image without dealing with the ugly edged the magic wand tool can produce.
1. copy the image to a new layer and delete the background layer
2. copy the image to a new layer again and INVERT it
3. copy the inverted layer into the clipboard, and switch off its visibility for now
4. go back the the first image and create a layer mask
5. press ALT whilst clicking on the mask thumbnail
6. paste the inverted image, then click back to the image thumbnail in the layer palette
7. duplicate this new layer until necessary (5 times?) and delete the inverted layer you created at the start
8. merge down the layers one by one (Ctrl-E) choosing to “apply mask” each time
I was snooping around the Yii documentation and came across system.web.helpers CGoogleApi. It’s here: www.yiiframework.com/doc/api/1.1/CGoogle…
Anyway, my interest was piqued, so I took a look at whatGoogle has to offer. I was expecting calendar, maps, search yadda. There LOTS more!
Google has a playground that you can use to demo the APIs: code.google.com/apis/ajax/playground
Translation, RSS Feeds, Maps/Directions, and all the other Google services are all right there!
Here is the lowdown on theming jQuery:
- Create the Theme: jqueryui.com/themeroller/
- Extract and upload the contents of the theme’s css directory to /css/jui (we set this later on…)
- Add themeUrl, theme, and cssFile (see example below). Be sure to set them according to the path of the files you just uploaded.
themeurl is the base folder for the theme… usually in the css folder. I use /css/jui.
theme is the folder name inside e.g. /css/jui/humanity
cssfile is the theme’s cssfile.
/* optional: change visual
* themeUrl: "where the themes for this widget are located?"
* theme: theme name. Note that there must be a folder under themeUrl with the theme name
* cssFile: specifies the css file name under the theme folder. You may specify a
* single filename or an array of filenames
* try http://jqueryui.com/themeroller/
'themeUrl' => Yii::app()->baseUrl.'/css/jui' ,
'theme'=>'humanity', //try 'bee' also to see the changes
'cssFile'=>array('jquery-ui.css' /*,anotherfile.css, etc.css*/),