PHP Social Networking API written in PHP using XML-RPC for scalability

I have been going through my list of uncompleted projects and I’ve decided that I shall release my scalable Social Networking Platform API in hope that someone or a team would be willing enough to get it over the dip.

It is separated into the following components,

Server Fuction Class - This API handles all the social network database/processing fuctions

* XML-RPC Server - The XML-RPC Server takes requests and passes it to the Server Fuction Class, it returns any meta data that is returned back to the XML-RPC Client.

* XML-RPC Client - This Class is given to the Social Website, it takes requests from the Client Website and  communicates with the XML-RPC Server, returns meta data.

* Client Website - accepts user input, accepts server input, and stores data in arrays, all webserver side processing is done here.

* Smarty Template Engine - Prints out formatted HTML for the websites visitors.

The communication process can only go up or down one step at a time similar to the OSI layers.

I am going from memory here as I do not have the source code at hand right now, but it currently has support for the following fuctions.

* Add/Delete/Modify users

* Unlimited amount of dynamic meta data fields, if a meta field doesn’t exist it will create it.

* Tags

* Friends Functions, Add/Delete/Is online etc.

* File handling (text,image,video,etc)

I also have a very base setup of a functional demo site demonstrating all available functions.

Current problem is just time, I would love to see this operational just I can’t find enough time to get it complete. I will release it as soon as I read through the different Open Source licenses available as I would like some control over the direction of where this will end up.

Filed under: code - No Pointless Response

Wordpress PHPass hash bruteforce PHP script

Ok so I was a bit bored and was curious to know how Wordpress handled its authentication, turns out that it uses Solar Designers PHPass class, so I’ve decided to write a very simple Wordpress Bruteforcer for it.

<?php
require_once(‘./class-phpass.php’); //available at http://www.openwall.com/phpass/
$hash = \$P\$BaahIvdhRXW8Q419WC/alyMUsY7S8I.”; // remember to quote out the $’s
$wp_hasher = new PasswordHash(8, TRUE);
$handle = @fopen (“wordlist.txt”,“r”);
if ($handle)
{
 while (!feof ($handle))
 {
  $pass = fgets ($handle, 512);
  $pass = str_replace (\n, “”, $pass );

  if ($wp_hasher->CheckPassword ($pass, $hash1 ))
  {
    echo “FOUND: “ . $hash . “=” . $pass . \n;
    exit;
  }
 }
}
fclose ($handle);
?>

Does seem to run a bit slow, but it serves its purpose.. If there is enough demand for a faster version I’ll consider writing one up, till then, peace.

Filed under: security - No Pointless Response

Goosh# - Google in a nutshell

I am definitely a console junky, and the internet should never have become graphical, if you have the same thoughts as me then you will probably appreciate this neat google tool.

A guy named Stefan Grothkopp has written something that I wish I had thought of, an AJAX google shell named goosh# that allows you to quickly type what you’re after and get the info in a traditional unix format.

guest@goosh.org:/web> help
help
command aliases parameters function
web (search,s,w) [keywords] google web search
lucky (l) [keywords] go directly to first result
images (image,i) [keywords] google image search
wiki (wikipedia) [keywords] wikipedia search
clear (c) clear the screen
help (man,h,?) [command] displays help text
news (n) [keywords] google news search
blogs (blog,b) [keywords] google blog search
feeds (feed,f) [keywords] google feed search
open (o) <url> open url in new window
go (g) <url> open url
more (m) get more results
in (site) <url> <keywords> search in a specific website
load <extension_url> load an extension
video (videos,v) [keywords] google video search
read (rss,r) <url> read feed of url
place (places,map,p) [address] google maps search
lang <language> change language
addengine add goosh to firefox search box
translate (trans,t) [lang1] [lang2] <words> google translation

Now I am wondering if I should beat the craze and write a console app. Checkgoosh out for yourself at goosh.org.

Filed under: IT - No Pointless Response

PHP Round number to Nearest X

I did a few google searches on rounding numbers using PHP, unfortunately the only thing I could find is the round() function that doesn’t allow you to round to the nearest specified number.

<?php
function roundnum ($num, $nearest)
{
   $ret = 0;
   $mod = $num % $nearest;

   if ($mod >= 0)
     $ret = ( $mod > ( $nearest / 2)) ? $num + ( $nearest - $mod) : $num - $mod;
    else
     $ret = ( $mod > (-$nearest / 2)) ? $num - $mod : $num + ( -$nearest - $mod);
    return $ret;
}

echo roundnum (1234, 15)// round to the nearest 15
echo roundnum (1234, 5); // round to the nearest 5
?>

Enjoy.

Filed under: code - 4 Pointless Responses

Regular Expressions made easy

one thing I can definately say I hate, is regular expression syntax, I do however like what Regular Expressions can do. In a quest to search for an easier better way of assembling regular expressions syntax I’ve stumbled across an awesome website named http://www.txt2re.com/

At first glimpse this website looks a bit complicated, but say we have an example string <a href=”foo.com/whatever”>blah</a>, and we want to extract the domain name, it’s as easy as entering the string, clicking Show Matches, and using the color coded chart to find the FDQN (full qualified domain name).

The beauty of this website is that it also generates the code required for you, they have a selection of a wide range of snippets including Perl, PHP, Python, Java, Javascript, ColdFusion, C, C++, Ruby, VB, VBScript, J#.net, C#.net ,C++.net, VB.net .. Nice.  At the end of the day I can just get on with my programming.

Filed under: code - No Pointless Response

Solaris locked user

I came across a problem under solaris with mysql+PAM authentication where when creating a user via useradd, it locks them out by adding *LK* in /etc/shadow, shadow entries with NP worked fine.

once the user is created, type passwd -N username_here

you will now notice that /etc/shadow will have NP insted of *LK*.

Filed under: Solaris - No Pointless Response