Skip to main content

Posts

Image IP Logger

We will need :  - image.php - image.jpg - .htaccess image.php <?php $ip = $_SERVER["REMOTE_ADDR"]; $date = date("d-m-y / H:i:s"); $refer = $_SERVER["HTTP_REFERER"]; $agent = $_SERVER["HTTP_USER_AGENT"]; $BR = "<br>"; $HR = "<hr>"; $IPS = @fopen("log.html",'a'); $s = "<b>ip: </b> ".$ip. $BR . "<b>Date: </b>".$date. $BR ."<b>Refer: </b>". $refer. $BR ."<b>Agent: </b>". $agent. $BR . $HR; fwrite($IPS, $s, strlen($s)); fclose($IPS); header('Content-Type: image/jpeg'); $imgpath="image.jpg"; // Get image from file $img = imagecreatefromjpeg($imgpath); // Output the image imagejpeg($img); ?> We could use an gif image then use imagecreatefromgif instead of imagecreatefromjpeg .htaccess RewriteEngine On Rewrit
Recent posts

Popular Rename Technics

 Popular Batch Rename Technics in Linux - using command :   for f in *; do mv -v "$f" "{prefix}$f"; done   for f in *; do mv -v "$f" "$f{suffix}"; done  using rename .pl  rename "expression1" "expression2" *.ext    ex: rename file1.mp3, file2.mp3...... to 1.mp3,2.mp3...... rename "file" ""  *.mp3 - using php limit the filename to 20 characters if ($handle = opendir('/path/to/files')) {     while (false !== ($fileName = readdir($handle))) {         $newName = substr($fileName,0,20);         rename($fileName, $newName);     }     closedir($handle); } delete the last 4 characters of filename for all files if ($handle = opendir('/path/to/files')) {     while (false !== ($fileName = readdir($handle))) {         $newName = substr($fileName,0,-4);         rename($fileName, $newName);     }     closedir($handle); } rename all .ext files eg: rename all .mp3 files to song_

unzip file with php

This is a little php script to unzip file using php <?php function unzip($file){ $zip=zip_open(realpath(".")."/".$file); if(!$zip) {return("Unable to proccess file '{$file}'");} $e=''; while($zip_entry=zip_read($zip)) { $zdir=dirname(zip_entry_name($zip_entry)); $zname=zip_entry_name($zip_entry); if(!zip_entry_open($zip,$zip_entry,"r")) {$e.="Unable to proccess file '{$zname}'";continue;} if(!is_dir($zdir)) mkdirr($zdir,0777); #print "{$zdir} | {$zname} \n"; $zip_fs=zip_entry_filesize($zip_entry); if(empty($zip_fs)) continue; $zz=zip_entry_read($zip_entry,$zip_fs); $z=fopen($zname,"w"); fwrite($z,$zz); fclose($z); zip_entry_close($zip_entry); } zip_close($zip); return($e); } function mkdirr($pn,$mode=null) { if(is_dir($pn)||empty($pn)) return true; $pn=str_replace(array(&#

Bookmarks

http://thehackernews.com http://nakedsecurity.sophos.com http://techcrunch.com/ http://security-sh3ll.blogspot.com http://www.digininja.org http://www.ivizsecurity.com/blog http://ro-ot.blogspot.com http://hackforums.net http://packetstormsecurity.com http://www.exploit-db.com http://1337day.com http://www.sans.org https://www.owasp.org/index.php/Main_Page http://krebsonsecurity.com https://www.schneier.com http://dankaminsky.com http://cyberwarzone.com http://www.securitytube.net http://www.isecur1ty.org http://www.th3professional.com   http://www.ehackingnews.com http://www.r00tsec.com  https://news.ycombinator.com/news  https://www.reddit.com/r/netsec/  https://www.reddit.com/r/blackhat/ http://www.rootsh3ll.com/ https://threatpost.com/ http://www.welivesecurity.com/

Howto: Adding share in samba server under Linux or UNIX

Q. How do I add share called incoming? This share definitions should be linked up to directory called /home/incoming. A. You can define a share using samba configuration file itself. Open /etc/samba/smb.conf file and add code snippet as follows: # vi /etc/samba/smb.conf Add following code: [incoming] comment = Icomming data writable = yes path = /home/incoming Save close the file. Restart Samba : # /etc/init.d/samba restart If you are using Redhat/CentOS/Fedora core type: # service smb restart See also: => A Samba permission howto => For more information and samba configuration option read smb.conf man page by typing following command: man smb.conf => Visit official samba web site for more examples and information.

Lighttpd PHP fastcgi configuration

FastCGI is a language independent, scalable, open extension to CGI that provides high performance without the limitations of server specific APIs. FastCGI provides better scalability and performance. Instead of creating a new process (the CGI program) for every request, FastCGI uses a single persistent process which handles many requests over its lifetime. (See wikipedia article for more information) Make sure php support fastcgi Type any one of the following command to verify that php support fastcgi $ php -v Output: PHP 5.0.4 (cli) (built: Nov 8 2005 08:27:12) Copyright (c) 1997-2004 The PHP Group Zend Engine v2.0.4-dev, Copyright (c) 1998-2004 Zend Technologies OR $ php-cgi -v Output: PHP 5.0.4 (cgi-fcgi) (built: Nov 8 2005 08:25:54) Copyright (c) 1997-2004 The PHP Group Zend Engine v2.0.4-dev, Copyright (c) 1998-2004 Zend Technologies You must get string cgi-fcgi. Next find out full path to php-cgi or php binary: $ which php-cgi Output: /usr/bin/php-cgi