Skip to content

Instantly share code, notes, and snippets.

View jasperf's full-sized avatar
🏠
Working from home

Jasper Frumau jasperf

🏠
Working from home
View GitHub Profile
@jasperf
jasperf / base64sandd.php
Created July 28, 2012 00:26
Find Base64 Occurrences #security
<html><head><title>Find String</title></head><body>
<?php
// Most hosting services will have a time limit on how long a php script can run, typically 30 seconds.
// On large sites with a lot of files this sript may not be able to find and check all files within the time limit.
// If you get a time out error you can try overideing the default time limits by removeing the // in the front of these two lines.
// ini_set('max_execution_time', '0');
// ini_set('set_time_limit', '0');
@jasperf
jasperf / searchanddestroy.sh
Last active February 1, 2022 19:09
Hacked Search and Desctroy Bash commands #security #unix
#Search for eval(base64_decode)
find . -name \*.php -exec grep -l "eval(base64_decode" {} \;
#Look for world writable files
find . -type d -perm -o=w
#last logins + ip addresses from where the user logged in
last -i | grep youruser
last -if /var/log/wtmp.1 | grep youruser
@jasperf
jasperf / lookforbadguys.php
Created July 28, 2012 00:47
Look for Bad Guys By Karen Chun, Steven Whitney #security #php
<?php
/* lookforbadguys.php 2011-09-27
Copyright (C)2011 Karen Chun, Steven Whitney.
Initially published by http://25yearsofprogramming.com.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
Version 3 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@jasperf
jasperf / heavy-users-by-ip
Created September 30, 2012 06:26
Check for Heavy Site Users by IP via Shell #serveradmin
cat access.log | awk '{print $1}' | sort | uniq -c | sort -n | tail
# in awk $1 is first column
# in uniq -c asks each output line to be preceded with the count of the number of times
# the line occurred in the input, followed by a single space.
# See http://wiki.dreamhost.com/VPS_Troubleshooting
# You need to be @ /home/user/logs/domain/http
@jasperf
jasperf / wphtmlintagline
Created October 31, 2012 05:44
Add HTML to WordPress Tagline #wordpress
//to add html to tagline in Wordpress adjust the tagline generation in header.php
//see http://englishmike.net/2008/07/03/wordpress-quick-tips-2-embedding-html-in-blog-titles-and-descriptions/
//working on functions.php filter..
html_entity_decode(get_bloginfo('description'));
@jasperf
jasperf / wp-change-post-dates
Created November 5, 2012 02:39
Change all Post Dates in WordPress #wordpress #posts
//DATE_ADD to add and DATE_SUB to substract. Do not forget to backup DAY and YEAR can be used as well
//Adjust table prefix when needed
//Also see http://wordpress.org/support/topic/possible-to-change-publishing-dates-of-all-posts-in-one-shot?replies=3
UPDATE wp_posts
SET post_date = DATE_ADD( post_date, INTERVAL 12 MONTH ),
post_date_gmt = DATE_ADD( post_date_gmt, INTERVAL 12 MONTH ),
post_modified = DATE_ADD( post_modified, INTERVAL 12 MONTH ),
post_modified_gmt = DATE_ADD( post_modified_gmt, INTERVAL 12 MONTH )
@jasperf
jasperf / macportsdepends
Created December 17, 2012 06:43
MacPorts - What ports depend on this port? #macports #dependancy
port dependents "port-name to check for ports depending on it"
@jasperf
jasperf / import-export-mysql-data
Last active December 11, 2015 02:18
Importing and Exporting (Backup) MySQL dump from the command line #mysql #import #export
mysql -u user -p -h host.com database-name < dump.sql //importing
mysqldump -u user -p(password) -h hostname database-name > filename.sql // exporting or backing up database
@jasperf
jasperf / install-wp--from-commandline
Created January 26, 2013 04:09
Command Line WordPress Installation #wordpress #installation
wget http://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
mv wordpress/* .
rmdir wordpress
//After all this the rest can be done from the browser as long as the database has been created
//PHP >=5.3 https://github.com/wp-cli/wp-cli - awesome free tool
@jasperf
jasperf / chmod-permissions
Last active January 28, 2016 10:50
Changing file and directory permissions to make site safer after tinkering with file and directory permissions. This will make all directories 755/775 and all files 664/664 #chmod
//useful when PHP is running as Apache Module
find . -type d -print0 | xargs -0 chmod 0775 # For directories
find . -type f -print0 | xargs -0 chmod 0664 # For files